I'm running Sage 5.3 on a MacBook Pro with OS X version 10.7.5, and I don't understand why the modulo operator % works so differently on reals and on integers or how I can work around it.
For instance, 4 % 10 = 4 and 6 % 10 = 10, just as I would expect.
But while 4.9 % 10 = 4.9 as expected, 5.1 % 10 = -4.9 instead of 5.1.
And as far as I can tell, for any positive integer or real modulus n and any positive integer m and positive noninteger x < n,
(mn + x) % n = x if x < n/2,
but
(mn + x) % n = x-n if x > n/2.
I don't understand this AT ALL.
(Apologies if it's a simple question that I'm failing to understand because I'm a relative novice: I would go to the ask-sage-math forum as recommended but the posting feature there seems to be currently disabled for low-karma posters.)
Thanks for any enlightenment,
Kim