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>)defaultBehavior;
|
+ (NSDecimalNumber *)maximumDecimalNumber;
|
+ (NSDecimalNumber *)minimumDecimalNumber;
|
+ (NSDecimalNumber *)notANumber;
|
+ (NSDecimalNumber *)one;
|
+ (void)setDefaultBehavior:(id <NSDecimalNumberBehaviors>)behavior;
|
+ (NSDecimalNumber *)zero;
|
// Instance Methods |
- (NSComparisonResult)compare:(NSNumber *)decimalNumber;
|
- (NSDecimalNumber *)decimalNumberByAdding:(NSDecimalNumber *)decimalNumber;
|
- (NSDecimalNumber *)decimalNumberByAdding:(NSDecimalNumber *)decimalNumber
withBehavior:(id <NSDecimalNumberBehaviors>)behavior;
|
- (NSDecimalNumber *)decimalNumberByDividingBy:(NSDecimalNumber *)decimalNumber;
|
- (NSDecimalNumber *)decimalNumberByDividingBy:(NSDecimalNumber *)decimalNumber
withBehavior:(id <NSDecimalNumberBehaviors>)behavior;
|
- (NSDecimalNumber *)decimalNumberByMultiplyingBy:(NSDecimalNumber *)decimalNumber;
|
- (NSDecimalNumber *)decimalNumberByMultiplyingBy:(NSDecimalNumber *)decimalNumber
withBehavior:(id <NSDecimalNumberBehaviors>)behavior;
|
- (NSDecimalNumber *)decimalNumberByMultiplyingByPowerOf10:(short)power;
|
- (NSDecimalNumber *)decimalNumberByMultiplyingByPowerOf10:(short)power
withBehavior:(id <NSDecimalNumberBehaviors>)behavior;
|
- (NSDecimalNumber *)decimalNumberByRaisingToPower:(unsigned)power;
|
- (NSDecimalNumber *)decimalNumberByRaisingToPower:(unsigned)power
|
withBehavior:(id <NSDecimalNumberBehaviors>)behavior;
|
- (NSDecimalNumber *)decimalNumberByRoundingAccordingToBehavior:
(id <NSDecimalNumberBehaviors>)behavior;
|
- (NSDecimalNumber *)decimalNumberBySubtracting:(NSDecimalNumber *)decimalNumber;
|
- (NSDecimalNumber *)decimalNumberBySubtracting:(NSDecimalNumber *)decimalNumber
withBehavior:(id <NSDecimalNumberBehaviors>)behavior;
|
- (NSDecimal)decimalValue;
|
- (NSString *)descriptionWithLocale:(NSDictionary *)locale;
|
- (double)doubleValue;
|
- (const char *)objCType;
|