integer division with float result

Lars Noschinski lars-2006-1 at usenet.noschinski.de
Tue Nov 20 09:38:38 PST 2007


* David B. Held <dheld at codelogicconsulting.com> [07-11-20 10:31]:
>From a number theory perspective ints and floats are a world apart.  It is true 
>that integers are not a field because they are not closed under /.  However, 
>that does not mean we should pretend that Z == R and force float opDiv(int, 
>int).  The reality is that int != Z, either.  No, int == Z_2^32, and that 
>*does* have a closed /, which makes it as much a field as R, and deserving of 
>its own int opDiv(int, int).  Of course, the / defined on Z_n is different from 
>int opDiv(int, int), but let us not concern ourselves with that minor detail.

Z_2^32 is not a field, and it has not got a division; e.g. 2^31 * z !=
1 for all z \in Z_2^32.



More information about the Digitalmars-d mailing list