
25 Sep
2020
25 Sep
'20
10:55 p.m.
On Fri, Sep 25, 2020 at 3:53 PM Andrzej Krzemienskiwrote: >> I am actually now starting to wonder if even 64-bit integer support >> was a good idea, as it can produce numbers which most implementations >> cannot read with perfect fidelity. >> ... > 1. Parse losslessly every value produced by rapidjson. > 2. Generate only values parsable by losslessly JavaScript JSON libraries. > > So, I guess the choice made in Boost.JSON is the good one. You will potentially > produce values not parsable by some JSON libraries, and if goal 2 is important > for some use cases the user has to make sure that she is only putting doubles > as numbers. Thanks for the kind words. So, I think at some point I will want to introduce options for serialization, and one of the options could be the treatment of integers outside the range ~+/-2^53. We could: 1. serialize them as-is (current implementation) 2. serialize them as the nearest representable IEEE double 3. throw an exception I know some people might find #3 weird, I'm open to feedback. Regards