Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

DGDouble Class Reference

Inheritance diagram for DGDouble:

Number List of all members.

Static Public Member Functions

double parse (tChar[] src, uint *ate=null)
tChar[] format (tChar[] dst, double x, uint decimals=6, bool scientific=false, uint mode=3)

Private Types

enum  Radix { Binary = 2, Octal = 8, Decimal = 10, Hexadecimal = 16 }

Static Private Member Functions

 this ()
package uint trim (tChar[] digits, inout bool sign, Radix *radix=null)

Detailed Description

David Gay's extended conversions between string and floating-point numeric representations. Use these where you need extended accuracy when converting.

Note that this class requires the attendent dtoa.c file to be compiled into the Mango library.

Definition at line 73 of file DGDouble.d.


Member Enumeration Documentation

enum Radix [inherited]
 

Enumeration values:
Binary 
Octal 
Decimal 
Hexadecimal 

Definition at line 51 of file Number.d.


Member Function Documentation

double parse tChar[]  src,
uint *  ate = null
[inline, static]
 

Convert a formatted string of digits to a floating- point number.

Definition at line 82 of file DGDouble.d.

tChar [] format tChar[]  dst,
double  x,
uint  decimals = 6,
bool  scientific = false,
uint  mode = 3
[inline, static]
 

Convert a floating-point number to a string. Parameter 'mode' should be specified thusly:

0 ==> shortest string that yields d when read in and rounded to nearest.

1 ==> like 0, but with Steele & White stopping rule; e.g. with IEEE P754 arithmetic , mode 0 gives 1e23 whereas mode 1 gives 9.999999999999999e22.

2 ==> max(1,ndigits) significant digits. This gives a return value similar to that of ecvt, except that trailing zeros are suppressed.

3 ==> through ndigits past the decimal point. This gives a return value similar to that from fcvt, except that trailing zeros are suppressed, and ndigits can be negative.

4,5 ==> similar to 2 and 3, respectively, but (in round-nearest mode) with the tests of mode 0 to possibly return a shorter string that rounds to d. With IEEE arithmetic and compilation with -DHonor_FLT_ROUNDS, modes 4 and 5 behave the same as modes 2 and 3 when FLT_ROUNDS != 1.

6-9 ==> Debugging modes similar to mode - 4: don't try fast floating-point estimate (if applicable).

Definition at line 126 of file DGDouble.d.

References assert().

this  )  [inline, static, inherited]
 

Definition at line 61 of file Number.d.

References Number::error.

package uint trim tChar[]  digits,
inout bool  sign,
Radix radix = null
[inline, static, inherited]
 

Definition at line 70 of file Number.d.

References len.

Referenced by Long::parse(), Int::parse(), and Double::parse().


The documentation for this class was generated from the following file:
Generated on Sat Apr 9 20:11:36 2005 for Mango by doxygen 1.3.6