[BUG][FIX]numbers in scientific notation with capital E are not handled correctly

Baveco, Hans Hans.Baveco at wur.nl
Wed Dec 1 09:15:33 UTC 2004


I have often been bit by this feature of squeak. '1234.123E-5' asNumber produces 1234.123 because the exponent part is ignored. Some numeric software produces output in this format, and reading datafiles from such programs may lead to very hard to trace anomalies (especially when scientific notation is only used for some of the numbers). A simple one-liner change in Number>>readRemainderOf:from:base:withSign: seems sufficient to handle capital E, see attached fileout. 

I changed "peekChar = $e | (peekChar = $d) | (peekChar = $q)"

to "((((peekChar == $e) or: [peekChar == $E]) or: [peekChar == $d]) or: [peekChar == $q])" 

(I compensated for the extra check by replacing the bars by blocks).

I can't imagine there are any unwelcome side-effects associated with this change?

====================================
Hans Baveco

 <<Number class-readRemainderOffrombasewithSign.st>> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Number class-readRemainderOffrombasewithSign.st
Type: application/octet-stream
Size: 2019 bytes
Desc: Number class-readRemainderOffrombasewithSign.st
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20041201/30386024/Numberclass-readRemainderOffrombasewithSign.obj


More information about the Squeak-dev mailing list