jq icon indicating copy to clipboard operation
jq copied to clipboard

Numbers longer 17 digits wiped by zeroes

Open Hubbitus opened this issue 3 years ago • 3 comments

Describe the bug On windows (wsl) and https://jqplay.org/ numbers longer than 17 digits got 0 in rest.

To reproduce

$ echo '{"userId": 11111111112222222222}' | jq '.userId'
11111111112222222000

I can't reproduce that on my Fedora Linux machine, but that is 100% reproducible on windows (wsl2, ubuntu).

Also, please take a look at play https://jqplay.org/s/I-2MjR2xyq: image

What also interesting, filtration also happened incorrectly (https://jqplay.org/s/hIYsvWo0co): image

Expected behavior The last snippet return the single result 11111111112222222222

Environment (please complete the following information):

  • OS and Version: Windows (wsl, Ubuntu)
  • jq version 1.6

Hubbitus avatar Jan 10 '22 17:01 Hubbitus

This seems expected. https://stedolan.github.io/jq/manual/#Math:

jq currently only has IEEE754 double-precision (64-bit) floating point number support.

bergus avatar Jan 12 '22 20:01 bergus

This is a frequently asked question (#545 #1652 #1959 #2109 #2131 #2182 #2201) and is already fixed in the master version (implemented by #1752 in Oct, 2019).

 $ jq --version
jq-1.6-145-ga9f97e9
 $ echo '{"userId": 11111111112222222222}' | jq '.userId'
11111111112222222222

itchyny avatar Jan 13 '22 04:01 itchyny

Thank you

Hubbitus avatar Mar 05 '22 14:03 Hubbitus

jq 1.7 released with the fix. closing

emanuele6 avatar Sep 08 '23 20:09 emanuele6