API  0.9.7
 All Classes Files Functions Variables Macros Groups Pages
CPDecimalNumber Class Reference

Decimal floating point number. More...

#import <CPDecimalNumber.h>

+ Inheritance diagram for CPDecimalNumber:

Instance Methods

(BOOL) - boolValue
 
(char) - charValue
 
(CPComparisonResult) - compare:
 
(CPDecimalNumber- decimalNumberByAdding:
 
(CPDecimalNumber- decimalNumberByAdding:withBehavior:
 
(CPDecimalNumber- decimalNumberByDividingBy:
 
(CPDecimalNumber- decimalNumberByDividingBy:withBehavior:
 
(CPDecimalNumber- decimalNumberByMultiplyingBy:
 
(CPDecimalNumber- decimalNumberByMultiplyingBy:withBehavior:
 
(CPDecimalNumber- decimalNumberByMultiplyingByPowerOf10:
 
(CPDecimalNumber- decimalNumberByMultiplyingByPowerOf10:withBehavior:
 
(CPDecimalNumber- decimalNumberByRaisingToPower:
 
(CPDecimalNumber- decimalNumberByRaisingToPower:withBehavior:
 
(CPDecimalNumber- decimalNumberByRoundingAccordingToBehavior:
 
(CPDecimalNumber- decimalNumberBySubtracting:
 
(CPDecimalNumber- decimalNumberBySubtracting:withBehavior:
 
(CPDecimal) - decimalValue
 
(CPString- description
 
(CPString- descriptionWithLocale:
 
(double) - doubleValue
 
(void) - encodeWithCoder:
 
(float) - floatValue
 
(id) - init
 
(id) - initWithBool:
 
(id) - initWithChar:
 
(id) - initWithCoder:
 
(id) - initWithDecimal:
 
(id) - initWithDouble:
 
(id) - initWithFloat:
 
(id) - initWithInt:
 
(id) - initWithLong:
 
(id) - initWithLongLong:
 
(id) - initWithMantissa:exponent:isNegative:
 
(id) - initWithShort:
 
(id) - initWithString:
 
(id) - initWithString:locale:
 
(id) - initWithUnsignedChar:
 
(id) - initWithUnsignedInt:
 
(id) - initWithUnsignedLong:
 
(id) - initWithUnsignedLongLong:
 
(id) - initWithUnsignedShort:
 
(int) - intValue
 
(BOOL) - isEqualToNumber:
 
(long long) - longLongValue
 
(long) - longValue
 
(CPString- objCType
 
(short) - shortValue
 
(CPString- stringValue
 
(unsigned char) - unsignedCharValue
 
(unsigned int) - unsignedIntValue
 
(unsigned long) - unsignedLongValue
 
(unsigned short) - unsignedShortValue
 
- Instance Methods inherited from CPNumber
(CPString- UID
 

Class Methods

(id) + alloc
 
(CPDecimalNumber+ decimalNumberWithDecimal:
 
(CPDecimalNumber+ decimalNumberWithMantissa:exponent:isNegative:
 
(CPDecimalNumber+ decimalNumberWithString:
 
(CPDecimalNumber+ decimalNumberWithString:locale:
 
(id) + defaultBehavior
 
(CPDecimalNumber+ maximumDecimalNumber
 
(CPDecimalNumber+ minimumDecimalNumber
 
(CPDecimalNumber+ notANumber
 
(id) + numberWithBool:
 
(id) + numberWithChar:
 
(id) + numberWithDouble:
 
(id) + numberWithFloat:
 
(id) + numberWithInt:
 
(id) + numberWithLong:
 
(id) + numberWithLongLong:
 
(id) + numberWithShort:
 
(id) + numberWithUnsignedChar:
 
(id) + numberWithUnsignedInt:
 
(id) + numberWithUnsignedLong:
 
(id) + numberWithUnsignedLongLong:
 
(id) + numberWithUnsignedShort:
 
(CPDecimalNumber+ one
 
(void) + setDefaultBehavior:
 
(CPDecimalNumber+ zero
 

Detailed Description

Decimal floating point number.

This class represents a decimal floating point number and the relevant mathematical operations to go with it. It guarantees accuracy up to 38 digits in the mantissa/coefficient and can handle numbers in the range: +/- 99999999999999999999999999999999999999 x 10^(127/-128) Methods are available for: Addition, Subtraction, Multiplication, Division, Powers and Rounding. Exceptions can be thrown on: Overflow, Underflow, Loss of Precision (rounding) and Divide by zero, the behaviour of which is controlled via the CPDecimalNumberHandler class.

Note: The aim here is to try to produce the exact same output as Cocoa. However, this is effectively not possible but to get as close as possible we must perform our calculations in a way such that we even get the same rounding errors building up, say when computing large powers which require many multiplications. The code here almost matches the results of Cocoa but there are some small differences as outlined below:

An example where a small rounding error difference creeps in: For the calculation (0.875 ^ 101) the result becomes: In Cocoa: 0.00000(13893554059925661274821814636807535200)1 the 38 digits are bracketed, the extra 39th digit in Cocoa is explained below. In Cappuccino: 0.00000(13893554059925661274821814636807535204) Difference: 4e-41

Since, in Cocoa, NSDecimalNumber uses a binary internal format for the mantissa (coefficient) the maximum it can store before truly losing precision is actually 2^128, which is a 39 digit number. After this rounding and exponent changes occur. In our implementation each digit is stored separately hence the mantissa maximum value is the maximum possible 38 digit number. Obviously Apple can only say precision is guaranteed to 38 digits cause at some point in the 39 digits numbers rounding starts. Hence there will be inherent differences between Cocoa and Cappuccino answers if rounding occurs (see above example). They both still provide the same 38 digit guarantee however.

So the actual range of NSDecimal is +/- 340282366920938463463374607431768211455 x 10^(127/-128) (Notice this is 39 digits) Compared to in Cappuccino: +/- 99999999999999999999999999999999999999 x 10^(127/-128)

Definition at line 2 of file CPDecimalNumber.h.

Method Documentation

+ (id) alloc
implementation

Create a new CPDecimalNumber object uninitialised. Note: even though CPDecimalNumber inherits from CPNumber it is not toll free bridged to a JS type as CPNumber is.

Returns
a new CPDecimalNumber instance

Reimplemented from CPNumber.

Definition at line 325 of file CPDecimalNumber.j.

- (BOOL) boolValue
implementation

Returns a JS bool representation.

Returns
a JS bool

Reimplemented from CPNumber.

Definition at line 851 of file CPDecimalNumber.j.

- (char) charValue
implementation

Returns a JS int representation. Truncation may occur.

Returns
a JS int

Reimplemented from CPNumber.

Definition at line 860 of file CPDecimalNumber.j.

- (CPComparisonResult) compare: (CPNumber aNumber
implementation

Compare the receiver CPDecimalNumber to aNumber. This is a CPNumber or subclass. Returns CPOrderedDescending, CPOrderedAscending or CPOrderedSame.

Parameters
aNumberan object of kind CPNumber to compare against.
Returns
result from CPComparisonResult enum.

Reimplemented from CPNumber.

Definition at line 779 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberByAdding: (CPDecimalNumber decimalNumber
implementation

Returns a new CPDecimalNumber object with the result of the summation of the receiver object and decimalNumber. If overflow occurs then the consequence depends on the current default CPDecimalNumberHandler.

Parameters
decimalNumberthe decimal number to add to the receiver
Returns
a new CPDecimalNumber object

Definition at line 536 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberByAdding: (CPDecimalNumber decimalNumber
withBehavior: (id <CPDecimalNumberBehaviors>)  behavior 
implementation

Returns a new CPDecimalNumber object with the result of the summation of the receiver object and decimalNumber. If overflow occurs then the consequence depends on the CPDecimalNumberHandler object behavior.

Parameters
decimalNumberthe decimal number to add to the receiver
behaviora CPDecimalNumberHandler object
Returns
a new CPDecimalNumber object

Definition at line 549 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberByDividingBy: (CPDecimalNumber decimalNumber
implementation

Returns a new CPDecimalNumber object with the result of dividing the receiver object by decimalNumber. If underflow, divide by zero or loss of precision occurs then the consequence depends on the current default CPDecimalNumberHandler object.

Parameters
decimalNumberthe decimal number to divide the the receiver by
Returns
a new CPDecimalNumber object

Definition at line 610 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberByDividingBy: (CPDecimalNumber decimalNumber
withBehavior: (id <CPDecimalNumberBehaviors>)  behavior 
implementation

Returns a new CPDecimalNumber object with the result of dividing the receiver object by decimalNumber. If underflow, divide by zero or loss of precision occurs then the consequence depends on the CPDecimalNumberHandler object behavior.

Parameters
decimalNumberthe decimal number to divide the the receiver by
behaviora CPDecimalNumberHandler object
Returns
a new CPDecimalNumber object

Definition at line 624 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberByMultiplyingBy: (CPDecimalNumber decimalNumber
implementation

Returns a new CPDecimalNumber object with the result of multiplying the receiver object by decimalNumber. If overflow or loss of precision occurs then the consequence depends on the current default CPDecimalNumberHandler object.

Parameters
decimalNumberthe decimal number to multiply the the receiver by
Returns
a new CPDecimalNumber object

Definition at line 647 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberByMultiplyingBy: (CPDecimalNumber decimalNumber
withBehavior: (id <CPDecimalNumberBehaviors>)  behavior 
implementation

Returns a new CPDecimalNumber object with the result of multiplying the receiver object by decimalNumber. If overflow or loss of precision occurs then the consequence depends on the CPDecimalNumberHandler object behavior.

Parameters
decimalNumberthe decimal number to multiply the the receiver by
behaviora CPDecimalNumberHandler object
Returns
a new CPDecimalNumber object

Definition at line 661 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberByMultiplyingByPowerOf10: (short)  power
implementation

Returns a new CPDecimalNumber object with the result of multiplying the receiver object by (10 ^ power). If overflow, underflow or loss of precision occurs then the consequence depends on the current default CPDecimalNumberHandler object.

Parameters
powerthe power of 10 to multiply the receiver by
Returns
a new CPDecimalNumber object

Definition at line 685 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberByMultiplyingByPowerOf10: (short)  power
withBehavior: (id <CPDecimalNumberBehaviors>)  behavior 
implementation

Returns a new CPDecimalNumber object with the result of multiplying the receiver object by (10 ^ power). If overflow, underflow or loss of precision occurs then the consequence depends on the CPDecimalNumberHandler object behavior.

Parameters
powerthe power of 10 to multiply the receiver by
behaviora CPDecimalNumberHandler object
Returns
a new CPDecimalNumber object

Definition at line 699 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberByRaisingToPower: (unsigned)  power
implementation

Returns a new CPDecimalNumber object with the result of raising the receiver object to the power power. If overflow, underflow or loss of precision occurs then the consequence depends on the current default CPDecimalNumberHandler object.

Parameters
powerthe power to raise the receiver by
Returns
a new CPDecimalNumber object

Definition at line 723 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberByRaisingToPower: (unsigned)  power
withBehavior: (id <CPDecimalNumberBehaviors>)  behavior 
implementation

Returns a new CPDecimalNumber object with the result of raising the receiver object to the power power. If overflow, underflow or loss of precision occurs then the consequence depends on the CPDecimalNumberHandler object behavior.

Parameters
powerthe power to raise the receiver by
behaviora CPDecimalNumberHandler object
Returns
a new CPDecimalNumber object

Definition at line 737 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberByRoundingAccordingToBehavior: (id <CPDecimalNumberBehaviors>)  behavior
implementation

Returns a new CPDecimalNumber object with the result of rounding the number according to the rounding behavior specified by the CPDecimalNumberHandler object behavior.

Parameters
behaviora CPDecimalNumberHandler object
Returns
a new rounded CPDecimalNumber object

Definition at line 763 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberBySubtracting: (CPDecimalNumber decimalNumber
implementation

Returns a new CPDecimalNumber object with the result of the subtraction of decimalNumber from the receiver object. If underflow or loss of precision occurs then the consequence depends on the current default CPDecimalNumberHandler.

Parameters
decimalNumberthe decimal number to subtract from the receiver
Returns
a new CPDecimalNumber object

Definition at line 572 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberBySubtracting: (CPDecimalNumber decimalNumber
withBehavior: (id <CPDecimalNumberBehaviors>)  behavior 
implementation

Returns a new CPDecimalNumber object with the result of the subtraction of decimalNumber from the receiver object. If underflow or loss of precision occurs then the consequence depends on the CPDecimalNumberHandler object behavior.

Parameters
decimalNumberthe decimal number to subtract from the receiver
behaviora CPDecimalNumberHandler object
Returns
a new CPDecimalNumber object

Definition at line 586 of file CPDecimalNumber.j.

+ (CPDecimalNumber) decimalNumberWithDecimal: (CPDecimal)  dcm
implementation

Return a new CPDecimalNumber object with the contents of a CPDecimal object

Parameters
dcmthe CPDecimal object to copy
Returns
the new CPDecimalNumber object

Definition at line 416 of file CPDecimalNumber.j.

+ (CPDecimalNumber) decimalNumberWithMantissa: (unsigned long long)  mantissa
exponent: (short)  exponent
isNegative: (BOOL)  flag 
implementation

Creates a new CPDecimalNumber object with the given mantissa and exponent. See -initWithMantissa:exponent:isNegative: for some extra notes.

Parameters
mantissathe mantissa of the decimal number
exponentthe exponent of the number
flagtrue if number is negative
Returns
the new CPDecimalNumber object

Definition at line 429 of file CPDecimalNumber.j.

+ (CPDecimalNumber) decimalNumberWithString: (CPString numberValue
implementation

Creates a new CPDecimalNumber with a string. If the string is badly formed or outside of the acceptable range of a CPDecimal then the number is initialised to NaN.

Parameters
numberValuethe string to parse.
Returns
the new CPDecimalNumber object

Definition at line 441 of file CPDecimalNumber.j.

+ (CPDecimalNumber) decimalNumberWithString: (CPString numberValue
locale: (CPDictionary locale 
implementation

Creates a new CPDecimalNumber with a string using the given locale. If the string is badly formed or outside of the acceptable range of a CPDecimal then the number is initialised to NaN. NOTE: Locales are currently not supported.

Parameters
numberValuethe string to parse
localethe CPLocale object to use when parsing the number string
Returns
the new CPDecimalNumber object

Definition at line 455 of file CPDecimalNumber.j.

- (CPDecimal) decimalValue
implementation

Returns a new CPDecimal object (which effectively contains the internal decimal number representation).

Returns
a new CPDecimal number copy

Reimplemented from CPNumber.

Definition at line 831 of file CPDecimalNumber.j.

+ (id) defaultBehavior
implementation

Return the default CPDecimalNumberHandler object.

Returns
the default CPDecimalNumberHandler object

Definition at line 464 of file CPDecimalNumber.j.

- (CPString) description
implementation

Returns a string representation of the decimal number.

Returns
a CPString

Reimplemented from CPNumber.

Definition at line 801 of file CPDecimalNumber.j.

- (CPString) descriptionWithLocale: (CPDictionary locale
implementation

Returns a string representation of the decimal number given the specified locale. Note: locales are currently unsupported

Parameters
localethe locale
Returns
a CPString

Reimplemented from CPNumber.

Definition at line 812 of file CPDecimalNumber.j.

- (double) doubleValue
implementation

Returns a JS float representation. Truncation may occur.

Returns
a JS float

Reimplemented from CPNumber.

Definition at line 841 of file CPDecimalNumber.j.

- (void) encodeWithCoder: (CPCoder aCoder
implementation

Called by CPCoder's encodeObject: to archive the object instance.

Parameters
aCodera CPCoder instance

Reimplemented from CPNumber.

Provided by category CPDecimalNumber(CPCoding).

Definition at line 1272 of file CPDecimalNumber.j.

- (float) floatValue
implementation

Returns a JS float representation. Truncation may occur.

Returns
a JS float

Reimplemented from CPNumber.

Definition at line 870 of file CPDecimalNumber.j.

- (id) init
implementation

Initialise a CPDecimalNumber object with NaN

Returns
the reference to the receiver CPDecimalNumber

Definition at line 336 of file CPDecimalNumber.j.

- (id) initWithBool: (BOOL)  value
implementation

Initialise the receiver with a boolean value.

Parameters
valuea JS boolean value
Returns
a reference to the initialised object

Reimplemented from CPNumber.

Definition at line 1103 of file CPDecimalNumber.j.

- (id) initWithChar: (char)  value
implementation

Initialise the receiver with an int value.

Parameters
valuea JS int value
Returns
a reference to the initialised object

Reimplemented from CPNumber.

Definition at line 1115 of file CPDecimalNumber.j.

- (id) initWithCoder: (CPCoder aCoder
implementation

Called by CPCoder's decodeObject: to initialise the object with an archived one.

Parameters
aCodera CPCoder instance

Reimplemented from CPNumber.

Provided by category CPDecimalNumber(CPCoding).

Definition at line 1252 of file CPDecimalNumber.j.

- (id) initWithDecimal: (CPDecimal)  dcm
implementation

Initialise a CPDecimalNumber object with the contents of a CPDecimal object

Parameters
dcmthe CPDecimal object to copy
Returns
the reference to the receiver CPDecimalNumber

Definition at line 346 of file CPDecimalNumber.j.

- (id) initWithDouble: (double)  value
implementation

Initialise the receiver with a float value.

Parameters
valuea JS float value
Returns
a reference to the initialised object

Reimplemented from CPNumber.

Definition at line 1125 of file CPDecimalNumber.j.

- (id) initWithFloat: (float)  value
implementation

Initialise the receiver with a float value.

Parameters
valuea JS float value
Returns
a reference to the initialised object

Reimplemented from CPNumber.

Definition at line 1135 of file CPDecimalNumber.j.

- (id) initWithInt: (int)  value
implementation

Initialise the receiver with an int value.

Parameters
valuea JS int value
Returns
a reference to the initialised object

Reimplemented from CPNumber.

Definition at line 1145 of file CPDecimalNumber.j.

- (id) initWithLong: (long)  value
implementation

Initialise the receiver with an int value.

Parameters
valuea JS int value
Returns
a reference to the initialised object

Reimplemented from CPNumber.

Definition at line 1155 of file CPDecimalNumber.j.

- (id) initWithLongLong: (long long)  value
implementation

Initialise the receiver with an int value.

Parameters
valuea JS int value
Returns
a reference to the initialised object

Reimplemented from CPNumber.

Definition at line 1165 of file CPDecimalNumber.j.

- (id) initWithMantissa: (unsigned long long)  mantissa
exponent: (short)  exponent
isNegative: (BOOL)  flag 
implementation

Initialise a CPDecimalNumber object with the given mantissa and exponent. Note: that since 'long long' doesn't exist in JS the mantissa is smaller than possible in Cocoa and can thus not create the full number range possible for a CPDecimal. Also note that at extreme cases where overflow or truncation will occur to the parameters in Cocoa this method produces different results to its Cocoa counterpart.

Parameters
mantissathe mantissa of the decimal number
exponentthe exponent of the number
flagtrue if number is negative
Returns
the reference to the receiver CPDecimalNumber

Definition at line 366 of file CPDecimalNumber.j.

- (id) initWithShort: (short)  value
implementation

Initialise the receiver with an int value.

Parameters
valuea JS int value
Returns
a reference to the initialised object

Reimplemented from CPNumber.

Definition at line 1175 of file CPDecimalNumber.j.

- (id) initWithString: (CPString numberValue
implementation

Initialise a CPDecimalNumber with a string. If the string is badly formed or outside of the acceptable range of a CPDecimal then the number is initialised to NaN.

Parameters
numberValuethe string to parse.
Returns
the reference to the receiver CPDecimalNumber

Definition at line 386 of file CPDecimalNumber.j.

- (id) initWithString: (CPString numberValue
locale: (CPDictionary locale 
implementation

Initialise a CPDecimalNumber with a string using the given locale. If the string is badly formed or outside of the acceptable range of a CPDecimal then the number is initialised to NaN. NOTE: Locales are currently not supported.

Parameters
numberValuethe string to parse
localethe CPLocale object to use when parsing the number string
Returns
the reference to the receiver CPDecimalNumber

Definition at line 400 of file CPDecimalNumber.j.

- (id) initWithUnsignedChar: (unsigned char)  value
implementation

Initialise the receiver with an int value.

Parameters
valuea JS int value
Returns
a reference to the initialised object

Reimplemented from CPNumber.

Definition at line 1185 of file CPDecimalNumber.j.

- (id) initWithUnsignedInt: (unsigned)  value
implementation

Initialise the receiver with an int value.

Parameters
valuea JS int value
Returns
a reference to the initialised object

Reimplemented from CPNumber.

Definition at line 1195 of file CPDecimalNumber.j.

- (id) initWithUnsignedLong: (unsigned long)  value
implementation

Initialise the receiver with an int value.

Parameters
valuea JS int value
Returns
a reference to the initialised object

Reimplemented from CPNumber.

Definition at line 1205 of file CPDecimalNumber.j.

- (id) initWithUnsignedLongLong: (unsigned long long)  value
implementation

Initialise the receiver with an int value.

Parameters
valuea JS int value
Returns
a reference to the initialised object

Definition at line 1215 of file CPDecimalNumber.j.

- (id) initWithUnsignedShort: (unsigned short)  value
implementation

Initialise the receiver with an int value.

Parameters
valuea JS int value
Returns
a reference to the initialised object

Reimplemented from CPNumber.

Definition at line 1225 of file CPDecimalNumber.j.

- (int) intValue
implementation

Returns a JS int representation. Truncation may occur.

Returns
a JS int

Reimplemented from CPNumber.

Definition at line 880 of file CPDecimalNumber.j.

- (BOOL) isEqualToNumber: (CPNumber aNumber
implementation

Compare the receiver CPDecimalNumber to aNumber and return YES if equal.

Parameters
aNumberan object of kind CPNumber to compare against.
Returns
a boolean

Reimplemented from CPNumber.

Definition at line 963 of file CPDecimalNumber.j.

- (long long) longLongValue
implementation

Returns a JS int representation. Truncation may occur.

Returns
a JS int

Reimplemented from CPNumber.

Definition at line 890 of file CPDecimalNumber.j.

- (long) longValue
implementation

Returns a JS int representation. Truncation may occur.

Returns
a JS int

Reimplemented from CPNumber.

Definition at line 900 of file CPDecimalNumber.j.

+ (CPDecimalNumber) maximumDecimalNumber
implementation

Returns a new CPDecimalNumber with the maximum permissible decimal number value. Note: this is different to the number Cocoa returns. See CPDecimalNumber class description for details.

Returns
a new CPDecimalNumber object

Definition at line 485 of file CPDecimalNumber.j.

+ (CPDecimalNumber) minimumDecimalNumber
implementation

Returns a new CPDecimalNumber with the minimum permissible decimal number value. Note: this is different to the number Cocoa returns. See CPDecimalNumber class description for details.

Returns
a new CPDecimalNumber object

Definition at line 496 of file CPDecimalNumber.j.

+ (CPDecimalNumber) notANumber
implementation

Returns a new CPDecimalNumber initialised to NaN.

Returns
a new CPDecimalNumber object

Definition at line 505 of file CPDecimalNumber.j.

+ (id) numberWithBool: (BOOL)  aBoolean
implementation

Create a new CPDecimalNumber initialised with aBoolean.

Parameters
aBooleana JS boolean value
Returns
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 973 of file CPDecimalNumber.j.

+ (id) numberWithChar: (char)  aChar
implementation

Create a new CPDecimalNumber initialised with aChar.

Parameters
aChara JS int value
Returns
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 983 of file CPDecimalNumber.j.

+ (id) numberWithDouble: (double)  aDouble
implementation

Create a new CPDecimalNumber initialised with aDouble.

Parameters
aDoublea JS float value
Returns
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 993 of file CPDecimalNumber.j.

+ (id) numberWithFloat: (float)  aFloat
implementation

Create a new CPDecimalNumber initialised with aFloat.

Parameters
aFloata JS float value
Returns
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 1003 of file CPDecimalNumber.j.

+ (id) numberWithInt: (int)  anInt
implementation

Create a new CPDecimalNumber initialised with anInt.

Parameters
anInta JS int value
Returns
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 1013 of file CPDecimalNumber.j.

+ (id) numberWithLong: (long)  aLong
implementation

Create a new CPDecimalNumber initialised with aLong.

Parameters
aLonga JS int value
Returns
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 1023 of file CPDecimalNumber.j.

+ (id) numberWithLongLong: (long long)  aLongLong
implementation

Create a new CPDecimalNumber initialised with aLongLong.

Parameters
aLongLonga JS int value
Returns
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 1033 of file CPDecimalNumber.j.

+ (id) numberWithShort: (short)  aShort
implementation

Create a new CPDecimalNumber initialised with aShort.

Parameters
aShorta JS int value
Returns
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 1043 of file CPDecimalNumber.j.

+ (id) numberWithUnsignedChar: (unsigned char)  aChar
implementation

Create a new CPDecimalNumber initialised with aChar.

Parameters
aChara JS int value
Returns
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 1053 of file CPDecimalNumber.j.

+ (id) numberWithUnsignedInt: (unsigned)  anUnsignedInt
implementation

Create a new CPDecimalNumber initialised with anUnsignedInt.

Parameters
anUnsignedInta JS int value
Returns
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 1063 of file CPDecimalNumber.j.

+ (id) numberWithUnsignedLong: (unsigned long)  anUnsignedLong
implementation

Create a new CPDecimalNumber initialised with aChar.

Parameters
aChara JS int value
Returns
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 1073 of file CPDecimalNumber.j.

+ (id) numberWithUnsignedLongLong: (unsigned long)  anUnsignedLongLong
implementation

Create a new CPDecimalNumber initialised with anUnsignedLongLong.

Parameters
anUnsignedLongLonga JS int value
Returns
a new CPDecimalNumber object

Definition at line 1083 of file CPDecimalNumber.j.

+ (id) numberWithUnsignedShort: (unsigned short)  anUnsignedShort
implementation

Create a new CPDecimalNumber initialised with anUnsignedShort.

Parameters
anUnsignedShorta JS int value
Returns
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 1093 of file CPDecimalNumber.j.

- (CPString) objCType
implementation

The objective C type string. For compatibility reasons

Returns
returns a CPString containing "d"

Definition at line 792 of file CPDecimalNumber.j.

+ (CPDecimalNumber) one
implementation

Returns a new CPDecimalNumber initialised to one (1.0).

Returns
a new CPDecimalNumber object

Definition at line 523 of file CPDecimalNumber.j.

+ (void) setDefaultBehavior: (id <CPDecimalNumberBehaviors>)  behavior
implementation

Set the default CPDecimalNumberHandler object. This is a framework wide setting. All subsequent decimal number operations will use this behaviour.

Parameters
behaviorthe new default CPDecimalNumberHandler object

Definition at line 474 of file CPDecimalNumber.j.

- (short) shortValue
implementation

Returns a JS int representation. Truncation may occur.

Returns
a JS int

Reimplemented from CPNumber.

Definition at line 910 of file CPDecimalNumber.j.

- (CPString) stringValue
implementation

Returns a string representation of the decimal number.

Returns
a CPString

Reimplemented from CPNumber.

Definition at line 821 of file CPDecimalNumber.j.

- (unsigned char) unsignedCharValue
implementation

Returns a JS int representation. Truncation may occur.

Returns
a JS int

Reimplemented from CPNumber.

Definition at line 920 of file CPDecimalNumber.j.

- (unsigned int) unsignedIntValue
implementation

Returns a JS int representation. Truncation may occur.

Returns
a JS int

Reimplemented from CPNumber.

Definition at line 930 of file CPDecimalNumber.j.

- (unsigned long) unsignedLongValue
implementation

Returns a JS int representation. Truncation may occur.

Returns
a JS int

Reimplemented from CPNumber.

Definition at line 940 of file CPDecimalNumber.j.

- (unsigned short) unsignedShortValue
implementation

Returns a JS int representation. Truncation may occur.

Returns
a JS int

Reimplemented from CPNumber.

Definition at line 950 of file CPDecimalNumber.j.

+ (CPDecimalNumber) zero
implementation

Returns a new CPDecimalNumber initialised to zero (0.0).

Returns
a new CPDecimalNumber object

Definition at line 514 of file CPDecimalNumber.j.


The documentation for this class was generated from the following files: