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

Identity example in manual does not work (10000000000000000000000000000001) #2165

Closed
atsalolikhin-spokeo opened this issue Jul 28, 2020 · 3 comments · Fixed by #2171
Closed

Comments

@atsalolikhin-spokeo
Copy link
Contributor

atsalolikhin-spokeo commented Jul 28, 2020

Describe the bug

The fourth example in the Identity subsection of the Basic filters section of the jq manual says the output will be true, false but it comes out as false, false. This is confusing to me as a new user trying to learn jq.

The example is:

jq '. as $big \| [$big, $big + 1] \| map(. > 10000000000000000000000000000000)'

Input: 10000000000000000000000000000001

Output: [true, false]

Here is what happens when I run it:

root@f08d0ad8ba89:/# echo 10000000000000000000000000000001 | jq '. as $big | [$big, $big + 1] | map(. > 10000000000000000000000000000000)'
[
  false,
  false
]
root@f08d0ad8ba89:/# jq --version
jq-1.6
root@f08d0ad8ba89:/#

To Reproduce

If I just click on the Run button in the 1.6 manual, it reproduces the divergent output:

https://jqplay.org/jq?q=.%20as%20%24big%20%7C%20%5B%24big%2C%20%24big%20%2B%201%5D%20%7C%20map(.%20%3E%2010000000000000000000000000000000)&j=10000000000000000000000000000001

Expected behavior
I would expect to be able to reproduce the examples in the manual.

Environment (please complete the following information):

  • OS and Version: macOS, Ubuntu, the jq website
  • jq version 1.6

Additional context
I am just trying to learn jq.

@itchyny
Copy link
Contributor

itchyny commented Jul 29, 2020

This works for the master version, as implemented by #1752.

 % echo 10000000000000000000000000000001 | jq '. as $big | [$big, $big + 1] | map(. > 10000000000000000000000000000000)'
[
  true,
  false
]
 % jq --version
jq-master-a17dd32

But as you point out, the manual is incorrect. #1752 mistakenly updates the manual of 1.6 (https://github.com/stedolan/jq/pull/1752/files#diff-966e77006eca961194e3380eacb0f80eR314). It should update the manual of development version.

@atsalolikhin-spokeo
Copy link
Contributor Author

Okay, thanks for your kind reply.

Would you like me to update the manual? I can remove the bits from the 1.6 manual and add them to the development manual?

@itchyny
Copy link
Contributor

itchyny commented Jul 30, 2020

Improving the manual is welcome, of course.

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

Successfully merging a pull request may close this issue.

2 participants