[Pharo-project] '.2e2' asNumber?

csrabak at bol.com.br csrabak at bol.com.br
Thu Sep 24 17:40:44 EDT 2009


Can we add some more (in the Pharo's spirit of getting at a better Smalltalk):

'1.0e+2' "now returns 1.0 although for simmetry should return 100.0"

'1E2'    "now returns 1, however a lot of applications (like
spreadsheets, Fortran printouts) when saving to text use the capital
letter for the exponential part".

By the same reason:

'1.0E2'

'1E-2'

'1E+2'


Em 24/09/2009 17:36, John M McIntosh < johnmci at smalltalkconsulting.com > escreveu:


> Ok, well I'm going to go away and build a test suite to check for all
> combos of
> '.'
> '1.'
> '1.2'
> '.e'
> '1.e'
> '1.2e'
> '1.2e3'
> '-1.e'
> '-1.2e-3'
> 
> so we can at least agree on what a valid number is.
> 
> 
> On 2009-09-24, at 6:57 AM, Nicolas Cellier wrote:
> > SqNumberParser>>fail
> > failBlock isNil ifFalse: [^failBlock value].
> > self error: 'Reading a number failed'
> >





More information about the Pharo-dev mailing list