nsdecimalnumber

Examples of doing decimal math in iPhone.

I'm pulling decimal values from a sql table as a text field which i then convert to an NSDecimalNumber (this is simply because i didnt know read/write decimal values to sqllite). Anyway, now i've hit a wall now that im trying to do simple math routines on these decimal variables. Such as, Sum = Balance * Interest_Rate. The idea is that ...

how should nsdecimalnumber's be stored in the database?

What is the best way to store nsdecimalnumbers in a database? Numeric types like float, real and double are out, because it is important to preserve the precision for currency usage. The two alternatives I have considered are string and storing two ints, one holding the mantissa and one holding the exponent. The challenge facing the lat...

objective c losing NSDecimalNumber value when accessed from another method

I am parsing Json Data into an NSDecimalNumber as follows product.Price = [NSDecimalNumber decimalNumberWithDecimal:[[jProduct objectForKey:@"Price"] decimalValue]]; This is in a loop with each product being added to an array. At the end I release the json object. If I Log the value of product.Price during the loop the value is corre...