|
dconv 2.0
C++14 library for printing and parsing floating point numbers
|
grisupowgen is a command-line tool that generates the lookup table of cached powers of 10 used by the Grisu algorithms.
Each power of 10 is stored as a normalized 64-bit mantissa rounded to nearest and a binary exponent, so that 10^k ≈ mantissa × 2^exponent.
The tool outputs a fully self-contained C++ header containing:
MIN_EXPONENT, MAX_EXPONENTCachedPower { uint64_t mantissa; int exponent; } structureconstexpr CachedPower powers[] lookup table| Option | Description |
|---|---|
-h | Show help message |
-l <lower> | Set lower exponent (default: -343) |
-u <upper> | Set upper exponent (default: 343) |
-v | Show program version |
Generate powers for exponents −200 through +200 and write them to cached_power.hpp:
The generated header will contain definitions like: