Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Numbers longer 17 digits wiped by zeroes #2396

Closed
Hubbitus opened this issue Jan 10, 2022 · 4 comments
Closed

Numbers longer 17 digits wiped by zeroes #2396

Hubbitus opened this issue Jan 10, 2022 · 4 comments

Comments

@Hubbitus
Copy link

Hubbitus commented Jan 10, 2022

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 Hubbitus changed the title Numbers longer 17 digits in output has zeroes Numbers longer 17 digits wiped by zeroes Jan 10, 2022
@bergus
Copy link

bergus commented Jan 12, 2022

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

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

@itchyny
Copy link
Contributor

itchyny commented Jan 13, 2022

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

@Hubbitus
Copy link
Author

Hubbitus commented Mar 5, 2022

Thank you

@emanuele6
Copy link
Member

jq 1.7 released with the fix. closing

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

4 participants