Closed
Bug 553799
Opened 14 years ago
Closed 14 years ago
unknown JavaScript calculate error
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: kanasimi, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-TW; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-TW; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729) When I run a script like this: var biggest_exponent_of_10=0,test_num=1; while(parseInt(test_num*=10)-1===test_num-1) biggest_exponent_of_10++; alert(biggest_exponent_of_10); It gets 308. The correct number should be 20 in a 32bit computer. Reproducible: Always Steps to Reproduce: 1. Create a file: <html><head></head><body> <script type="text/javascript"> var biggest_exponent_of_10=0,test_num=1; while(parseInt(test_num*=10)-1===test_num-1) biggest_exponent_of_10++; alert(biggest_exponent_of_10); </script> </body></html> 2. Just run it. Actual Results: It gets 308. Expected Results: The correct number should be 20 in a 32bit computer.
Comment 1•14 years ago
|
||
Javascript numbers are double-precision 64-bit format IEEE 754 on all platforms. alert(Number.MAX_VALUE) gives 1.7976931348623157e+308 - so 308 would seem right here.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•