Closed
Bug 92243
Opened 24 years ago
Closed 22 years ago
Weird Floating point calculation problem in JavaScript
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
VERIFIED
WORKSFORME
Future
People
(Reporter: haakon, Assigned: khanson)
Details
Attachments
(1 file)
|
914 bytes,
text/html
|
Details |
Operating environment:
Mozilla version 0.9.2 (Tested using galeon front-end and embedded mozilla
engine) both compiled from CVS mozilla using tag MOZILLA_0_9_2_RELEASE,
using glibc 2.2.3, gcc-3.0 (clean release versions, not pre-release nor patched)
on a linux 2.4.4 i686 box.
TestCase:
--
<FORM NAME="testForm">
<INPUT TYPE="text" NAME="test" VALUE="0" SIZE=20>
</FORM>
<SCRIPT>
document.testForm.test.value = 200.1 - 80;
</SCRIPT>
--
Expected result:
the value in input text-box should read 120.1
Actual results:
The value in the input -field is "<0.1" not "120.1" after running the code. At
one time, (restarted galeon from scratch) I actually got the correct value, but
reloading the page gave me the incorrect value, so this error may not always be
consistent. entering a calculation of 200.1 - 70 works, giving 130.1 as result.
200.1 - 90 gives ";0.1"
200 - 90 gives correct answer 130.
also
20.1 + 90 gives ";0.1" and not 120.1
The testcode runs fine on netscape communicator 4.7 for linux.
Regards, Håkon Innerdal
| Reporter | ||
Comment 1•24 years ago
|
||
This problem doesn't occur on RedHat 7.0 and pre built mozilla 0.9.2. 2001062823
The problem _may_ be related to either gcc-3.0 or glibc-2.2.3... or galeon.
Comment 2•24 years ago
|
||
Assigning to khanson, cc'ing dbaron to see if either can reproduce this.
I have not been able to so far -
Assignee: rogerl → khanson
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 3•24 years ago
|
||
Comment 4•24 years ago
|
||
wfm Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.6+) Gecko/20011123
Comment 6•24 years ago
|
||
"wfm" === "Worksforme"
Comment 7•24 years ago
|
||
Here are my versions of Linux and gcc, that WORKFORME:
[] uname -a
Linux attica 2.2.12-20smp #1 SMP Mon Sep 27 10:34:45 EDT 1999 i686 unknown
[] gcc -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/specs
gcc version 2.95.3 20010315 (release)
| Assignee | ||
Comment 8•24 years ago
|
||
Targeting for the future. I need to reproduce the error.
Target Milestone: --- → Future
Comment 9•22 years ago
|
||
I have a simular bug
running the following code: alert(217728000000);
outputs "217727:00000"
on mozilla 1.2 win2000
Comment 10•22 years ago
|
||
Philip: thanks for the info. The bug you are finding with
Mozilla 1.2 Win2000 has recently been fixed: see bug 140852,
"String(819187200000) == '8191871:0000' in xpcshell, browser".
Håkon: that makes me wonder - with a current trunk build, are you
still getting the bug you reported above? Or is that now fixed, too?
Comment 11•22 years ago
|
||
there is no xpcshell command in my version (offical release)
but alert(819187200000); in the javascript console gives me a value with ':'
var x = 819187200000;
alert(x); --> error
alert(x.toFixed()); --> ok
// note all the other number to string functions/methods that i tried
// have this bug
| Reporter | ||
Comment 12•22 years ago
|
||
I have been unable to reproduce the bug on my current setup:
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3a) Gecko/20030207 <developer build>
compiled with gcc3.2
So I assume the bug has been fixed, at least for my testcase reported initially.
Comment 13•22 years ago
|
||
Based on Håkon's findings, I'm going to mark this bug as WORKSFORME.
Philip: you don't get that error with an up-to-date build, do you?
I would expect you to see it with your version 1.2 build:
var x = 819187200000;
alert(x); --> error
Bug 140852 was only fixed on the trunk on 2003-02-17, so only builds
after that date will work correctly. Can you try that? The Mozilla
version number in Help > About Mozilla should be 1.4. Thanks -
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → WORKSFORME
Comment 14•22 years ago
|
||
Marking Verified.
Philip - please reopen this bug if you still see the error with
an up-to-date build; thanks -
Status: RESOLVED → VERIFIED
Comment 15•22 years ago
|
||
indeed the bug appears to be solved in the latest build
;)
You need to log in
before you can comment on or make changes to this bug.
Description
•