01mf02 / jaq

A jq clone focussed on correctness, speed, and simplicity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

enhancement request re: %

pkoppstein opened this issue · comments

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

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?