- Inherits from:
- Object
- Conforms to:
- DComparable, DParsable, DSimpleArithmetic, DTextable
- Declared in:
- DBigDouble.h
Object
|
+---DBigDouble
Class Description
The big double class implements a number of methods for working with arbitrary large double
numbers. The class uses the excellent gmp library for the actual calculations. Note: setting
the precision (as is done by move: and point:) will result in a realloc)
- Last modified:
- 23-Jul-2006 (DBigDouble.h)
Instance Variables
- private void *_value
- the big double value
- Constructors
- - (DBigDouble *) init
- Initialise to double zero with default precision
- Returns:
- the object
- - (DBigDouble *) init :(unsigned long) point
- Initialise to double zero with a precision
- Parameters:
- point - the number of bits in the precision
- Returns:
- the object
- - (DBigDouble *) init :(double) value :(unsigned long) point
- Initialise to a double with a precision
- Parameters:
- value - the double value
point - the number of bits in the precision
- Returns:
- the object
- - (DBigDouble *) init :(const char *) cstring :(int) base :(unsigned long) point
- Initialise with a string
- Parameters:
- cstring - the cstring with the double
base - the base for the double
point - the number of bits in the precision
- Returns:
- the object
- Copy constructor
- - shallowCopy
- Do a shallow copy of the object
- Returns:
- the object
- Deconstructor
- - free
- Free a big double
- Returns:
- the object
- - (BOOL) isNegative
- Member methods
Check if the big double is negative
- Returns:
- is it?
- - (BOOL) isZero
- Check if the big double is zero
- Returns:
- is it ?
- - (unsigned long) point
- Get the current precision of the big double
- Returns:
- the number of bits for the precision
- - (DBigDouble *) point :(unsigned long) point
- Set the precision for the big double
- Parameters:
- point - the new value for the precision (in bits)
- Returns:
- the objectc
- Set methods
- - (DBigDouble *) clear
- Set the big double to zero
- Returns:
- the object
- - (DBigDouble *) move :(DBigDouble *) other
- Move an other object in this object (including the precision)
- Parameters:
- other - the other object
- Returns:
- this object
- - (DBigDouble *) set :(double) value
- Set the big double with a (small) double
- Parameters:
- value - the (small) double
- Returns:
- the object
- - (BOOL) set :(const char *) cstring :(int) base
- Set the big double with a text number (format: MeN)
- Parameters:
- cstring - the cstring with the double
base - the base of the double (2..36)
- Returns:
- success
- Get methods
- - (double) get
- Get the big double as (small) double
- Returns:
- the (small) double
- - (DText *) get :(int) base :(unsigned) digits
- Get the big double as a text string
- Parameters:
- base - the base for the text string (2..36)
digits - the number of digits in the string (0 = all)
- Returns:
- a (new) text string (or nil)
- Methods on big double numbers
- - (DBigDouble *) abs
- Absolute the big double
- Returns:
- the object
- - (DBigDouble *) add :(DBigDouble *) other
- Add with a big double
- Parameters:
- other - the big double
- Returns:
- the object
- - (DBigDouble *) add :(DBigDouble *) src1 :(DBigDouble *) src2
- Add two big doubles and store the result in the object
- Parameters:
- src1 - the first big double
src2 - the second big double
- Returns:
- the object
- - (DBigDouble *) ceil
- Ceil the big double
- Returns:
- the object
- - (DBigDouble *) div :(DBigDouble *) other
- Divide with a big double
- Parameters:
- other - the divider
- Returns:
- the object
- - (DBigDouble *) div :(DBigDouble *) src1 :(DBigDouble *) src2
- Divide two big doubles and store the result in the object
- Parameters:
- src1 - the number
src2 - the divider
- Returns:
- the object
- - (DBigDouble *) floor
- Floor the big double
- Returns:
- the object
- - (DBigDouble *) mul :(DBigDouble *) other
- Multiply with a big double
- Parameters:
- other - the big double
- Returns:
- the object
- - (DBigDouble *) mul :(DBigDouble *) src1 :(DBigDouble *) src2
- Multiply two big doubles and store the result in the object
- Parameters:
- src1 - the first big double
src2 - the second big double
- Returns:
- the object
- - (DBigDouble *) negate
- Negate the big double
- Returns:
- the object
- - (DBigDouble *) power :(unsigned long) factor
- Raise to the power of the big double
- Parameters:
- factor - the factor
- Returns:
- the object
- - (DBigDouble *) sqrt
- Do a square root on the big double
- Returns:
- the object
- - (DBigDouble *) sub :(DBigDouble *) other
- Subract with a big double
- Parameters:
- other - the big double
- Returns:
- the object
- - (DBigDouble *) sub :(DBigDouble *) src1 :(DBigDouble *) src2
- Subract two big doubles and store the result in the object
- Parameters:
- src1 - the first big double
src2 - the second big double
- Returns:
- the object
- - (DBigDouble *) trunc
- Truncate the big double
- Returns:
- the object
- DComparable protocol implementation
- - (int) compare :(DBigDouble *) other
- Compare with another big double
- Parameters:
- other - the other big double
- Returns:
- the compare result (-1,0,1)
- Textable protocol implementation
- - (DText *) toText
- Convert to a decimal text string
- Returns:
- a (new) text string with the big double (or nil)
- DParsable protocol implementation
- - (int) fromString :(char **) cstr
- Parse a string for a big double. Formats:
[space]*[+-][0..9]*{.[0..9]*}{[eE][+-][0..9]*}
- Parameters:
- cstr - the string to be parsed (moved to the first non-parsable char)
- Returns:
- the result (0,ERANGE,ENODATA)
generated 25-Jul-2006 by ObjcDoc 3.0.0