-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Max long is rounded up #1357
Comments
jq uses IEEE754 doubles for its internal number representation, which is why this happens. |
We may yet fix this. We'll see. |
It was realy fast reaction. Thank you. 👍 |
It seems odd to me that it rounds this way, though. A quick test (I yanked jv_dtoa.h/jv_dtoa.c out, used the compile flags out of my Makefile, and called Alternatively, the rounding could be a side effect of jv_dump. And this turns out to be the case!
Outputs:
Continuing down the call chain, it seems that it's Why do we use this instead of something like |
I'm using Fedora 25
|
Are there any known jq ports to languages such as python that support arbitrary sized integers? |
@bschlenk: I seem to recall seeing some attempts to port to node/JS and such, but they're hard to find now. https://github.com/search?utf8=%E2%9C%93&q=jq+js+NOT+jquery&type=Repositories&ref=searchresults There are bindings for Python, but I'm not aware of any ports to Python. |
I'm loathe to toss I'm not sure that cases involving numbers that can't be represented exactly in IEEE754 doubles are too exciting, especially as to integers since we can and should add a 64-bit integer sub-type of the |
waiting for changes to finalise on #1327 thinking 🤔 of going with string version for now |
hi @librucha
|
MacOS 10.15.7 | jq 1.6
|
On MacOS 11.4 and jq 1.6 is still wrong
|
i'm hitting this too. any eta for the $ echo '{"long":1136492207025876992}' | jq .
{
"long": 1136492207025877000
} i'm using windows 10, jq 1.6 |
The problem was addressed in a commit dated Oct 21, 2019, as mentioned in the jq FAQ: Please also note that the developers/maintainers of jq have historically regard this as an enhancement rather than a "bug fix; this probably explains why it has taken so long for the issue to be addressed. |
jq 1.7 released with the fix. closing |
Hi.
I tried use jq for processing data from SOLR and found round problem for max long.
input.json
Command:
jq '.response.docs' input.json
Result:
As you can see node
_validTo
is rounded up and overflow the max long number in Java.The text was updated successfully, but these errors were encountered: