Here's a fun one. The "modulo" operator (%) is commonly understood to return the remainder of a division operator. So, 3 / 2 is 1.5, but 3 % 2 is 1, because if you divide three by two, the remainder is one.
But things get a little unexpected with negative numbers. 7 % 3 is 1 (because the remainder of seven divided by three is one), but -7 % 3 is 2 because the more-precise definition of a remainder is usually the *least positive integer* you have to subtract from the dividend (-7) to make it divisible by the divisor (3). So, -7 % 3 is 2: subtract 2 from -7 gives you -9, and that's evenly divisible by three.
So what do you think -7 % -3 might be? According to Spotlight in macOS Sequoia (and a bunch of other calculators), the answer is -3.07.
I *think* I know enough about compilers and rounding towards zero vs rounding toward infinity to guess what's going on here, but I'm curious if anyone has any thoughts.


