Inconsistent behaviour for NaNs and Infs
tanhevg opened this issue · comments
tanhevg commented
JSON standard only supports scientific decimal representation of floating point numbers. This leaves out Inf
s and NaNs
. JSON3 currently represents these as string null
when writing, and throws an error when trying to read them (into a struct). This behaviour needs to be consistent: either throw an error when trying to write something that is not supported by the standard, or augment the format by allowing NaN
and Inf
as floating point numbers. My preference would be the latter.
What do you think?
Jacob Quinn commented
I think we should throw an error. Better to be explicit upfront. PR up.