[squeak-dev] Re: [ANN] Number comparison, hash, NaN, Point, and other partially ordered sets

John M McIntosh johnmci at smalltalkconsulting.com
Wed Jan 7 06:46:16 UTC 2009

On 6-Jan-09, at 10:33 PM, Andreas Raab wrote:

> Eliot Miranda wrote:
>> I used to think the same (at least for infinity & infinitessimal)  
>> but no longer..  1 / 0 ~= (Float maxVal * 2).  At first the IEEE  
>> rules may seem counter-intuitive but they have been well thoguht- 
>> out.  They provide safety for computations that go out of range.   
>> Correctness (in this case lack of false positives) is much more  
>> important than "naturalness".
> I agree. But correctness can also mean that neither 1 / 0 nor Float  
> maxVal * 2 should be allowed to successfully execute primitively.
>> The experience with VisualWorks where we changed over to IEEE (with  
>> Inf & NaN) was rthat those people who really cared avbout float  
>> arithmetic and knew what they were talking about really wanted IEEE  
>> behaviour and did not at all want abstract Infinity Infinitessimal  
>> or NaN.  One thing they wanted was easy interoperability (e.g. with  
>> high-performance libraries), which means sticking to IEEE.   
>> Introducing abstract Infinity/Infinitessimal/NaN complicates the  
>> glue and slows it down.
> Interesting data point. I'm really torn in this area - it seems like  
> such a broken behavior to have a ~= a.
> Cheers,
>  - Andreas

Also read/see http://en.wikipedia.org/wiki/NaN

However the other place where I've been burned with this is doing what  
you think is IEEE math in smalltalk
then converting some of the code to SQL stored procedures and the  
database engine DOES do proper IEEE

You then discover NaN data being poured into the database via some  
other forms of data collection results
in the stored procedure code giving you different results from the  
original smalltalk code, but only in production
late one dark winter night...

John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com

More information about the Squeak-dev mailing list