29 May 1999 01:09:11 -0400

Related articles |
---|

Distributivity and types sanjayp@ddi.com (Sanjay Pujare) (1999-05-22) |

Re: Distributivity and types wclodius@aol.com (1999-05-22) |

Re: Distributivity and types adrian@dcs.rhbnc.ac.uk (1999-05-27) |

Re: Distributivity and types anton@mips.complang.tuwien.ac.at (1999-05-27) |

Re: Distributivity and types adrian@dcs.rhbnc.ac.uk (1999-05-29) |

Re: Distributivity and types jonathan_barker@my-deja.com (1999-05-29) |

From: | jonathan_barker@my-deja.com |

Newsgroups: | comp.compilers |

Date: | 29 May 1999 01:09:11 -0400 |

Organization: | Deja.com - Share what you know. Learn what you don't. |

References: | 99-05-111 99-05-122 99-05-140 |

Keywords: | arithmetic, theory |

anton@mips.complang.tuwien.ac.at (Anton Ertl) wrote:

*> Only if overflows trap. If, OTOH, you use modulo (aka wrap-around)*

*> arithmetic, this law holds (as do many others, because the cardinal*

*> numbers modulo 2^N are a field; two's complement numbers are just a*

*> different interpretation, the operations + and * are the same as for*

*> unsigned numbers) and you will get the correct answer.*

A minor (if slightly off-topic) point: The integers modulo 2^N are

definitely not a field unless N=1. In general, the integers mod d

form a field if and only if d is prime. However, the integers mod d

always form a ring under + and *. I assume this is what you meant.

[An example reveals that the integers mod 4 do not form a field

under + and *.

2 * 0 = 0 (mod 4)

2 * 1 = 2 (mod 4)

2 * 2 = 0 (mod 4)

2 * 3 = 2 (mod 4)

Therefore there is no multiplicative inverse of 2.]

Jonathan

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.