-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
builtin.jq: naive abs/0 #2767
builtin.jq: naive abs/0 #2767
Conversation
manual.yml explains that the def is naive, and mentions fabs, etc.
docs/content/manual/manual.yml
Outdated
examples: | ||
- program: 'map(abs)' | ||
input: '[-10, -1.1, -1e-1, 1000000000000000002, -1000000000000000002]' | ||
output: ['[10,1.1,1e-1,10000000000000002,1e+18]'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
output: ['[10,1.1,1e-1,10000000000000002,1e+18]'] | |
output: ['[10,1.1,0.1,1000000000000000002,1e+18]'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the corner case, 0
should be listed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think -1000000000000000002
shouldn't be here. The behavior is not guaranteed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Added tests for 0 and -0
- Removed the contingent test in manual.yml
- Used "NOT prescriptive" annotation in jq.test
Remind me why we need this change? |
(When using For non-mathematicians,
And who knows, in the future, maybe The real question, in my view, is whether abs should raise an error for non-numeric input. [*1] Here's a ChatGPT listing:
|
Also clarify non-prescriptive nature of some tests in jq.test
Thanks! |
@nicowilliams - I was expecting more back-and-forth on this one! Thanks. Any chance of making progress on fixing If you think #2655 is too radical for jq 1.7, I'll submit a different PR that doesn't do anything but make it more efficient by introducing a subfunction. Thanks also for the great progress on binary strings, especially saving $string[$i] ! |
manual.yml explains that the def is naive, and mentions fabs, etc.
This PR supersedes #2676