-
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
Small numbers are rounded to zero on calculation #2685
Comments
Caused by |
Another test case is |
I'm insufficiently familiar with decNumber. @leonid-s-usov, do you know what the fix would be here? |
I was thinking of using |
I've contemplated whether to enable decnum division in the original pull request, but that seemed too big of a change since it may greatly affect the performance. For now, any math attempted on numbers will "resolve" it down to the internal floating-point representation, which is reflected in the docs:
|
@leonid-s-usov this issue comes up just in conversion of literals to doubles. We don't need to consider making arithmetic operations work with |
@nicowilliams yes, correct. With @itchyny 's help we found the issue with rounding a decNumber to floating point precision and it's passing the test now |
Describe the bug
In the latest version of jq,
jq -n '1 / 1e-17'
exits withDivision by zero
error, but should emit1e+17
.To Reproduce
Run
jq -n '1 / 1e-17'
.Expected behavior
Since
1e-17
is not small enough to be rounded to zero,1e+17
is expected, just like jq 1.6.Environment (please complete the following information):
jq-1.6-250-gce3701f
Additional context
Likely a regression of cf4b48c.
The text was updated successfully, but these errors were encountered: