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

DGDouble Class Reference

Inheritance diagram for DGDouble:

Styled List of all members.

Static Public Member Functions

static double parse (char[] src, uint *ate=null)
static int format (double i, inout Style style)
static char[] format (char[] dst, double x, uint decimals=6, bool scientific=false, uint mode=3)

Private Types

enum  Flags {
  Fill = 1, Left = Fill << 1, Prec = Left << 1, Hash = Prec << 1,
  Space = Hash << 1, Zero = Space << 1, Sign = Zero << 1, Comma = Sign << 1,
  Plus = Comma << 1, Array = Plus << 1
}

Static Private Member Functions

static void error (char[] msg)

Detailed Description

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

Note that this class requires the attendent file dtoa.c be compiled and linked to the application.

While these functions are all static, they are encapsulated within a class inheritance to preserve some namespace cohesion. One might use structs for encapsualtion instead, but then inheritance would be lost. Note that the root class, Styled, is abstract to prevent accidental instantiation of these classes.

Definition at line 82 of file DGDouble.d.


Member Enumeration Documentation

enum Flags [inherited]
 

Declare stylistic flags

Enumeration values:
Fill 
Left 
Prec 
Hash 
Space 
Zero 
Sign 
Comma 
Plus 
Array 

Definition at line 76 of file Styled.d.


Member Function Documentation

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

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

Definition at line 91 of file DGDouble.d.

References x.

static int format double  i,
inout Style  style
[inline, static]
 

Convert float to string based upon Style bits.

Definition at line 108 of file DGDouble.d.

References format().

Referenced by format().

static char [] format char[]  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 149 of file DGDouble.d.

References assert().

static void error char[]  msg  )  [inline, static, inherited]
 

Throw an exception with the provided messsage

Definition at line 338 of file Styled.d.

Referenced by Number::format(), Format::print(), and Format::Sprintf::utf8().


The documentation for this class was generated from the following file:
Generated on Mon Nov 14 10:59:51 2005 for Mango by  doxygen 1.4.0