![]() |
Prusa Slicer 2.6.0
|
Namespaces | |
| namespace | anonymous_namespace{fast_float.h} |
| namespace | detail |
Classes | |
| struct | adjusted_mantissa |
| struct | binary_format |
| struct | decimal |
| struct | from_chars_result |
| struct | parse_options |
| struct | parsed_number_string |
| struct | powers_template |
| struct | value128 |
Typedefs | |
| using | powers = powers_template<> |
Enumerations | |
| enum | chars_format { scientific = 1<<0 , fixed = 1<<2 , hex = 1<<3 , general = fixed | scientific } |
Variables | |
| static constexpr double | powers_of_ten_double [] |
| static constexpr float | powers_of_ten_float [] |
This code is meant to handle the case where we have more than 19 digits.
It is based on work by Nigel Tao (at https://github.com/google/wuffs/) who credits Ken Thompson for the design (via a reference to the Go source code).
Rob Pike suggested that this algorithm be called "Simple Decimal Conversion".
It is probably not very fast but it is a fallback that should almost never be used in real life. Though it is not fast, it is "easily" understood and debugged.
| struct fast_float::from_chars_result |
| Class Members | ||
|---|---|---|
| errc | ec | |
| const char * | ptr | |
| struct fast_float::parsed_number_string |
| using fast_float::powers = typedef powers_template<> |
| Enumerator | |
|---|---|
| scientific | |
| fixed | |
| hex | |
| general | |
| fastfloat_really_inline uint64_t fast_float::byteswap | ( | uint64_t | val | ) |
Referenced by read_u64(), and write_u64().
Here is the caller graph for this function:| adjusted_mantissa fast_float::compute_float | ( | decimal & | d | ) |
References fast_float::detail::decimal_left_shift(), fast_float::detail::decimal_right_shift(), fast_float::adjusted_mantissa::mantissa, fast_float::adjusted_mantissa::power2, and fast_float::detail::round().
Here is the call graph for this function:
|
noexcept |
References fast_float::value128::high, leading_zeroes(), fast_float::value128::low, fast_float::adjusted_mantissa::mantissa, fast_float::detail::power(), and fast_float::adjusted_mantissa::power2.
Referenced by from_chars_advanced().
Here is the call graph for this function:
Here is the caller graph for this function:| fastfloat_really_inline value128 fast_float::compute_product_approximation | ( | int64_t | q, |
| uint64_t | w | ||
| ) |
References full_multiplication(), fast_float::value128::high, fast_float::value128::low, fast_float::powers_template< unused >::power_of_five_128, and fast_float::powers_template< unused >::smallest_power_of_five.
Here is the call graph for this function:
|
inline |
Referenced by fast_float::detail::parse_infnan().
Here is the caller graph for this function:
|
noexcept |
This function parses the character sequence [first,last) for a number. It parses floating-point numbers expecting a locale-indepent format equivalent to what is used by std::strtod in the default ("C") locale. The resulting floating-point value is the closest floating-point values (using either float or double), using the "round to even" convention for values that would otherwise fall right in-between two values. That is, we provide exact parsing according to the IEEE standard.
Given a successful parse, the pointer (ptr) in the returned value is set to point right after the parsed number, and the value referenced is set to the parsed value. In case of error, the returned ec contains a representative error, otherwise the default (std::errc()) value is stored.
The implementation does not throw and does not allocate memory (e.g., with new or malloc).
Like the C++17 standard, the fast_float::from_chars functions take an optional last argument of the type fast_float::chars_format. It is a bitset value: we check whether fmt & fast_float::chars_format::fixed and fmt & fast_float::chars_format::scientific are set to determine whether we allowe the fixed point and scientific notation respectively. The default is fast_float::chars_format::general which allows both fixed and scientific.
References from_chars_advanced().
Referenced by get_attribute_value_float(), Slic3r::GCodeReader::GCodeLine::has_value(), Slic3r::CoolingBuffer::parse_layer_gcode(), Slic3r::GCodeReader::parse_line_internal(), Slic3r::GUI::EmbossStylesSerializable::read(), Slic3r::GUI::EmbossStylesSerializable::read(), Slic3r::string_to_float_decimal_point(), and Slic3r::string_to_floating_decimal_point().
Here is the call graph for this function:
Here is the caller graph for this function:
|
noexcept |
Like from_chars, but accepts an options argument to govern number parsing.
References compute_float(), fast_float::from_chars_result::ec, fast_float::binary_format< T >::exact_power_of_ten(), fast_float::detail::parse_infnan(), parse_number_string(), fast_float::adjusted_mantissa::power2, fast_float::from_chars_result::ptr, and fast_float::detail::to_float().
Referenced by from_chars().
Here is the call graph for this function:
Here is the caller graph for this function:| fastfloat_really_inline value128 fast_float::full_multiplication | ( | uint64_t | a, |
| uint64_t | b | ||
| ) |
References fast_float::value128::high, and fast_float::value128::low.
Referenced by compute_product_approximation().
Here is the caller graph for this function:
|
noexcept |
Referenced by parse_decimal(), and parse_number_string().
Here is the caller graph for this function:
|
noexcept |
References is_made_of_eight_digits_fast(), and read_u64().
Here is the call graph for this function:
|
noexcept |
Referenced by is_made_of_eight_digits_fast(), parse_decimal(), and parse_number_string().
Here is the caller graph for this function:| fastfloat_really_inline int fast_float::leading_zeroes | ( | uint64_t | input_num | ) |
Referenced by compute_float().
Here is the caller graph for this function:
|
noexcept |
References fast_float::decimal::decimal_point, fast_float::decimal::digits, is_integer(), is_made_of_eight_digits_fast(), fast_float::decimal::negative, fast_float::decimal::num_digits, read_u64(), fast_float::decimal::truncated, and write_u64().
Referenced by parse_long_mantissa().
Here is the call graph for this function:
Here is the caller graph for this function:
|
noexcept |
References parse_eight_digits_unrolled(), and read_u64().
Here is the call graph for this function:| fastfloat_really_inline uint32_t fast_float::parse_eight_digits_unrolled | ( | uint64_t | val | ) |
Referenced by parse_eight_digits_unrolled(), and parse_number_string().
Here is the caller graph for this function:| adjusted_mantissa fast_float::parse_long_mantissa | ( | const char * | first, |
| const char * | last, | ||
| parse_options | options | ||
| ) |
References parse_decimal().
Here is the call graph for this function:
|
noexcept |
References fast_float::parsed_number_string::exponent, fixed, is_integer(), is_made_of_eight_digits_fast(), fast_float::parsed_number_string::lastmatch, fast_float::parsed_number_string::mantissa, fast_float::parsed_number_string::negative, parse_eight_digits_unrolled(), scientific, fast_float::parsed_number_string::too_many_digits, and fast_float::parsed_number_string::valid.
Referenced by from_chars_advanced().
Here is the call graph for this function:
Here is the caller graph for this function:| fastfloat_really_inline uint64_t fast_float::read_u64 | ( | const char * | chars | ) |
References byteswap().
Referenced by is_made_of_eight_digits_fast(), parse_decimal(), and parse_eight_digits_unrolled().
Here is the call graph for this function:
Here is the caller graph for this function:| fastfloat_really_inline void fast_float::write_u64 | ( | uint8_t * | chars, |
| uint64_t | val | ||
| ) |
References byteswap().
Referenced by parse_decimal().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticconstexpr |
Referenced by fast_float::binary_format< T >::exact_power_of_ten().
|
staticconstexpr |
Referenced by fast_float::binary_format< T >::exact_power_of_ten().