MCPcopy Create free account
hub / github.com/PeterFWS/Structure-PLP-SLAM / dump_float

Method dump_float

3rd/json/include/nlohmann/json.hpp:12676–12695  ·  view source on GitHub ↗

! @brief dump a floating-point number Dump a given floating-point number to output stream @a o. Works internally with @a number_buffer. @param[in] x floating-point number to dump */

Source from the content-addressed store, hash-verified

12674 @param[in] x floating-point number to dump
12675 */
12676 void dump_float(number_float_t x)
12677 {
12678 // NaN / inf
12679 if (not std::isfinite(x))
12680 {
12681 o->write_characters("null", 4);
12682 return;
12683 }
12684
12685 // If number_float_t is an IEEE-754 single or double precision number,
12686 // use the Grisu2 algorithm to produce short numbers which are
12687 // guaranteed to round-trip, using strtof and strtod, resp.
12688 //
12689 // NB: The test below works if <long double> == <double>.
12690 static constexpr bool is_ieee_single_or_double
12691 = (std::numeric_limits<number_float_t>::is_iec559 and std::numeric_limits<number_float_t>::digits == 24 and std::numeric_limits<number_float_t>::max_exponent == 128) or
12692 (std::numeric_limits<number_float_t>::is_iec559 and std::numeric_limits<number_float_t>::digits == 53 and std::numeric_limits<number_float_t>::max_exponent == 1024);
12693
12694 dump_float(x, std::integral_constant<bool, is_ieee_single_or_double>());
12695 }
12696
12697 void dump_float(number_float_t x, std::true_type /*is_ieee_single_or_double*/)
12698 {

Callers

nothing calls this directly

Calls 9

to_charsFunction · 0.85
removeFunction · 0.85
fillClass · 0.85
findFunction · 0.70
write_charactersMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected