Instance Method

initWithMantissa:exponent:isNegative:

Initializes a decimal number using the given mantissa, exponent, and sign.

Declaration

- (instancetype)initWithMantissa:(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.

flag

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

Return Value

An NSDecimalNumber object initialized using the given mantissa, exponent, and sign.

Discussion

The arguments express a number in a type of scientific notation that requires the mantissa to be an integer. So, for example, if the number to be represented is 1.23, it is expressed as 123x10^–2—mantissa is 123; exponent is –2; and isNegative, which refers to the sign of the mantissa, is NO.

See Also

Initializing a Decimal Number

- initWithDecimal:

Initializes a decimal number to represent a given decimal.

- initWithString:

Initializes a decimal number so that its value is equivalent to that in a given numeric string.

- initWithString:locale:

Initializes a decimal number so that its value is equivalent to that in a given numeric string, interpreted using a given locale.