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

enhancement request re: % #64

Open
pkoppstein opened this issue Mar 14, 2023 · 1 comment
Open

enhancement request re: % #64

pkoppstein opened this issue Mar 14, 2023 · 1 comment

Comments

@pkoppstein
Copy link

One of the nice things about gojq is that if x and y are integers,
then (x - (x % y)) / y will be properly evaluated and recognized as an
integer.

Now I realize jaq has a completely different approach to numbers, but
it would be extremely convenient if jaq allowed (x % y) if x and y are
both integers in the sense that (. == floor).

At present, we find by contrast:

jaq -n '(7/1) % 2'
Error: cannot calculate 7.0 % 2
@nouritsu
Copy link
Contributor

nouritsu commented Jan 29, 2024

I'd love to understand this issue and implement it. Could you explain further?
From what I understand you want the modulus modulo operator to work for floats and integers?

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

No branches or pull requests

2 participants