[CDRIVER-1978] NaN and Infinity differently JSON-encoded depending on platform Created: 04/Jan/17  Updated: 03/May/17  Resolved: 28/Feb/17

Status: Closed
Project: C Driver
Component/s: json, libbson
Affects Version/s: None
Fix Version/s: 1.7.0

Type: Improvement Priority: Minor - P4
Reporter: A. Jesse Jiryu Davis Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: libbson corpus

 Description   

In GCC and Clang, the double NAN (defined in math.h) is JSON-encoded like:

{"value": nan}

In Microsoft Visual Studio, it's:

{"value": -nan(ind)}

This is seems wrong and likely violates the Extended JSON Spec. Furthermore, Infinity is encoded as "inf" with GCC and Clang on Linux and Mac, but "Infinity" with GCC on Solaris.



 Comments   
Comment by Githook User [ 24/Feb/17 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-1947 parse and generate $numberDouble

Also standardize parsing of "NaN" and fix CDRIVER-1978: standard output
of NaN and Infinity.
Branch: master
https://github.com/mongodb/libbson/commit/ea9f511a122f990cc2d1536115d85b662f7e90f2

Comment by A. Jesse Jiryu Davis [ 17/Jan/17 ]

Waiting for Extended JSON Spec, including its tests.

Generated at Wed Feb 07 21:13:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.