Name
NSDecimalNumber — Mac OS X 10.0
Synopsis
This subclass of NSNumber provides an
object-oriented wrapper for performing base-10 arithmetic
operations. Instances of NSDecimalNumber are
created with a string such as
“10.2e4” using
decimalNumberWithString:, or by specifying the
mantissa, exponent, and whether or not it is negative in the method
decimalNumberWith-Mantissa:exponent:isNegative:.
Arithmetic operations are performed
on two decimal number objects using methods such as
decimalNumberByAdding:,
decimalNumberByMultiplying:, and so forth. The
value of the decimal number can be accessed as a
double by sending a doubleValue
message to the object.
|
|
@interface NSDecimalNumber : NSNumber
|
// Initializers
|
- (id)initWithDecimal:(NSDecimal)dcm; |
- (id)initWithMantissa:(unsigned long long)mantissa exponent:(short)exponent isNegative:(BOOL)flag; |
- (id)initWithString:(NSString *)numberValue; |
- (id)initWithString:(NSString *)numberValue locale:(NSDictionary *)locale; |
// Class Methods
|
+ (NSDecimalNumber *)decimalNumberWithDecimal:(NSDecimal)dcm; |
+ (NSDecimalNumber *)decimalNumberWithMantissa:(unsigned long long)mantissa exponent:(short)exponent isNegative:(BOOL)flag; |
+ (NSDecimalNumber *)decimalNumberWithString:(NSString *)numberValue; |
+ (NSDecimalNumber *)decimalNumberWithString:(NSString *)numberValue locale:(NSDictionary *)locale; |
+ (id <NSDecimalNumberBehaviors>) ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access