enhancement request re: %
pkoppstein opened this issue · comments
pkoppstein commented
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
Aneesh Bhave commented
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?