MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / write_compact_float

Method write_compact_float

Source/external/json.hpp:16676–16701  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16674 }
16675
16676 void write_compact_float(const number_float_t n, detail::input_format_t format)
16677 {
16678#ifdef __GNUC__
16679#pragma GCC diagnostic push
16680#pragma GCC diagnostic ignored "-Wfloat-equal"
16681#endif
16682 if (static_cast<double>(n) >= static_cast<double>(std::numeric_limits<float>::lowest()) &&
16683 static_cast<double>(n) <= static_cast<double>((std::numeric_limits<float>::max)()) &&
16684 static_cast<double>(static_cast<float>(n)) == static_cast<double>(n))
16685 {
16686 oa->write_character(format == detail::input_format_t::cbor
16687 ? get_cbor_float_prefix(static_cast<float>(n))
16688 : get_msgpack_float_prefix(static_cast<float>(n)));
16689 write_number(static_cast<float>(n));
16690 }
16691 else
16692 {
16693 oa->write_character(format == detail::input_format_t::cbor
16694 ? get_cbor_float_prefix(n)
16695 : get_msgpack_float_prefix(n));
16696 write_number(n);
16697 }
16698#ifdef __GNUC__
16699#pragma GCC diagnostic pop
16700#endif
16701 }
16702
16703 public:
16704 // The following to_char_type functions are implement the conversion

Callers

nothing calls this directly

Calls 1

write_characterMethod · 0.45

Tested by

no test coverage detected