Currently f{32,64}::NAN, INFINITE and NEG_INFINITY (i.e. if !v.is_finite()) are all emitted like their ryu serializations. This is wrong and breaks JSON.
Instead, emit null, like serde_json does.
On deserialization, interpret null as NAN where f32 or f64 is expected. This isn't exactly what serde_json does (it errors out instead), but makes the round-trip closer and somewhat more robust. And many would claim that it is common to interpret a JSON null as NAN where a float is expected (from schema/context/protocol).
Currently
f{32,64}::NAN
,INFINITE
andNEG_INFINITY
(i.e. if!v.is_finite()
) are all emitted like theirryu
serializations. This is wrong and breaks JSON. Instead, emitnull
, likeserde_json
does. On deserialization, interpretnull
asNAN
wheref32
orf64
is expected. This isn't exactly whatserde_json
does (it errors out instead), but makes the round-trip closer and somewhat more robust. And many would claim that it is common to interpret a JSONnull
asNAN
where a float is expected (from schema/context/protocol).