Open justjoehere opened 4 years ago
Hi @justjoehere
Can you confirm this issue on 0.5.0
version ?
Still occurs in 0.5.0.
Hi @justjoehere
I added test case to reproduce this issue, https://github.com/anilmaurya/fast_jsonparser/commit/96ff5c513bb8d11ee9d2e593cfb2624a8ff9b9d6
But test cases is passing. Can you provide a failing test for this issue ?
the test is actually failing on platforms where sizeof(long) != 32 like Windows.
# Running:
.......F..
Finished in 0.176423s, 56.6819 runs/s, 113.3638 assertions/s.
1) Failure:
FastJsonparserTest#test_large_integer_parsing [c:/moje/gem/fast_jsonparser/test/fast_jsonparser_test.rb:83]:
Expected: -601754617
Actual: 7386425359
Executing the following code
FastJsonparser.parse("[{ \"duration\": 7386425359 }]")
Results in
{ :duration => -1203509233 }
This parsing is resulting in a change in values 7386425359 is being converted to -1203509233
It's like there's a weird conversion from an unsigned to a signed 33 bit conversion taking place. I used this tool to make that guess https://onlinetoolz.net/unsigned-signed#base=10&value=7386425359&bits=33