Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

jq is rounding 64-bit unsigned integers #1399

arjones opened this issue Apr 28, 2017 · 1 comment

jq is rounding 64-bit unsigned integers #1399

arjones opened this issue Apr 28, 2017 · 1 comment


Copy link

arjones commented Apr 28, 2017

Twitter statuses (tweets) ids are implemented as 64-bit unsigned integers (more on the implementation here).

When I parse the id field jq is showing a different rounded number. For convenience, Twitter guys implemented a field id_str been a string it doesn't suffer from the same behavior, and contains the desired value.

AFIK, this problem didn't happened before (I'm been using JQ for several years now), so I believe it can be related to the increasing ID value on tweets may be responsible for it.

I'm leaving a sample file which contains 30 tweets where you can compare both fields: statuses-sample.txt

jq -c '{id, id_str}' < statuses-sample.json
Copy link

See #1387 (comment).

This is often reported. (see also #545, #529, and #178)

The summary here is that it's not a bug. Internally, we use IEEE754 doubles, and those can't perfectly represent all integers, especially not all large ones. We have a feature we're working on (#1327) that will somewhat improve this behavior.

Closing as a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants