Tencent / rapidjson

A fast JSON parser/generator for C++ with both SAX/DOM style API
http://rapidjson.org/
Other
14.21k stars 3.53k forks source link

FastPath doesn't work #1045

Open proghack opened 7 years ago

proghack commented 7 years ago

Trying to convert string 6,610557216991946e+35 to double, which corresponds to uint64 number 0x475FD4240F61B4B5, fastpath branch is selected because all conditions are met, but the result is number 0x475FD4240F61B4B6. This happens because FPU internal calculations are done at 80 bits and converting to double the result is rounded to even. Following StrtodBigInteger the result is correct.

miloyip commented 7 years ago

It seems a bug but I need time to confirm it.

proghack commented 7 years ago

Forcing FPU to use double precision, properly setting its control word, it works. Or using SSE2 instead of FPU (which is already true for 64bit applications).