NSDecimalNumber
NSDecimalNumber is a Foundation class that provides an immutable decimal-number object and supports precise base-10 arithmetic. It is a subclass of NSNumber and is designed to avoid the rounding errors associated with binary floating-point types, making it well suited for financial calculations and other domains requiring exact decimal results.
NSDecimalNumber uses an internal decimal representation with a fixed precision of up to 38 significant digits
To control rounding and error handling, NSDecimalNumber relies on an object that conforms to NSDecimalNumberBehaviors, typically
Creating NSDecimalNumber instances can be done via factory methods such as +decimalNumberWithString:, +decimalNumberWithDecimal:, and +decimalNumberWithMantissa:exponent:isNegative:. There
Arithmetic with NSDecimalNumber is provided through methods such as -adding:, -subtracting:, -multiplying:, and -dividing:, each returning