Summary: | Arithmetic errors with LOG10E | ||
---|---|---|---|
Product: | WebKit | Reporter: | Jesse Costello-Good <jesse> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | ddkilzer, hortont424, sam |
Priority: | P2 | ||
Version: | 523.x (Safari 3) | ||
Hardware: | Mac | ||
OS: | OS X 10.4 | ||
URL: | javascript:alert(Math.LOG10E*Math.log(1000)) | ||
Bug Depends on: | |||
Bug Blocks: | 10489 |
Description
Jesse Costello-Good
2007-10-22 15:25:49 PDT
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! 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. This was fixed in http://trac.webkit.org/changeset/79246. |