--- a/Number.st Tue Apr 14 19:20:31 1998 +0200
+++ b/Number.st Tue Apr 14 19:25:10 1998 +0200
@@ -10,8 +10,6 @@
hereby transferred.
"
-'From Smalltalk/X, Version:3.2.1 on 25-oct-1997 at 9:24:55 pm' !
-
ArithmeticValue subclass:#Number
instanceVariableNames:''
classVariableNames:''
@@ -86,11 +84,13 @@
(nextChar == $-) ifTrue:[
negative := true.
- nextChar := str nextPeek
+ str next.
+ nextChar := str peekOrNil
] ifFalse:[
negative := false.
(nextChar == $+) ifTrue:[
- nextChar := str nextPeek
+ str next.
+ nextChar := str peekOrNil
]
].
nextChar isDigit ifFalse:[
@@ -100,7 +100,7 @@
"/ ^ value
].
value := Integer readFrom:str radix:10 onError:freakOut.
- nextChar := str peek.
+ nextChar := str peekOrNil.
((nextChar == $r) or:[ nextChar == $R]) ifTrue:[
str next.
radix := value.
@@ -109,21 +109,25 @@
radix := 10
].
(nextChar == $.) ifTrue:[
- nextChar := str nextPeek.
+ str next.
+ nextChar := str peekOrNil.
(nextChar notNil and:[nextChar isDigitRadix:radix]) ifTrue:[
value := value asFloat
+ (Number readMantissaFrom:str radix:radix).
- nextChar := str peek
+ nextChar := str peekOrNil
]
].
((nextChar == $e) or:[nextChar == $E]) ifTrue:[
- nextChar := str nextPeek.
+ str next.
+ nextChar := str peekOrNil.
signExp := 1.
(nextChar == $+) ifTrue:[
- nextChar := str nextPeek
+ str next.
+ nextChar := str peekOrNil.
] ifFalse:[
(nextChar == $-) ifTrue:[
- nextChar := str nextPeek.
+ str next.
+ nextChar := str peekOrNil.
signExp := -1
]
].
@@ -148,7 +152,7 @@
'+00000123.45' asNumber
"
- "Modified: 8.10.1996 / 19:24:01 / cg"
+ "Modified: / 14.4.1998 / 19:22:50 / cg"
!
readSmalltalkSyntaxFrom:aStream
@@ -227,13 +231,16 @@
value := 0.0.
factor := 1.0 / radix.
- nextChar := aStream peek.
+ nextChar := aStream peekOrNil.
[nextChar notNil and:[nextChar isDigitRadix:radix]] whileTrue:[
- value := value + (nextChar digitValue * factor).
- factor := factor / radix.
- nextChar := aStream nextPeek
+ value := value + (nextChar digitValue * factor).
+ factor := factor / radix.
+ aStream next.
+ nextChar := aStream peekOrNil
].
^ value
+
+ "Modified: / 14.4.1998 / 18:47:47 / cg"
! !
!Number methodsFor:'coercing'!
@@ -493,5 +500,5 @@
!Number class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Number.st,v 1.41 1997-10-28 19:12:04 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Number.st,v 1.42 1998-04-14 17:25:10 cg Exp $'
! !