Closed
Bug 43425
Opened 24 years ago
Closed 24 years ago
parseInt ERROR with leading zeros (08 and 09 give incorrect values)
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
VERIFIED
INVALID
People
(Reporter: Lanivdw, Assigned: rogerl)
References
Details
From Bugzilla Helper: User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt) BuildID: 2000033112 parseInt give the wrong result for "08" and "09". Reproducible: Always Steps to Reproduce: 1.Use of parseInt Function 2. Wrong Result only if 08 and 09 is the input value 3. Actual Results: Alert Box: 0 Expected Results: Alert Box: 8 <HTML> <HEAD> <TITLE> TEST</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF"> <Script language="JAVASCRIPT"> alert(parseInt("07")); alert(parseInt("08")); alert(parseInt("09")); </Script> </BODY> </HTML>
Confirming. Changing Platform and OS to ALL as also a bug on Mac OS 8.6/ 2000061411.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 98 → All
Hardware: PC → All
I can comfirm that this bug is on 1. NetScape6 PR1 (Win98 OS & MAC OS 8.6) >>>> (Thanx to qaz2@usa.net for Testing done on MAC OS 8.6) 2. Netscape4.73 (Win98 OS) 3. IE 5 (Win 98 OS) Regards Lani van der Walt E-Mail: Lanivdw@bigfoot.com URL: www.lani.co.za
Comment 3•24 years ago
|
||
Sorry for the delay - taking over QA for the JavaScript Engine group - I'm afraid I have to mark this as invalid. The ParseInt() function treats a first argument beginning with "0" as an octal number, not base 10. Thus, the only valid digits for numbers beginning with "0" would be 0-7. A good reference for the parseInt() function is page 186 of the following: "Javascript: The Definitive Guide (Third Edition), by David Flanagan (O'Reilly 1998) Notice that parseInt() also accepts a second argument, which you can use to specify the base you want to use. Using this, parseInt("08", 10) = 8 parseInt("09", 10) = 9
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → INVALID
Comment 4•22 years ago
|
||
*** Bug 181017 has been marked as a duplicate of this bug. ***
Comment 5•21 years ago
|
||
*** Bug 220523 has been marked as a duplicate of this bug. ***
*** Bug 235606 has been marked as a duplicate of this bug. ***
Comment 7•20 years ago
|
||
*** Bug 270169 has been marked as a duplicate of this bug. ***
Updated•20 years ago
|
Status: RESOLVED → VERIFIED
Updated•20 years ago
|
URL: -
Priority: P3 → --
Summary: parseInt ERROR. 08 and 09 chars gives a incorrect value back. → parseInt ERROR with leading zeros (08 and 09 give incorrect values)
Comment 8•19 years ago
|
||
*** Bug 307182 has been marked as a duplicate of this bug. ***
Comment 9•19 years ago
|
||
*** Bug 237268 has been marked as a duplicate of this bug. ***
Comment 10•18 years ago
|
||
*** Bug 337255 has been marked as a duplicate of this bug. ***
You need to log in
before you can comment on or make changes to this bug.
Description
•