[M3devel] div/mod

Mika Nystrom mika at async.async.caltech.edu
Mon Jul 19 11:01:10 CEST 2010


No, aborting is always something the implementation is permitted to do
if it can't do the sensible thing.  If it can do something sensible, it
may still be permitted to abort, but is not under the obligation to do so.
I think this is a general principle.

     Mika

Jay K writes:
>
>ok=2C this is a really minor thing. Very esoteric=2C waste of time probably=
>.
>
>
>Div and mod are defined in terms of each other.
>
>
>In the "real world"=2C any integer mod negative 1 is 0.=20
>=A0 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.
>=A0 I'm not sure about the current code=2C as we don't call the C functions=
> any longer=2C except for int64 on NT386.
>=A0 The older div/mod helpers=2C depending on optimization=2C would either =
>return 0
>=A0=A0 or generate an overflow exception.
>
>
>In our computer world=2C INT_MIN div -1 is not computable=2C and generates
>=A0 the same exception. Even with current code.
>
>
>If div and mod are defined in terms of each other=2C and one of them is not=
> computable=2C
>=A0 is it wrong to be able to compute the other?
>
>
>=A0- Jay
>
> 		 	   		  =



More information about the M3devel mailing list