archives

« Bugzilla Issues Index

#3688 — 18.2.4 parseFloat, 18.2.5 parseInt: Handle zero before applying "Number value for"


18.2.4 parseFloat (string)
18.2.5 parseInt (string , radix)

From 6.1.6 The Number Type:

> In this specification, the phrase “the Number value for x” where
> x represents an exact nonzero real mathematical quantity [...]

The mathematical value in parseFloat and parseInt can be zero, so additional steps like in 7.1.3.1.1 Runtime Semantics: MV’s and in 11.8.3.1 Static Semantics: MV’s need to be added to parse{Float, Int}.

18.2.4 parseFloat:
---
6. Let mathFloat be the MV of numberString.
7. If mathFloat is 0, then
a. If the first code unit in trimmedString is '-', return -0.
b. Return +0.
8. Return the Number value for mathFloat.
---

18.2.5 parseInt:
---
16. If mathInt is 0, then
a. If sign is -1, return -0.
b. Return +0.
18. Let number be the Number value for mathInt.
19. Return sign x number.
---


ES1 bug - huzzah! ;-)


fixed in rev32 editor's draft


fixed in rev32 draft