26 Sep
2020
26 Sep
'20
12:52 a.m.
Vinnie Falco wrote:
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 can't think of a reason to ever prefer #2 over #1. "As is" is already a legitimate serialization of the nearest representable IEEE double, so #1 is a valid implementation of #2, except it doesn't needlessly throw away information. There's no need to innovate here; we already know that preserving 64 bit integers is what's useful in practice.