--- a/Float.st Mon Jul 07 17:55:51 2003 +0200
+++ b/Float.st Mon Jul 07 17:56:35 2003 +0200
@@ -947,23 +947,23 @@
fraction := fractionPart bitOr: 16r0010000000000000.
"Unbias exponent: 16r3FF is bias; 52 is fraction width"
- exp := 16r3FF + 52 - expPart.
+ exp := 16r3FF - expPart + 52.
" Form the result. When exp>52, the exponent is adjusted by
the number of trailing zero bits in the fraction to minimize
the (huge) time otherwise spent in #gcd:. "
exp negative ifTrue: [
- result := sign * fraction bitShift: exp negated
+ result := sign * (fraction bitShift: exp negated)
] ifFalse:[
zeroBitsCount := fraction lowBit - 1.
exp := exp - zeroBitsCount.
exp <= 0 ifTrue: [
zeroBitsCount := zeroBitsCount + exp.
"exp := 0." " Not needed; exp not refernced again "
- result := sign * fraction bitShift:zeroBitsCount negated
+ result := sign * (fraction bitShift:zeroBitsCount negated)
] ifFalse: [
result := Fraction
- numerator: (sign * fraction bitShift: zeroBitsCount negated)
+ numerator: (sign * (fraction bitShift: zeroBitsCount negated))
denominator: (1 bitShift:exp)
]
].
@@ -974,11 +974,11 @@
^ result
"
- 0.3 asTrueFraction
- 1.25 asTrueFraction
- 0.25 asTrueFraction
+ 0.3 asTrueFraction
+ 1.25 asTrueFraction
+ 0.25 asTrueFraction
-0.25 asTrueFraction
- 3e37 asTrueFraction
+ 3e37 asTrueFraction
Float NaN asTrueFraction
Float infinity asTrueFraction
"
@@ -2475,7 +2475,7 @@
!Float class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.148 2003-07-02 09:52:56 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.149 2003-07-07 15:56:18 cg Exp $'
! !
Float initialize!