> the nice properties, you can have an algebraic division by zero. Just look at IEEE

> floating point. :-) Iâ€™m sure thereâ€™s a good deal of disagreement over whether or not

> IEEE inf/nan semantics are â€œniceâ€ but it tends to do â€œthe right thingâ€ and sure

> beats exception handling IMO.

i do like the IEEE inf/nan semantics, and about loosing nice properties, well how many are strictly true for floating point numbers at all?

associativity : try huge_val – huge_val + 1

distributivity: try (huge_val – huge_val)*huge_val (overflow)

inverse : a * (1/a) (here 1/a probably cant be represented exactly)

a*b=0 requires a or b to be 0: try 2 really small numbers

…

An interesting aside: one might thing that having an infinity element is “wrong” because it’s destructive or absorbing, in the sense that INF+x == INF for all x (except -INF). However this is actually true of almost all floating point numbers. For instance if y=2**80 then y+x == y as long as x is fairly small (how small is left as an exercise to the reader). So in a sense, this “misbehavior” is nothing special about infinity, but a nasty property of fixed precision floating point in general. Said differently, infinity is just like a “really big” floating point number at least 2**n times as large as any other, where n is the number of bits in the significand.

Interested readers unfamiliar with floating point should read this classic article:

http://docs.sun.com/source/806-3568/ncg_goldberg.html