Mantis - Squeak
Viewing Issue Advanced Details
6711 Kernel minor always 10-08-07 02:10 12-01-08 22:59
RalphJohnson  
RalphJohnson  
normal  
closed 3.10  
fixed  
none    
none 3.10  
0006711: FloatTest is wrong
FloatTest>>testNaN2 is wrong. It first denies that nan1 = nan1 (which, bizarre as it may seem, is correct) and then asserts that nan1 = nan1. I changed that last statement to nan1 == nan1.
 FloatTest-testNaN2-M6711.cs.st [^] (1,351 bytes) 10-08-07 02:13

Notes
(0011259)
nicolas cellier   
10-08-07 20:08   
Note that in testNaN1 Float nan == Float nan does answer true.
It rely on the fact that Float nan is a constant ^NaN.

But has this any usefull meaning?

I mean, is this really a deliberated feature, or just a side effect of current implementation?

I tend to interpret it a side effect, because most operations will produce a NaN which is ~~ Float nan:

(0.0 ln / 0.0 ln) == Float nan. "is false"
(0.0 ln / 0.0 ln) isNan. "is true'

So user should never use test == Float nan. It might be true sometimes (when coming from Float nan or Number readFrom: 'NaN'), wrong most times.

User should use isNan. That's what the test should emphasize as a feature.

So, this == test just assert that implementation is what it is, which must NOT be interpreted by user as a feature.
This test just forbid implementation to change, which is arbitrary and useless, and might not be portable across dialects and/or versions.
(0011260)
nicolas cellier   
10-08-07 21:10   
Note that in 7137, test is correctly nan1 == nan1 (dtl 10/1/2004)
(0012819)
KenCausey   
12-01-08 22:59   
Harvested as update 7151 and released with Squeak 3.10.