API 0.9.5
CPDecimalNumber Class Reference

Decimal floating point number. More...

#import <CPDecimalNumber.h>

Inheritance diagram for CPDecimalNumber:

List of all members.

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

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

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 300 of file CPDecimalNumber.j.

- (BOOL) boolValue

Returns a JS bool representation.

Returns:
a JS bool

Reimplemented from CPNumber.

Definition at line 815 of file CPDecimalNumber.j.

- (char) charValue

Returns a JS int representation. Truncation may occur.

Returns:
a JS int

Reimplemented from CPNumber.

Definition at line 824 of file CPDecimalNumber.j.

- (CPComparisonResult) compare: (CPNumber aNumber

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 744 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberByAdding: (CPDecimalNumber decimalNumber

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 511 of file CPDecimalNumber.j.

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

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 524 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberByDividingBy: (CPDecimalNumber decimalNumber

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 582 of file CPDecimalNumber.j.

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

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 596 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberByMultiplyingBy: (CPDecimalNumber decimalNumber

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 618 of file CPDecimalNumber.j.

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

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 632 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberByMultiplyingByPowerOf10: (short)  power

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 654 of file CPDecimalNumber.j.

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

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 668 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberByRaisingToPower: (unsigned)  power

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 690 of file CPDecimalNumber.j.

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

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 704 of file CPDecimalNumber.j.

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

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 728 of file CPDecimalNumber.j.

- (CPDecimalNumber) decimalNumberBySubtracting: (CPDecimalNumber decimalNumber

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 546 of file CPDecimalNumber.j.

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

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 560 of file CPDecimalNumber.j.

+ (CPDecimalNumber) decimalNumberWithDecimal: (CPDecimal)  dcm

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 391 of file CPDecimalNumber.j.

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

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 404 of file CPDecimalNumber.j.

+ (CPDecimalNumber) decimalNumberWithString: (CPString numberValue

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 416 of file CPDecimalNumber.j.

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

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 430 of file CPDecimalNumber.j.

- (CPDecimal) decimalValue

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 795 of file CPDecimalNumber.j.

+ (id) defaultBehavior

Return the default CPDecimalNumberHandler object.

Returns:
the default CPDecimalNumberHandler object

Definition at line 439 of file CPDecimalNumber.j.

- (CPString) description

Returns a string representation of the decimal number.

Returns:
a CPString

Reimplemented from CPNumber.

Definition at line 765 of file CPDecimalNumber.j.

- (CPString) descriptionWithLocale: (CPDictionary locale

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 776 of file CPDecimalNumber.j.

- (double) doubleValue

Returns a JS float representation. Truncation may occur.

Returns:
a JS float

Reimplemented from CPNumber.

Definition at line 805 of file CPDecimalNumber.j.

- (void) encodeWithCoder: (CPCoder aCoder

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

Parameters:
aCodera CPCoder instance

Reimplemented from CPNumber.

Definition at line 1236 of file CPDecimalNumber.j.

- (float) floatValue

Returns a JS float representation. Truncation may occur.

Returns:
a JS float

Reimplemented from CPNumber.

Definition at line 834 of file CPDecimalNumber.j.

- (id) init

Initialise a CPDecimalNumber object with NaN

Returns:
the reference to the receiver CPDecimalNumber

Definition at line 311 of file CPDecimalNumber.j.

- (id) initWithBool: (BOOL)  value

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 1067 of file CPDecimalNumber.j.

- (id) initWithChar: (char)  value

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 1079 of file CPDecimalNumber.j.

- (id) initWithCoder: (CPCoder aCoder

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

Parameters:
aCodera CPCoder instance

Reimplemented from CPNumber.

Definition at line 1216 of file CPDecimalNumber.j.

- (id) initWithDecimal: (CPDecimal)  dcm

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 321 of file CPDecimalNumber.j.

- (id) initWithDouble: (double)  value

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 1089 of file CPDecimalNumber.j.

- (id) initWithFloat: (float)  value

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 1099 of file CPDecimalNumber.j.

- (id) initWithInt: (int)  value

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 1109 of file CPDecimalNumber.j.

- (id) initWithLong: (long)  value

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 1119 of file CPDecimalNumber.j.

- (id) initWithLongLong: (long long)  value

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 1129 of file CPDecimalNumber.j.

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

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 341 of file CPDecimalNumber.j.

- (id) initWithShort: (short)  value

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 1139 of file CPDecimalNumber.j.

- (id) initWithString: (CPString numberValue

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 361 of file CPDecimalNumber.j.

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

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 375 of file CPDecimalNumber.j.

- (id) initWithUnsignedChar: (unsigned char)  value

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 1149 of file CPDecimalNumber.j.

- (id) initWithUnsignedInt: (unsigned)  value

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 1159 of file CPDecimalNumber.j.

- (id) initWithUnsignedLong: (unsigned long)  value

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 1169 of file CPDecimalNumber.j.

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

Initialise the receiver with an int value.

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

Definition at line 1179 of file CPDecimalNumber.j.

- (id) initWithUnsignedShort: (unsigned short)  value

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 1189 of file CPDecimalNumber.j.

- (int) intValue

Returns a JS int representation. Truncation may occur.

Returns:
a JS int

Reimplemented from CPNumber.

Definition at line 844 of file CPDecimalNumber.j.

- (BOOL) isEqualToNumber: (CPNumber aNumber

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 927 of file CPDecimalNumber.j.

- (long long) longLongValue

Returns a JS int representation. Truncation may occur.

Returns:
a JS int

Reimplemented from CPNumber.

Definition at line 854 of file CPDecimalNumber.j.

- (long) longValue

Returns a JS int representation. Truncation may occur.

Returns:
a JS int

Reimplemented from CPNumber.

Definition at line 864 of file CPDecimalNumber.j.

+ (CPDecimalNumber) maximumDecimalNumber

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 460 of file CPDecimalNumber.j.

+ (CPDecimalNumber) minimumDecimalNumber

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 471 of file CPDecimalNumber.j.

+ (CPDecimalNumber) notANumber

Returns a new CPDecimalNumber initialised to NaN.

Returns:
a new CPDecimalNumber object

Definition at line 480 of file CPDecimalNumber.j.

+ (id) numberWithBool: (BOOL)  aBoolean

Create a new CPDecimalNumber initialised with aBoolean.

Parameters:
aBooleana JS boolean value
Returns:
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 937 of file CPDecimalNumber.j.

+ (id) numberWithChar: (char)  aChar

Create a new CPDecimalNumber initialised with aChar.

Parameters:
aChara JS int value
Returns:
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 947 of file CPDecimalNumber.j.

+ (id) numberWithDouble: (double)  aDouble

Create a new CPDecimalNumber initialised with aDouble.

Parameters:
aDoublea JS float value
Returns:
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 957 of file CPDecimalNumber.j.

+ (id) numberWithFloat: (float)  aFloat

Create a new CPDecimalNumber initialised with aFloat.

Parameters:
aFloata JS float value
Returns:
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 967 of file CPDecimalNumber.j.

+ (id) numberWithInt: (int)  anInt

Create a new CPDecimalNumber initialised with anInt.

Parameters:
anInta JS int value
Returns:
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 977 of file CPDecimalNumber.j.

+ (id) numberWithLong: (long)  aLong

Create a new CPDecimalNumber initialised with aLong.

Parameters:
aLonga JS int value
Returns:
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 987 of file CPDecimalNumber.j.

+ (id) numberWithLongLong: (long long)  aLongLong

Create a new CPDecimalNumber initialised with aLongLong.

Parameters:
aLongLonga JS int value
Returns:
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 997 of file CPDecimalNumber.j.

+ (id) numberWithShort: (short)  aShort

Create a new CPDecimalNumber initialised with aShort.

Parameters:
aShorta JS int value
Returns:
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 1007 of file CPDecimalNumber.j.

+ (id) numberWithUnsignedChar: (unsigned char)  aChar

Create a new CPDecimalNumber initialised with aChar.

Parameters:
aChara JS int value
Returns:
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 1017 of file CPDecimalNumber.j.

+ (id) numberWithUnsignedInt: (unsigned)  anUnsignedInt

Create a new CPDecimalNumber initialised with anUnsignedInt.

Parameters:
anUnsignedInta JS int value
Returns:
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 1027 of file CPDecimalNumber.j.

+ (id) numberWithUnsignedLong: (unsigned long)  anUnsignedLong

Create a new CPDecimalNumber initialised with aChar.

Parameters:
aChara JS int value
Returns:
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 1037 of file CPDecimalNumber.j.

+ (id) numberWithUnsignedLongLong: (unsigned long)  anUnsignedLongLong

Create a new CPDecimalNumber initialised with anUnsignedLongLong.

Parameters:
anUnsignedLongLonga JS int value
Returns:
a new CPDecimalNumber object

Definition at line 1047 of file CPDecimalNumber.j.

+ (id) numberWithUnsignedShort: (unsigned short)  anUnsignedShort

Create a new CPDecimalNumber initialised with anUnsignedShort.

Parameters:
anUnsignedShorta JS int value
Returns:
a new CPDecimalNumber object

Reimplemented from CPNumber.

Definition at line 1057 of file CPDecimalNumber.j.

- (CPString) objCType

The objective C type string. For compatibility reasons

Returns:
returns a CPString containing "d"

Definition at line 756 of file CPDecimalNumber.j.

+ (CPDecimalNumber) one

Returns a new CPDecimalNumber initialised to one (1.0).

Returns:
a new CPDecimalNumber object

Definition at line 498 of file CPDecimalNumber.j.

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

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 449 of file CPDecimalNumber.j.

- (short) shortValue

Returns a JS int representation. Truncation may occur.

Returns:
a JS int

Reimplemented from CPNumber.

Definition at line 874 of file CPDecimalNumber.j.

- (CPString) stringValue

Returns a string representation of the decimal number.

Returns:
a CPString

Reimplemented from CPNumber.

Definition at line 785 of file CPDecimalNumber.j.

- (unsigned char) unsignedCharValue

Returns a JS int representation. Truncation may occur.

Returns:
a JS int

Reimplemented from CPNumber.

Definition at line 884 of file CPDecimalNumber.j.

- (unsigned int) unsignedIntValue

Returns a JS int representation. Truncation may occur.

Returns:
a JS int

Reimplemented from CPNumber.

Definition at line 894 of file CPDecimalNumber.j.

- (unsigned long) unsignedLongValue

Returns a JS int representation. Truncation may occur.

Returns:
a JS int

Reimplemented from CPNumber.

Definition at line 904 of file CPDecimalNumber.j.

- (unsigned short) unsignedShortValue

Returns a JS int representation. Truncation may occur.

Returns:
a JS int

Reimplemented from CPNumber.

Definition at line 914 of file CPDecimalNumber.j.

+ (CPDecimalNumber) zero

Returns a new CPDecimalNumber initialised to zero (0.0).

Returns:
a new CPDecimalNumber object

Definition at line 489 of file CPDecimalNumber.j.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Defines