Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003568 [Squeak] Kernel minor always 05-07-06 16:30 09-01-08 18:27
Reporter nicolas cellier View Status public  
Assigned To
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.10 Product Version 3.9
  Product Build
Summary 0003568: [FIX] Fraction>>asFloat does not answer nearest floating point number
Description Current implementation can accumulate round off errors.
Comment states that ideally, it should answer nearest floating point number...

I join a test and a patch for this, and round to nearest even according to IEEE 754 default rounding mode.

Patch http://bugs.impara.de/view.php?id=3564 [^] concerning Integer>>asFloat should be applied first, so this one can work correctly.
Steps To Reproduce
Additional Information Fraction need not being reduced for this algorithm to apply.
So, the new asFloat algorithm can be used to convert decimal representations to binary representations (Number readFrom: ), without spending too much time in gcd algorithm...
Attached Files  Kernel-Number-Fraction-asFloat-Test.1.cs [^] (878 bytes) 05-07-06 17:08
 Kernel-Number-Fraction-asFloat-Patch.2.cs [^] (1,852 bytes) 05-07-06 17:09
 Kernel-Number-Fraction-asFloat-Patch.3.cs [^] (1,877 bytes) 01-10-07 05:33
 Kernel-Number-Fraction-asFloat-Test.2.cs [^] (1,441 bytes) 01-10-07 05:40

- Relationships

- Notes
(0005628 - 10 - 10 - 10 - 10 - 10 - 10)
ducasse
07-08-06 18:01

in 39 7038
 
(0008859 - 270 - 348 - 348 - 348 - 348 - 348)
nicolas cellier
01-10-07 05:25

Unfortunately, the fix is wrong in one case...

  "test round to nearest even"
  self assert: ((1<<52)+0+(1/2)) asFloat asTrueFraction = ((1<<52)+0).

This was discovered by discussion with Chris Uppal on Dolphin mailing list...
I will send new patch and new tests
 
(0008861 - 189 - 243 - 243 - 243 - 243 - 243)
nicolas cellier
01-10-07 05:44

"fix begin"
Installer mantis bug: 3568 fix: 'Kernel-Number-Fraction-asFloat-Patch.3.cs'.
"fix test"
Installer mantis bug: 3568 fix: 'Kernel-Number-Fraction-asFloat-Test.2.cs'.
"fix end"
 
(0010486 - 83 - 89 - 89 - 89 - 89 - 89)
edgardec
04-01-07 13:29

This now is 7074fix-asFloatanswers.cs and was in updates for 3.10
Thanks Nicolas !
 
(0012569 - 50 - 50 - 50 - 50 - 50 - 50)
KenCausey
09-01-08 18:27

Harvested as update 7074 and released in 3.10-7159
 

- Issue History
Date Modified Username Field Change
05-07-06 16:30 nicolas cellier New Issue
05-07-06 17:08 nicolas cellier File Added: Kernel-Number-Fraction-asFloat-Test.1.cs
05-07-06 17:09 nicolas cellier File Added: Kernel-Number-Fraction-asFloat-Patch.2.cs
07-04-06 15:40 lewis Issue Monitored: lewis
07-08-06 18:01 ducasse Status new => closed
07-08-06 18:01 ducasse Note Added: 0005628
07-08-06 18:01 ducasse Resolution open => fixed
01-10-07 05:25 nicolas cellier Status closed => feedback
01-10-07 05:25 nicolas cellier Resolution fixed => reopened
01-10-07 05:25 nicolas cellier Note Added: 0008859
01-10-07 05:33 nicolas cellier File Added: Kernel-Number-Fraction-asFloat-Patch.3.cs
01-10-07 05:40 nicolas cellier File Added: Kernel-Number-Fraction-asFloat-Test.2.cs
01-10-07 05:44 nicolas cellier Note Added: 0008861
04-01-07 13:29 edgardec Note Added: 0010486
09-01-08 18:27 KenCausey Status feedback => closed
09-01-08 18:27 KenCausey Note Added: 0012569
09-01-08 18:27 KenCausey Resolution reopened => fixed
09-01-08 18:27 KenCausey Fixed in Version  => 3.10


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
68 total queries executed.
41 unique queries executed.
Powered by Mantis Bugtracker