dconv 2.0
C++14 library for printing and parsing floating point numbers
Loading...
Searching...
No Matches
dconv::grisu Namespace Reference

Namespaces

namespace  details
 

Functions

const DiyFp & cachedPower (int exponent, int &k) noexcept
 get the cached power of ten that scales a binary exponent into the digit generation range.
 
void generate (char *buffer, int &length, int &k, double value) noexcept
 write the decimal digits of the scaled value.
 
char * dtoa (char *buffer, double value) noexcept
 double to string conversion using Grisu.
 

Function Documentation

◆ cachedPower()

const DiyFp & dconv::grisu::cachedPower ( int exponent,
int & k )
inlinenoexcept

get the cached power of ten that scales a binary exponent into the digit generation range.

Parameters
exponentbinary exponent of the normalized value.
kdecimal exponent of the scaled value.
Returns
cached power of ten.

◆ dtoa()

char * dconv::grisu::dtoa ( char * buffer,
double value )
inlinenoexcept

double to string conversion using Grisu.

Parameters
bufferbuffer to write the string representation to (must point to at least 26 writable bytes).
valuevalue to convert.
Returns
end position.

◆ generate()

void dconv::grisu::generate ( char * buffer,
int & length,
int & k,
double value )
inlinenoexcept

write the decimal digits of the scaled value.

Parameters
bufferbuffer to write the digits to.
lengthnumber of digits written.
kdecimal exponent.
valuepositive value to convert.