Math.E not equal to Math.exp(1)

NEW
Unassigned

Status

()

P3
normal
a year ago
11 months ago

People

(Reporter: scohen987, Unassigned)

Tracking

({regression})

54 Branch
regression
Points:
---

Firefox Tracking Flags

(firefox57 fix-optional)

Details

(Reporter)

Description

a year ago
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.
Component: Untriaged → JavaScript: Standard Library
Product: Firefox → Core
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.
Blocks: 933257
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
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.
status-firefox57: --- → affected
Priority: -- → P3

Comment 4

11 months ago
P3, unassigned -> fix optional for 57
status-firefox57: affected → fix-optional
You need to log in before you can comment on or make changes to this bug.