MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / write_compact_float

Method write_compact_float

Source/Utils/json.hpp:14250–14268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14248 }
14249
14250 void write_compact_float(const number_float_t n, detail::input_format_t format)
14251 {
14252 if (static_cast<double>(n) >= static_cast<double>(std::numeric_limits<float>::lowest()) &&
14253 static_cast<double>(n) <= static_cast<double>((std::numeric_limits<float>::max)()) &&
14254 static_cast<double>(static_cast<float>(n)) == static_cast<double>(n))
14255 {
14256 oa->write_character(format == detail::input_format_t::cbor
14257 ? get_cbor_float_prefix(static_cast<float>(n))
14258 : get_msgpack_float_prefix(static_cast<float>(n)));
14259 write_number(static_cast<float>(n));
14260 }
14261 else
14262 {
14263 oa->write_character(format == detail::input_format_t::cbor
14264 ? get_cbor_float_prefix(n)
14265 : get_msgpack_float_prefix(n));
14266 write_number(n);
14267 }
14268 }
14269
14270 public:
14271 // 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