Type Method

decimalNumberWithMantissa:exponent:isNegative:

Creates and returns a decimal number equivalent to the number specified by the arguments.

Declaration

+ (NSDecimalNumber *)decimalNumberWithMantissa:(unsigned long long)mantissa exponent:(short)exponent isNegative:(BOOL)flag;

Parameters

mantissa

The mantissa for the new decimal number object.

exponent

The exponent for the new decimal number object.

isNegative

A Boolean value that specifies whether the sign of the number is negative.

Discussion

The arguments express a number in a kind of scientific notation that requires the mantissa to be an integer. So, for example, if the number to be represented is –12.345, it is expressed as 12345x10^–3mantissa is 12345; exponent is –3; and isNegative is YES, as illustrated by the following example.

NSDecimalNumber *number = [NSDecimalNumber decimalNumberWithMantissa:12345
                                           exponent:-3
                                           isNegative:YES];

See Also

Creating a Decimal Number

+ decimalNumberWithDecimal:

Creates and returns a decimal number equivalent to a given decimal structure.

+ decimalNumberWithString:

Creates a decimal number whose value is equivalent to that in a given numeric string.

+ decimalNumberWithString:locale:

Creates a decimal number whose value is equivalent to that in a given numeric string, interpreted using a given locale.

one

A decimal number equivalent to the number 1.0.

zero

A decimal number equivalent to the number 0.0.

notANumber

A decimal number that specifies no number.