template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
class FloatToString
Defined at line 405 of file ../../third_party/llvm-libc/src/src/__support/float_to_string.h
Convert floating point values to their string representation.
Because the result may not fit in a reasonably sized array, the caller must
request blocks of digits and convert them from integers to strings themself.
Blocks contain the most digits that can be stored in an BlockInt. This is 9
digits for a 32 bit int and 18 digits for a 64 bit int.
The intended use pattern is to create a FloatToString object of the
appropriate type, then call get_positive_blocks to get an approximate number
of blocks there are before the decimal point. Now the client code can start
calling get_positive_block in a loop from the number of positive blocks to
zero. This will give all digits before the decimal point. Then the user can
start calling get_negative_block in a loop from 0 until the number of digits
they need is reached. As an optimization, the client can use
zero_blocks_after_point to find the number of blocks that are guaranteed to
be zero after the decimal point and before the non-zero digits. Additionally,
is_lowest_block will return if the current block is the lowest non-zero
block.
Public Methods
void FloatToString<T, value-parameter-0-1> (T init_float)
Defined at line 414 of file ../../third_party/llvm-libc/src/src/__support/float_to_string.h
bool is_nan ()
Defined at line 422 of file ../../third_party/llvm-libc/src/src/__support/float_to_string.h
bool is_inf ()
Defined at line 423 of file ../../third_party/llvm-libc/src/src/__support/float_to_string.h
bool is_inf_or_nan ()
Defined at line 424 of file ../../third_party/llvm-libc/src/src/__support/float_to_string.h
BlockInt get_positive_block (int block_index)
get_block returns an integer that represents the digits in the requested
block.
Defined at line 430 of file ../../third_party/llvm-libc/src/src/__support/float_to_string.h
BlockInt get_negative_block (int block_index)
Defined at line 491 of file ../../third_party/llvm-libc/src/src/__support/float_to_string.h
BlockInt get_block (int block_index)
Defined at line 552 of file ../../third_party/llvm-libc/src/src/__support/float_to_string.h
size_t get_positive_blocks ()
Defined at line 560 of file ../../third_party/llvm-libc/src/src/__support/float_to_string.h
bool is_lowest_block (size_t negative_block_index)
This takes the index of a block after the decimal point (a negative block)
and return if it's sure that all of the digits after it are zero.
Defined at line 572 of file ../../third_party/llvm-libc/src/src/__support/float_to_string.h
bool is_lowest_block (size_t negative_block_index)
This takes the index of a block after the decimal point (a negative block)
and return if it's sure that all of the digits after it are zero.
Defined at line 572 of file ../../third_party/llvm-libc/src/src/__support/float_to_string.h
size_t zero_blocks_after_point ()
Defined at line 589 of file ../../third_party/llvm-libc/src/src/__support/float_to_string.h