@t1_hopscotch Rounding down doesn't require modulo.
Round_Down(x) = Round(x-0.5)
This works for both positive & negative numbers.
Truncation can be done with modulo. For positive numbers it's the same result, with the difference being trunc(x) moves closer to 0, so for negative numbers trunc(x) rounds up. Truncation is just keeping the integer portion of a number so is the same as an integer function or int(x).
I'll post a explanation / derivation for trunc(x) in a few minutes. But I just tested and at least with the current TestFlight app version modulo is not working right for non-integers. When modulo was first introduced it had a similar problem with non-integers, then THT fixed it, now it's broken again.
Truncation using modulo
(If/when it works right)
Just to restate, truncation is rounding towards zero or just keeping the integer portion of a number.
Definition of modulo:
where the bit with the "L"s is truncation
So we can solve for trunc(x) by letting y=1
x mod 1 = x - 1 * trunc(x/1)
x mod 1 = x - trunc(x)
trunc(x) = x - (x mod 1)
also int(x) = x - (x mod 1)
*but again, at least with the current TestFlight app version, mod doesn't work right for non-integers so this doesn't work. The bug has been reported here.