From: wconrad@... Date: 2002-05-31T02:56:52+09:00 Subject: Re: Infinity (?!) On Thu, May 30, 2002 at 11:04:30PM +0900, Sean Russell wrote: > Dossy wrote: > > > Float allowing division by zero is certainly not of least surprise > > to me. ;-) > > Yeah, I think it is sort of silly, too. From what I remember of my math, > dividing by zero is "illegal". True, but the math we do with floats bears only a passing resemblance to the math we learned in our youth (floats are not reals, no matter what Wirth says). Nor is it too odd to define 1 / 0 as infinity -- infinity is a just as reasonable a result as "you can't do that," considering that 1 / n approaches infinity as n approaches 0. Computer math is a little surprising. > However, IEEE 754 (Institute of Electrical and Electronics Engineers. IEEE > Standard for Binary Floating-Point Arithmetic. ANSI/IEEE Std 754-1985.) > defines rules for operations such as this, and it specifies that n/0 -> > Infinity, -n/0 -> -Infinity, and 0/0 -> NaN. Because of this, I'm a little > surprised that Integer math in Ruby doesn't follow the same rules. I'd be very surprised to find IEEE 754 applied to integers. Integers are quite different animals. Wayne Conrad