Inheritance diagram for Double:
Public Types | |
typedef double | tValue |
Private Types | |
enum | NFormat { Binary = 'b', Octal = 'o', Hex = 'x', HexUpper = 'X', Decimal = 'd', Unsigned = 'u' } |
Static Private Member Functions | |
static tValue | pow10 (uint exp) |
static tValue | parse (char[] src, uint *ate=null) |
static int | format (double i, inout Style style) |
static char[] | format (char[] dst, tValue x, uint decimals=6, bool scientific=false) |
static char[] | format (char[] dst, long i, NFormat fmt=NFormat.Decimal, Flags flags=0) |
static package uint | trim (char[] digits, inout bool sign, uint *radix=null) |
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 67 of file Double.d.
|
|
|
|
|
Internal function to convert an exponent specifier to a floating point value. Definition at line 78 of file Double.d. References assert(). Referenced by parse(). |
|
Convert a formatted string of digits to a floating- point number. Good for general use, but use David Gay's dtoa package if serious rounding adjustments should be applied. Definition at line 115 of file Double.d. References memicmp(), pow10(), and Number::trim(). |
|
Convert float to string based upon Style bits. Definition at line 192 of file Double.d. References format(). Referenced by format(). |
|
Convert a float to a string. This produces pretty good results for the most part, though one should use David Gay's dtoa package for best accuracy. Note that the approach first normalizes a base10 mantissa, then pulls digits from the left side whilst emitting them (rightward) to the output. Definition at line 212 of file Double.d. References assert(). |
|
Format numeric values into the provided output buffer. The traditional printf() conversion specifiers are adhered to, and the following types are supported: u - unsigned decimal d - signed decimal o - octal x - lowercase hexadecimal X - uppercase hexadecimal b - binary Modifiers supported include: # : prefix the conversion with a type identifier + : prefix positive decimals with a '+' space : prefix positive decimals with one space 0 : left-pad the number with zeros These modifiers are specifed via the 'flags' provided, and are represented via these identifiers: # : Flags.Hash + : Flags.Plus space : Flags.Space 0 : Flags.Zero Definition at line 90 of file Number.d. References Styled::error(). |
|
Strip leading whitespace, extract an optional numeric sign, and optionally strip and return a possible radix prefix. This can be used as a precursor to the conversion of digits into a number. Returns the number of matching characters. Definition at line 197 of file Number.d. Referenced by Long::parse(), Int::parse(), and parse(). |