json icon indicating copy to clipboard operation
json copied to clipboard

Inconsistent output across platform for `double`?

Open andrea-cassioli-maersk opened this issue 1 year ago • 3 comments

Hi, I have noticed that sometimes serialised double numbers differs in the last digit between platform. For instance the same number is printed as follow.

on OSX

2.6721272258931175E7

on WSL

2.672127225893118E7

In general it seems OSX uses one less digit to print. Is it a known issue? Any suggestion on how to investigate further?

andrea-cassioli-maersk avatar Dec 17 '24 16:12 andrea-cassioli-maersk

Can you tell me what the source number is, so that I can write a test that reproduces the issue? Or better yet, can you provide a snippet that reproduces the issue? Also, what are the compilers you use on WSL and OSX, and what is the Boost version?

grisumbras avatar Dec 17 '24 16:12 grisumbras

Thanks for the reply. I cannot really get a snippet to easily reproduce. But here a bit more details

boost version: 1.83 clang: 19.1 gcc: 11.4

"Can you tell me what the source number is" what do you mean?

andrea-cassioli-maersk avatar Dec 18 '24 07:12 andrea-cassioli-maersk

There's a double C++ object that is being serialized. What is its value?

Just to be clear, it's GCC 11.4 on WSL, and Clang 19.1 on OS X, right? Do both platforms have x86_64 architecture and use 64 bit address model?

grisumbras avatar Dec 18 '24 11:12 grisumbras