|
dconv 2.0
C++14 library for printing and parsing floating point numbers
|
Classes | |
| struct | Power |
| 128 bits power. More... | |
Functions | |
| constexpr bool | isDigit (char c) noexcept |
| constexpr bool | isSign (char c) noexcept |
| template<typename Probe > | |
| bool | readExponent (Probe &probe, int64_t &exponent) |
| read an optional exponent. | |
| template<typename Probe , bool Relaxed> | |
| DCONV_COLD bool | atodLong (Probe &probe, bool negative, uint64_t significand, int64_t &scale, bool fraction, double &value, int pending=-1) |
| continue a conversion whose significand has more than 19 digits. | |
| template<typename Probe , AtodMode Mode> | |
| Errc | atodRelaxed (Probe &probe, double &value, uint64_t &significand, int64_t &exponent, bool &negative) |
| string to double conversion in general format that stops on integers. | |
| template<typename Probe , AtodMode Mode> | |
| DCONV_COLD Errc | atodRewind (Probe &probe, double &value, uint64_t &significand, int64_t &exponent, bool &negative) |
| parse again a number the fast path does not handle. | |
| template<typename Probe , AtodMode Mode = AtodMode::General, bool Rewind = std::is_same_v<Probe, StringProbe>> | |
| Errc | atod (Probe &probe, double &value, uint64_t &significand, int64_t &exponent, bool &negative) |
| string to double conversion that stops on integers. | |
| template<typename Probe , AtodMode Mode = AtodMode::General> | |
| bool | atod (Probe &probe, double &value) |
| string to double conversion. | |
| int | countTrailingZeros (uint32_t group) noexcept |
| count the trailing zeros of a four digits group. | |
| int | countDigits (uint64_t digits) noexcept |
| count the digits of a decimal significand. | |
| int | writeDigits (char *buffer, uint64_t digits, int length) noexcept |
| write the digits of a decimal significand. | |
| char * | writeExponent (char *buffer, int k) noexcept |
| write a decimal exponent. | |
| char * | prettify (char *buffer, int length, int k) noexcept |
| lay out decimal digits as a fixed or scientific number. | |
| char * | format (char *buffer, uint64_t digits, int length, int k) noexcept |
| write a decimal significand with the same layout as prettify. | |
| void | umul128 (uint64_t a, uint64_t b, uint64_t &high, uint64_t &low) noexcept |
| multiply two 64 bits unsigned integers. | |
Variables | |
| constexpr uint32_t | pow10 [] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000} |
| powers of ten that fit in 32 bits. | |
| constexpr char | digitPairs [] |
| two digits decimal representations of 0 to 99. | |
| constexpr uint8_t | pairZeros [] |
| trailing zeros of the two digits decimal representations of 0 to 99. | |
| constexpr Power | eisellemirepow [] |
| constexpr DiyFp | grisupow [] |
| cached powers of ten for the grisu algorithms. | |
| constexpr Power | schubfachpow [] |
|
inline |
string to double conversion.
| probe | probe to read from. |
| value | converted value. |
|
inline |
string to double conversion that stops on integers.
| probe | probe to read from. |
| value | converted value. |
| significand | integer value when the error is NotDouble, first significant digits read otherwise. |
| exponent | decimal exponent read. |
| negative | sign read. |
| DCONV_COLD bool dconv::details::atodLong | ( | Probe & | probe, |
| bool | negative, | ||
| uint64_t | significand, | ||
| int64_t & | scale, | ||
| bool | fraction, | ||
| double & | value, | ||
| int | pending = -1 ) |
continue a conversion whose significand has more than 19 digits.
| probe | probe to read from, positioned on the first digit beyond the significand. |
| negative | sign of the number. |
| significand | first 19 significant digits. |
| scale | power of ten applied to the significand, updated with the final exponent. |
| fraction | true if the reading stopped in the fractional part. |
| value | converted value. |
| pending | integer digit already read beyond the significand, or -1. |
|
inline |
string to double conversion in general format that stops on integers.
| probe | probe to read from. |
| value | converted value. |
| significand | integer value when the error is NotDouble, first significant digits read otherwise. |
| exponent | decimal exponent read. |
| negative | sign read. |
| DCONV_COLD Errc dconv::details::atodRewind | ( | Probe & | probe, |
| double & | value, | ||
| uint64_t & | significand, | ||
| int64_t & | exponent, | ||
| bool & | negative ) |
parse again a number the fast path does not handle.
| probe | probe to read from, positioned on the start of the number. |
| value | converted value. |
| significand | integer value when the error is NotDouble, first significant digits read otherwise. |
| exponent | decimal exponent read. |
| negative | sign read. |
|
inlinenoexcept |
count the digits of a decimal significand.
| digits | decimal significand. |
|
inlinenoexcept |
count the trailing zeros of a four digits group.
| group | four digits group. |
|
inlinenoexcept |
write a decimal significand with the same layout as prettify.
| buffer | buffer to write the string representation to. |
| digits | decimal significand. |
| length | number of digits. |
| k | decimal exponent. |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlinenoexcept |
lay out decimal digits as a fixed or scientific number.
| buffer | buffer holding the digits. |
| length | number of digits. |
| k | decimal exponent. |
|
inline |
read an optional exponent.
| probe | probe to read from. |
| exponent | read exponent. |
|
inlinenoexcept |
multiply two 64 bits unsigned integers.
| a | multiplicand. |
| b | multiplier. |
| high | high 64 bits of the 128-bit result. |
| low | low 64 bits of the 128-bit result. |
|
inlinenoexcept |
write the digits of a decimal significand.
| buffer | buffer to write the digits to. |
| digits | decimal significand. |
| length | number of digits. |
|
inlinenoexcept |
write a decimal exponent.
| buffer | buffer to write the exponent to. |
| k | exponent. |
|
constexpr |
two digits decimal representations of 0 to 99.
|
constexpr |
|
constexpr |
cached powers of ten for the grisu algorithms.
|
constexpr |
trailing zeros of the two digits decimal representations of 0 to 99.
|
constexpr |
powers of ten that fit in 32 bits.
|
constexpr |