fixed conversion from string to not loose precision which is later
authorClaus Gittinger <cg@exept.de>
Tue, 17 Jun 2003 13:50:24 +0200
changeset 7388 bb89a53e2682
parent 7387 9be7990ded99
child 7389 4fd487ca919a
fixed conversion from string to not loose precision which is later needed (when the type is known)
Number.st
--- a/Number.st	Tue Jun 17 13:49:36 2003 +0200
+++ b/Number.st	Tue Jun 17 13:50:24 2003 +0200
@@ -347,10 +347,11 @@
      No whitespace is skipped.
      Errs if no number is available on aStream."
 
-    |nextChar value factor intMantissa scale|
+    |nextChar value factor intMantissa scale highPrecision|
 
+    highPrecision := false.
     value := 0.0.
-    factor := 1.0 / radix.
+    factor := 1.0 asLongFloat / radix.
     scale := 0.
     intMantissa := 0.
     nextChar := aStream peekOrNil.
@@ -359,12 +360,10 @@
         intMantissa := (intMantissa * radix) + nextChar digitValue.
         factor := factor / radix.
         scale := scale + 1.
-        factor < (Float epsilon * 2) ifTrue:[
-            value := value asLongFloat
-        ].
         aStream next.
         nextChar := aStream peekOrNil
     ].
+
     ^ (Array with:value with:intMantissa with:scale).
 
     "
@@ -606,6 +605,11 @@
     "interpreting the receiver as radians, return the degrees"
 
     ^ (self * (Float pi)) / 180.0
+
+    "
+     180 degreesToRadians
+     Float pi radiansToDegrees
+    "
 !
 
 literalArrayEncoding
@@ -622,6 +626,11 @@
     "interpreting the receiver as degrees, return the radians"
 
     ^ (self * 180.0) / (Float pi)
+
+    "
+     180 degreesToRadians     
+     Float pi radiansToDegrees
+    "
 !
 
 withScale:newScale
@@ -895,5 +904,5 @@
 !Number class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Number.st,v 1.82 2003-06-16 09:17:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Number.st,v 1.83 2003-06-17 11:50:24 cg Exp $'
 ! !