Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003512 [Squeak] Kernel minor always 04-28-06 01:23 07-14-06 21:19
Reporter nicolas cellier View Status public  
Assigned To
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.9 Product Version 3.9
  Product Build
Summary 0003512: Number>>readFrom: does not handle error cases correctly
Description Number>>readFrom: when encountering a malformed number is not behaving well.

Either it does return 0.
    Number readFrom: ''.
    Number readFrom: 'foo-bar'.
Either it fails when it should not
    Number readFrom: '1e'.
    Number readFrom: '1s'.
Either it succeeds when it should not
    Number readFrom: '--1'.
Steps To Reproduce
Additional Information
Attached Files  Kernel-Number-Parser-Test.1.cs [^] (2,011 bytes) 04-28-06 02:15
 Kernel-Number-SqNumberParserV2.1.cs.gz [^] (3,792 bytes) 05-07-06 21:25

- Relationships

- Notes
(0004889 - 624 - 726 - 1104 - 1104 - 1104 - 1104)
nicolas cellier
05-07-06 21:24

[FIX]

i attach a SqNumberParser class that can fix:
- all these weird behaviours
- reading of floating point numbers (round to nearest floating point value)
- reading of -0.0 ( http://bugs.impara.de/view.php?id=3482 [^] )

First load the two patches correcting:
Integer>>asFloat http://bugs.impara.de/view.php?id=3564 [^]
and Fraction>>asFloat at http://bugs.impara.de/view.php?id=3568 [^]

TODO: branch SqNumberParser on Number>>readFrom:
TODO: add a specific NumberParserError or NumberParserException

With the patch, you cannot read '3.e-3' nor '.3e-3' anymore, but these weren't identified as proper squeak syntax...
 
(0005497 - 336 - 348 - 348 - 444 - 444 - 444)
lewis
07-04-06 15:40

This is faster and better than the current number parsing in class Number. I have provided a cleanup to the current parser in Mantis 0003993, but I really think that this NumberParser is a better approach.

These change sets can be added to the current Squeak image with no impact on the existing parser, so this would be a safe change.
 
(0005908 - 4 - 4 - 4 - 4 - 4 - 4)
MarcusDenker
07-14-06 21:19

7045
 

- Issue History
Date Modified Username Field Change
04-28-06 01:23 nicolas cellier New Issue
04-28-06 02:15 nicolas cellier File Added: Kernel-Number-Parser-Test.1.cs
05-07-06 21:24 nicolas cellier Note Added: 0004889
05-07-06 21:25 nicolas cellier File Added: Kernel-Number-SqNumberParserV2.1.cs.gz
07-04-06 15:40 lewis Note Added: 0005497
07-04-06 15:40 lewis Issue Monitored: lewis
07-14-06 21:19 MarcusDenker Status new => closed
07-14-06 21:19 MarcusDenker Note Added: 0005908
07-14-06 21:19 MarcusDenker Resolution open => fixed
07-14-06 21:19 MarcusDenker Fixed in Version  => 3.9


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
51 total queries executed.
36 unique queries executed.
Powered by Mantis Bugtracker