[M3devel] div/mod
Jay K
jay.krell at cornell.edu
Sun Jul 18 14:44:25 CEST 2010
ok, this is a really minor thing. Very esoteric, waste of time probably.
Div and mod are defined in terms of each other.
In the "real world", any integer mod negative 1 is 0.
All integers are "evenly divisible" by 1 and negative 1.
So INT_MIN mod -1 is 0.
One can code that to be the case. Some versions of the code do.
I'm not sure about the current code, as we don't call the C functions any longer, except for int64 on NT386.
The older div/mod helpers, depending on optimization, would either return 0
or generate an overflow exception.
In our computer world, INT_MIN div -1 is not computable, and generates
the same exception. Even with current code.
If div and mod are defined in terms of each other, and one of them is not computable,
is it wrong to be able to compute the other?
- Jay
More information about the M3devel
mailing list