WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
15631
Arithmetic errors with LOG10E
https://bugs.webkit.org/show_bug.cgi?id=15631
Summary
Arithmetic errors with LOG10E
Jesse Costello-Good
Reported
2007-10-22 15:25:49 PDT
The value of the following should be 3, but on Safari it is 2.9999999999999996 Math.LOG10E * Math.log(1000) This may be because Math.LOG10E is calculated too accurately. It is 0.43429448190325176 on Safari and 0.4342944819032518 on Firefox and IE. One work around is to set the value of LOG10E to 0.4342944819032518. The following evaluates to 3 on Safari: 0.4342944819032518 * Math.log(1000) This may affect other Math constants. LOG10E is the only one that I have checked.
Attachments
Add attachment
proposed patch, testcase, etc.
Timothy P. Horton
Comment 1
2009-01-12 18:39:08 PST
I don't think this is actually a calculation problem, nor a problem with the constant. Floating point representations are fundamentally flawed - not all numbers can be represented, and you will /quite/ often get strange errors like the one you described, even with very simple tests. All numbers in JavaScriptCore (as far as I know) are represented internally as double-precision floating point numbers, thus everything is susceptible to this problem. Take a peek:
http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
or, if you're really interested:
http://docs.sun.com/source/806-3568/ncg_goldberg.html
But I might be wrong. The fact that the constant is different than in FF/IE is strange, though. Actually, Mathematica agrees with FF/IE (in that LOG10E should be ~0.4342944819032518276511)... so maybe it /is/ a bug!
David Kilzer (:ddkilzer)
Comment 2
2009-05-22 10:29:44 PDT
Wolfram Alpha says it's 3.000000000000000000000000000000... <
http://www.wolframalpha.com/input/?i=Log10%5BE%5D+Log%5B1000%5D
> I still think Tibco should be rounding the result, though.
Sam Weinig
Comment 3
2011-04-01 17:53:58 PDT
This was fixed in
http://trac.webkit.org/changeset/79246
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug