2009/9/24 Â <csrabak@bol.com.br>:
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"
As far as I know, this never answered 100.0 in Squeak. It does not work either in VW, but works in Dolphin.
'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'
I attach a little refactoring: Abstract class : NumberParser Concrete Subclasses : FORTRANNumberParser SqNumberParser Of course, the FORTRANNumberParser would not parse (1.0e+2) but only (1.0E+2) So this is just an example. I guess you aim an ExtendedNumberParser... Nicolas
Em 24/09/2009 17:36, John M McIntosh < johnmci@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'
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project