ShortFloat.st
changeset 4637 814b3d8e3f72
parent 4615 e480d1e6090f
child 4825 4c77d43433d1
--- a/ShortFloat.st	Thu Aug 26 12:16:54 1999 +0200
+++ b/ShortFloat.st	Thu Aug 26 12:18:21 1999 +0200
@@ -201,6 +201,28 @@
 
 !
 
+readFrom:aStringOrStream
+    "read a shortFloat from a string"
+
+    |num|
+
+    num := super readFrom:aStringOrStream onError:[self error:'conversion error for: ' , self name].
+    num notNil ifTrue:[  
+        num := num asShortFloat
+    ].
+    ^ num 
+
+    "
+     ShortFloat readFrom:'0.1'
+     ShortFloat readFrom:'0'    
+     ShortFloat readFrom:'.123' 
+     ShortFloat readFrom:'-.123'   
+     ShortFloat readFrom:'1e4'  
+    "
+
+    "Modified: / 7.1.1998 / 16:17:59 / cg"
+!
+
 readFrom:aStringOrStream onError:exceptionBlock
     "read a shortFloat from a string"
 
@@ -208,13 +230,14 @@
 
     num := super readFrom:aStringOrStream onError:nil.
     num isNil ifTrue:[  
-	^ exceptionBlock value
+        ^ exceptionBlock value
     ].
     ^ num asShortFloat
 
     "
      ShortFloat readFrom:'0.1'
      ShortFloat readFrom:'0'
+     ShortFloat readFrom:'.123'
     "
 
     "Modified: / 7.1.1998 / 16:17:59 / cg"
@@ -964,5 +987,5 @@
 !ShortFloat class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ShortFloat.st,v 1.52 1999-08-19 01:19:54 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ShortFloat.st,v 1.53 1999-08-26 10:17:59 cg Exp $'
 ! !