23 Jan
2007
23 Jan
'07
11:03 a.m.
Hi Tim, On Sun, Jan 21, 2007 at 09:08:18PM -0500, Tim Peters wrote:
BTW - isn't that case in contradiction with the general Python rule that if b > 0, then a % b should return a number between 0 included and b excluded?
Sure.
You're not addressing my point, though, so I was probably not clear enough. My surprize was not that a % b was equal to b in this case, and so not strictly smaller than b (because I expect such things when working with floats). My surprize was that Decimals don't even try to be between 0 and b, and sometimes give a result that is far outside the range. This surprized me because I expected floats and Decimals to try to give "approximately equal" results... A bientot, Armin