Thanks Nicolas. I did check against C++ before writing the email and I can see OCaml is consistent with C++. I'm aware about IEEE 754. I'm seeking opinion for maintaining precision using 2 values as shown.
On the other hand I think I should relax this requirement and let my JSON parser accept this case because realistically I don't see anyone would use numbers at +/- E308.
Thanks
Dear Viet,
I am not sure this is an issue with OCaml (as you can verify using your favourite C compiler). Rather, I think IEEE 754 double-precision binary floating-point numbers can only represent numbers between 10^{-308} and 10^308 with full decimal digits precision. Numbers smaller than that can only be represented with reduced precision.
Best wishes,
Nicolas
--