--- a/Number.st Tue Feb 20 20:31:08 1996 +0100
+++ b/Number.st Tue Feb 20 20:35:01 1996 +0100
@@ -11,10 +11,10 @@
"
ArithmeticValue subclass:#Number
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- category:'Magnitude-Numbers'
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Magnitude-Numbers'
!
!Number class methodsFor:'documentation'!
@@ -50,67 +50,67 @@
str := aStringOrStream readStream.
- Object errorSignal handle:[:ex |
- ^ exceptionBlock value
+ ErrorSignal handle:[:ex |
+ ^ exceptionBlock value
] do:[
- nextChar := str skipSeparators.
- nextChar isNil ifTrue:[^ exceptionBlock value].
+ nextChar := str skipSeparators.
+ nextChar isNil ifTrue:[^ exceptionBlock value].
- freakOut := [^ exceptionBlock value].
+ freakOut := [^ exceptionBlock value].
- (nextChar == $-) ifTrue:[
- negative := true.
- nextChar := str nextPeek
- ] ifFalse:[
- negative := false.
- (nextChar == $+) ifTrue:[
- nextChar := str nextPeek
- ]
- ].
- nextChar isDigit ifFalse:[
- ^ exceptionBlock value.
+ (nextChar == $-) ifTrue:[
+ negative := true.
+ nextChar := str nextPeek
+ ] ifFalse:[
+ negative := false.
+ (nextChar == $+) ifTrue:[
+ nextChar := str nextPeek
+ ]
+ ].
+ nextChar isDigit ifFalse:[
+ ^ exceptionBlock value.
"/ value := super readFrom:str.
"/ negative ifTrue:[value := value negated].
"/ ^ value
- ].
- value := Integer readFrom:str radix:10 onError:freakOut.
- nextChar := str peek.
- ((nextChar == $r) or:[ nextChar == $R]) ifTrue:[
- str next.
- radix := value.
- value := Integer readFrom:str radix:radix onError:freakOut.
- ] ifFalse:[
- radix := 10
- ].
- (nextChar == $.) ifTrue:[
- nextChar := str nextPeek.
- (nextChar notNil and:[nextChar isDigitRadix:radix]) ifTrue:[
- value := value asFloat
- + (Number readMantissaFrom:str radix:radix).
- nextChar := str peek
- ]
- ].
- ((nextChar == $e) or:[nextChar == $E]) ifTrue:[
- nextChar := str nextPeek.
- signExp := 1.
- (nextChar == $+) ifTrue:[
- nextChar := str nextPeek
- ] ifFalse:[
- (nextChar == $-) ifTrue:[
- nextChar := str nextPeek.
- signExp := -1
- ]
- ].
- (nextChar notNil and:[(nextChar isDigitRadix:radix)]) ifTrue:[
- value := value asFloat
- * (10.0 raisedToInteger:
- ((Integer readFrom:str radix:radix onError:freakOut) * signExp))
- ]
- ].
- negative ifTrue:[
- ^ value negated
- ].
- ^ value
+ ].
+ value := Integer readFrom:str radix:10 onError:freakOut.
+ nextChar := str peek.
+ ((nextChar == $r) or:[ nextChar == $R]) ifTrue:[
+ str next.
+ radix := value.
+ value := Integer readFrom:str radix:radix onError:freakOut.
+ ] ifFalse:[
+ radix := 10
+ ].
+ (nextChar == $.) ifTrue:[
+ nextChar := str nextPeek.
+ (nextChar notNil and:[nextChar isDigitRadix:radix]) ifTrue:[
+ value := value asFloat
+ + (Number readMantissaFrom:str radix:radix).
+ nextChar := str peek
+ ]
+ ].
+ ((nextChar == $e) or:[nextChar == $E]) ifTrue:[
+ nextChar := str nextPeek.
+ signExp := 1.
+ (nextChar == $+) ifTrue:[
+ nextChar := str nextPeek
+ ] ifFalse:[
+ (nextChar == $-) ifTrue:[
+ nextChar := str nextPeek.
+ signExp := -1
+ ]
+ ].
+ (nextChar notNil and:[(nextChar isDigitRadix:radix)]) ifTrue:[
+ value := value asFloat
+ * (10.0 raisedToInteger:
+ ((Integer readFrom:str radix:radix onError:freakOut) * signExp))
+ ]
+ ].
+ negative ifTrue:[
+ ^ value negated
+ ].
+ ^ value
]
"
@@ -122,7 +122,7 @@
'+00000123.45' asNumber
"
- "Modified: 16.11.1995 / 22:49:04 / cg"
+ "Modified: 20.2.1996 / 20:24:19 / cg"
!
readSmalltalkSyntaxFrom:aStream
@@ -480,5 +480,5 @@
!Number class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Number.st,v 1.26 1996-02-01 19:43:54 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Number.st,v 1.27 1996-02-20 19:34:33 cg Exp $'
! !