Closed
Bug 1380031
Opened 7 years ago
Closed 5 years ago
Math.E not equal to Math.exp(1)
Categories
(Core :: JavaScript: Standard Library, defect, P3)
Tracking
()
RESOLVED
FIXED
mozilla68
People
(Reporter: scohen987, Assigned: anba)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0 Build ID: 20170628075643 Steps to reproduce: The constant Math.E (The number e) should be the same as Math.exp(1) (e^1=e), but Math.exp(1) has an extra (wrong) digit. Math.E is correct to 15 decimal places, Math.exp(1) has 16 decimal places, and the 16th digit is a 5, but the correct 16th digit would be 2. This leads to the unexpected result of Math.E being unequal to Math.exp(1) console.log(Math.E, Math.exp(1), Math.E===Math.exp(1)); Actual results: 2.718281828459045, 2.7182818284590455, false Expected results: 2.718281828459045, 2.718281828459045, true It works as expected in Google's web browser.
Updated•7 years ago
|
Component: Untriaged → JavaScript: Standard Library
Product: Firefox → Core
Assignee | ||
Comment 1•7 years ago
|
||
Interesting: https://github.com/v8/v8/blob/4a03a23565315c4558b4ba003b25c6869b8366e7/src/base/ieee754.cc#L1543-L1547
Comment 2•7 years ago
|
||
now we're using imported fdlibm's exp function, and looks like the issue doesn't happen before fdlibm (bug 933257), at least on macOS 10.12.5. we could either switch to system exp function or apply the same fix as v8.
Updated•7 years ago
|
Assignee | ||
Comment 3•7 years ago
|
||
Hmm, I think it makes sense to apply the same fix as V8 did, because that way we don't have to worry about platform differences, which could be an issue if the system exp function is used.
Updated•7 years ago
|
status-firefox57:
--- → affected
Priority: -- → P3
Comment 4•7 years ago
|
||
P3, unassigned -> fix optional for 57
Assignee | ||
Comment 5•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Assignee: nobody → andrebargull
Status: NEW → ASSIGNED
Assignee | ||
Comment 6•5 years ago
|
||
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=6d1b93f0792688a2ee8f68c13951ae53b4cff2a2
Keywords: checkin-needed
Pushed by csabou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0808c449b015
Ensure Math.exp(1) returns Math.E. r=arai
Keywords: checkin-needed
Comment 8•5 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
status-firefox68:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Comment 9•5 years ago
|
||
https://hg.mozilla.org/projects/ash/rev/0808c449b0156fc7adbdddba77f4a1d2eff11040 Bug 1380031: Ensure Math.exp(1) returns Math.E. r=arai
Updated•5 years ago
|
No longer blocks: 933257
status-firefox66:
--- → wontfix
status-firefox67:
--- → wontfix
status-firefox-esr60:
--- → wontfix
Flags: in-testsuite+
Regressed by: 933257
Updated•2 years ago
|
Has Regression Range: --- → yes
You need to log in
before you can comment on or make changes to this bug.
Description
•