Search code examples
kdb

Modulus behavior in Q


Why is it that

    -4.5 mod 2.3
0.1

Going by the definition in Q4Mortals:

For a positive divisor, the remainder is defined as the difference between the dividend and the largest integral multiple of the divisor not exceeding the absolute value of the dividend.

2.3 is the lagest integral multiple not exceeding abs -4.5. Taking the difference, -4.5 - 2.3 = -6.8

If this definition is wrong (which it seems to be), then what is the correct one?


Solution

  • think it should be just

    For a positive divisor, the remainder is defined as the difference between the dividend and the largest integral multiple of the divisor not exceeding the dividend.