Open
Description
It's easy to get the remainder when dividing two integers:
$ jsonnet -e -- '105 % 100'
5
$ jsonnet -e -- '-105 % 100'
-5
But I found it unexpectedly awkward to do the actual division:
$ jsonnet -e -- 'std.floor(105 / 100)'
1
$ jsonnet -e -- 'std.floor(-105 / 100)'
-2
In javascript there would be Math.trunc
for this. Of course, you can write it yourself if you need it.
I wonder if std.trunc
would be a useful addition? Or std.div
for integer division?