Mantis - Squeak
Viewing Issue Advanced Details
6782 Collections major always 11-23-07 22:38 04-18-10 22:05
nicolas cellier  
andreas  
normal  
closed 3.10  
fixed  
none    
none trunk  
0006782: 1.0 / (FloatArray with: 2.0) unexpected result
Try:
  1.0 / (FloatArray with: 2.0)
Answer is?
(FloatArray with: 2.0)

Hem...
bug is in FloatArray>>adaptToNumber:andSend:
 FloatArray-adapt-M6782-Test.1.cs [^] (725 bytes) 11-23-07 23:04
 FloatArray-adapt-M6782-Patch.1.cs [^] (958 bytes) 11-23-07 23:04

Notes
(0011454)
nicolas cellier   
11-23-07 22:39   
Oops, Ken twice sorry, this one for Collection...
(0011455)
nicolas cellier   
11-23-07 23:03   
Obvious patch is:
    selector == #/ ifTrue:[^self reciprocal * rcvr].

However, this is bad, because of gradual underflow:
self reciprocal can give Infinity, while result is computable.

For example:
self should:
    (1.0e-39 / (FloatArray with: 1.0e-39)) first < 2
(0011559)
Keith_Hodges   
12-17-07 16:39   
"fix begin"
Installer mantis bug: 6782 fix:'FloatArray-adapt-M6782-Patch.1.cs'.
"fix test"
Installer mantis bug: 6782 fix:'FloatArray-adapt-M6782-Test.1.cs'.
"fix end"

(0013264)
nicolas cellier   
08-24-09 20:03   
Fixed in http://source.squeak.org/trunk/Collections-nice.107.mcz [^]