Mantis - Squeak
Viewing Issue Advanced Details
3564 Kernel minor always 05-06-06 21:58 07-22-06 21:38
nicolas cellier  
MarcusDenker  
normal  
closed  
fixed  
none    
none 3.9  
0003564: LargeInteger>>asFloat does not honour IEEE rounding mode

self assert: 16r1FFFFFFFFFFFF0801 asFloat ~= 16r1FFFFFFFFFFFF0800 asFloat.

first number should be rounded up to 16r1FFFFFFFFFFFF1000.0
second number should be rounded down to 16r1FFFFFFFFFFFF0000.0

Current implementation use only first 64 bits, but even with more bits, it would do several partial rounding operations which is not equivalent to a single global rounding.
ArbitraryPrecisionAsFloat (in SqueakMap and squeaksource) implement correct IEEE rounding.
I took the patch from it.
 Kernel-Number-Integer-asFloat-Patch.1.cs [^] (2,253 bytes) 05-06-06 21:59
 Kernel-Number-Integer-asFloat-Test.1.cs [^] (647 bytes) 05-06-06 22:08
 Kernel-Number-Integer-asFloat-Patch.2.cs [^] (1,849 bytes) 07-08-06 01:10

Notes
(0005608)
nicolas cellier   
07-08-06 01:12   
Patch.2.cs is better: it will avoid creation of second method asFloatSimply
(0006130)
MarcusDenker   
07-21-06 09:10   
already in 7045