Hi Arend,
It says in the spec that serialization/deserialization must follow the
conversion process defined in javadoc for toString/parse methods. NaN
handling is described there.
Here is a link to javadoc:
http://docs.oracle.com/javase/8/docs/api/java/lang/Double.html
JSONB 3.16 says that "JSON Binding implementation MUST serialize numbers
that express greater magnitude or precision than an IEEE 754 double
precision number as strings".
It means that Double.NaN will be serialized to "NaN" string and vise
versa. "NaN" and "Infinity" are actually strings here (in double quotes)
which makes it compatible with JSON spec.
Double d = Double.NaN; -> { d: "NaN" }
But I agree that JSONB spec has to be more clear in this case.
Best regards,
Dmitry Kornilov
On 10.9.2015 21:54, Arend v. Reinersdorff wrote:
> Hi,
>
> issue JSONB_SPEC-9 mentions that NaN needs to be handled as a special
> case:
> https://java.net/jira/browse/JSONB_SPEC-9
>
> But I didn't find this case in the spec draft. I looked in section
> 3.3.2 "java.lang.Byte, Short, Integer, Long, Float, Double".
>
> JSON doesn't allow NaN or Infinity as number values. So I think these
> cases need special handling when marshalling a float or double?
>
> Best regards,
> Arend
>