Currency & High Precision Numbers With NSDecimalNumber

NSDecimalNumber is ideal if you need to work with numbers representing monetary values or those times when you can’t afford to lose precision in your calculations.

NSDecimalNumbers are expressed as a sign (+ -) a mantissa and exponent.

For example, 199.08 is as follows:

sign: +
mantissa: 19908
exponent: 10^-2 (ie 10 raised to the -2)

Here are two ways to define 199.08:
Continue reading