#FEATURE by exept
class: Number class
changed: #readFrom:decimalPointCharacters:thousandsSeparator:allowCStyle:onError:
--- a/Number.st Sat Dec 07 17:59:21 2019 +0100
+++ b/Number.st Sun Dec 08 04:10:14 2019 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1988 by Claus Gittinger
All Rights Reserved
@@ -430,7 +428,7 @@
it allows for prefixed + and also allows missing fractional part after eE.
It supports 0x, 0o and 0b prefixes (hex, octal and binary)
and the regular Smalltalk radix prefix xr.
- If also allows for strings like '1.0×1015' to be read (as 1E+15).
+ If also allows for strings like '1.0×1015' to be read (as 1E+15).
It also allows garbage after the number - i.e. it reads what it can.
See #fromString: , which is more strict and does not allow garbage at the end.
@@ -546,7 +544,7 @@
it allows for prefixed + and also allows missing fractional part after eE.
It supports 0x, 0o and 0b prefixes (hex, octal and binary)
and the regular Smalltalk radix prefix xr.
- If also allows for strings like '1.0×1015' to be read (as 1E+15).
+ If also allows for strings like '1.0×1015' to be read (as 1E+15).
It also allows garbage after the number - i.e. it reads what it can.
See #fromString: , which is more strict and does not allow garbage at the end.
@@ -743,7 +741,7 @@
scale:(scale ? mantissaAndScale third).
].
] ifFalse:[
- (nextChar == $×) ifTrue:[
+ (nextChar == $×) ifTrue:[
(((nextChar := str nextPeek) == $1)
and:[ ((nextChar := str nextPeek) == $0) ]
) ifTrue:[
@@ -757,7 +755,9 @@
(self inheritsFrom:LimitedPrecisionReal) ifTrue:[
"when requesting a specific Float instance, coerce it.
otherwise return a value without loosing precision"
- value := self coerce:value.
+ (self isAbstract not and:[value class == self]) ifFalse:[
+ value := self coerce:value.
+ ].
].
].
].
@@ -983,7 +983,6 @@
"Modified (comment): / 08-06-2017 / 13:58:36 / mawalch"
! !
-
!Number class methodsFor:'constants'!
e
@@ -1394,7 +1393,6 @@
"Modified: / 25-07-2017 / 15:58:46 / cg"
! !
-
!Number methodsFor:'coercing & converting'!
i
@@ -2359,6 +2357,10 @@
^ self
! !
+
+
+
+
!Number methodsFor:'printing & storing'!
displayOn:aGCOrStream