Anonymous | Login | 04-12-2021 17:03 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
0006982 | [Squeak] Kernel | minor | always | 03-14-08 22:31 | 04-18-10 21:58 | ||||
Reporter | nicolas cellier | View Status | public | ||||||
Assigned To | nicolas cellier | ||||||||
Priority | normal | Resolution | fixed | ||||||
Status | closed | Product Version | 3.10 | ||||||
Summary | 0006982: Number>>readFrom: does not handle many digits correctly | ||||||||
Description |
It incorrectly answer an Infinity or even a NaN in some cases: | s1 s2 | s1 := '0.' , (String new: 320 withAll: $0) , '1e321'. s2 := '1' , (String new: 321 withAll: $0) , '.0e321'. self assert: (Number readFrom: s1) = 1. self assert: (Number readFrom: s2) = 1. "First is Infinity, second is NaN..." self assert: (SqNumberParser readFrom: s1) = 1. self assert: (SqNumberParser readFrom: s2) = 1. It seems it would be time to connect SqNumberParser... Beside, SqNumberParser answer nearest Float. |
||||||||
Additional Information | |||||||||
Attached Files |
![]() ![]() ![]() ![]() |
||||||||
|
![]() |
|
(0011922 - 362 - 416 - 416 - 416 - 416 - 416) nicolas cellier 03-14-08 22:34 |
Hem, i'm just bad at copy/paste game... correct test is below: | s1 s2 | s1 := '1' , (String new: 321 withAll: $0) , '.0e-321'. s2 := '0.' , (String new: 320 withAll: $0) , '1e321'. self assert: (Number readFrom: s1) = 1. self assert: (Number readFrom: s2) = 1. self assert: (SqNumberParser parse: s1) = 1. self assert: (SqNumberParser parse: s2) = 1. |
(0011925 - 248 - 272 - 272 - 659 - 659 - 659) nicolas cellier 03-15-08 00:16 |
Beware, the patch is not compatible with the old behaviour of answering 0 when there is no digit. It raise an Error instead. Use (Number readFrom aStream ifFail: [0]) explicitely if interested in this feature. See also 0003512 0006779 0006976 0003712 |
(0011928 - 325 - 419 - 419 - 419 - 419 - 419) nicolas cellier 03-15-08 21:56 |
If Number readFrom: is modified to use SqNumberParser, then the constant used to initialize MaxVal is too high, and leads to an Infinity if recompiled. So here comes patch Float-initialize-Patch-M6982-nice.1.cs new and old values are respectively: MaxVal _ 1.7976931348623157e308. MaxVal _ 1.7976931348623159e308. |
(0012163 - 271 - 331 - 331 - 331 - 331 - 331) nicolas cellier 05-25-08 18:38 |
"fix begin" Installer mantis bug: 6982 fix:'Float-readFromManyDigits-Patch-M6982-nice.1.cs'. Installer mantis bug: 6982 fix:'Float-initialize-Patch-M6982-nice.1.cs'. "fix test" Installer mantis bug: 6982 fix:'Float-readFromManyDigits-Test-M6982-nice.1.cs'. "fix end" |
(0012543 - 308 - 386 - 386 - 386 - 386 - 386) nicolas cellier 08-29-08 20:13 edited on: 08-31-08 00:33 |
"fix begin" Installer mantis ensureFix: 7169. Installer mantis bug: 6982 fix:'Float-readFromManyDigits-Patch-M6982-nice.1.cs'. Installer mantis bug: 6982 fix:'Float-initialize-Patch-M6982-nice.2.cs'. "fix test" Installer mantis bug: 6982 fix:'Float-readFromManyDigits-Test-M6982-nice.1.cs'. "fix end" |
(0012554 - 261 - 349 - 349 - 349 - 349 - 349) nicolas cellier 08-31-08 00:36 |
There was a stupid bug instVar = ... instead of instVar := ... in Float-readFromManyDigits-Patch-M6982-nice.1.cs Rather use Float-readFromManyDigits-Patch-M6982-nice.2.cs instead. He, the leftArrow would be welcome to avoid this kind of typo. |
(0013509 - 114 - 120 - 430 - 430 - 430 - 430) nicolas cellier 02-13-10 02:06 |
in http://source.squeak.org/trunk/Kernel-nice.396.mcz [^] and http://source.squeak.org/trunk/KernelTests-nice.131.mcz [^] |
Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
78 total queries executed. 48 unique queries executed. |