[bug] LargePositiveInteger asFloat: does not round correctly

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug] LargePositiveInteger asFloat: does not round correctly

Nicolas Cellier-3
Issue status update for
http://smalltalk.gnu.org/node/309
Post a follow up:
http://smalltalk.gnu.org/project/comments/add/309

 Project:      GNU Smalltalk
 Version:      <none>
 Component:    Base classes
 Category:     bug reports
 Priority:     normal
 Assigned to:  Unassigned
 Reported by:  nice
 Updated by:   nice
 Status:       active

Paolo, the simplification you made are great!
But you just swapped the lowBit test...

Example:

self assert: ((1 bitShift: 53+100) + (1 bitShift: 100) + 1) asFloatD
truncated lowBit = 102.

Number of truncated bits is 101.
Carry is 1.
Truncated mantissa candidate is even (1 bitShift: 52).
But there are other trailing bits behind the carry (self lowBit <
nTruncatedBits), so the truncated part > 0.5 ulp, so the mantissa must
be rounded upper.

Please correct.
Cheers




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [bug] LargePositiveInteger asFloat: does not round correctly

Paolo Bonzini-3
Issue status update for
http://smalltalk.gnu.org/project/issue/309
Post a follow up:
http://smalltalk.gnu.org/project/comments/add/309

 Project:      GNU Smalltalk
 Version:      <none>
 Component:    Base classes
 Category:     bug reports
 Priority:     normal
-Assigned to:  Unassigned
+Assigned to:  bonzinip
 Reported by:  nice
 Updated by:   bonzinip
 Status:       active

Also, #asFloatD/#asFloatE/#asFloatQ primitives should fail if they
cannot do rounding.




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [bug] LargePositiveInteger asFloat: does not round correctly

Paolo Bonzini-3
In reply to this post by Nicolas Cellier-3
Issue status update for
http://smalltalk.gnu.org/project/issue/309
Post a follow up:
http://smalltalk.gnu.org/project/comments/add/309

 Project:      GNU Smalltalk
 Version:      <none>
 Component:    Base classes
 Category:     bug reports
 Priority:     normal
 Assigned to:  bonzinip
 Reported by:  nice
 Updated by:   bonzinip
-Status:       active
+Status:       fixed

I'll commit the patch this evening.




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk