Bill, I have already said that I think IEEE floats tend to give the wrong answer fast. Better solutions are hard to come by, however, as they definately depend on the problem domain. E.g. Apple's old plot program used interval arithmetic and did a great job with functions like x * sin(1/x) near zero. You could zoom in time after time and still get an accurate plot -- where IEEE floats are useless. Interval math is also great when you have measurement error and you can't fool yourself about error analysis. It is sure helpful to know the difference between 3.023+/-0.001 and 3.023+/-2e56 . Interval math does have splits and it is sometimes useful to calculate the probability distribution of the value in the interval. No perfect world, sigh. If you are using ideal mathematics, on the other hand, there are exact real representations which can be used, but these are pretty heavy weight for day to day computing. Another day; a little better approximation, -KenD
From: "Schwab,Wilhelm K" <bschwab@anest.ufl.edu> ... As for the zero vector, it is hard to say. Note that a nearly zero vector is going to have a very poorly defined direction in that the result will likely be dominated by roundoff error. Often there is a better way to compute such things; a rearrangment of governing equations can make a world of difference - that's not something you can fix, it will be problem-specific how one would avoid computing the argument in tricky situations. One possible approach is to simply compute the angle the same way for all values and let under/over flow errors take care of the garbage. Another would be to raise an error. Finally, you might define #argument, #argumentIfSmall: (takes a block for the troublesome case) and #argumentIEEE to use their convetion.
Something that deserves a careful look is the test for floats being close to each other. I have been supicious about that for a while, and on first glance, Dolphin seems to handle it very differently from the way Squeak does. IMHO, being different from Dolphin is cause for a good think. We shouls also see how VW handles it.
Just looking at #closeTo:, it appears to "think" that 10^-4 is a good threshold, and that is questionable depending on the scales involved, and is far from the smallest float that can be reasonable represented.
Bill