On to Hydro

Norman Hardy norm@netcom.com
Mon, 21 Aug 2000 19:37:39 -0700


At 9:02 -0400 00/08/18, Tyler Close wrote:

>...


>They do not denote the same real number. They are different
>numbers. -0.0 < 0.0 should be true. This behaviour agrees with that
>specified for Double.compareTo in the JDK1.3 documentation.

I don't know about IEEE floats but when it comes to reals 0 = -0.

All mathematicians agree that between any two distinct reals there 
lies another real distinct from both. What is between 0 and -0 if 
they are distinct?

Not that this bears on the decision at hand.

My two cents are that you should either conform slavishly to IEEE 
(ugh) or provide a total ordering so that sorts work. (Actually you 
could do both, perhaps even provide a function of two reals!)

I have seen just one real case where division by 0 fed meaningfully 
into another calculation. That was in continued fraction expressions 
such as a+1/(b+1/(c + ... )).
Simple algebra replaces most divides by multiplies and the advantage 
evaporates and the calculation runs faster.

The most exasperating benefit of NaNs is in vector hardware where 
most values calculated at once are useful and you can't afford to 
stop to fuss over the oddball.
-- 
Norman Hardy  <http://cap-lore.com/>