Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(920)

Issue 465353002: Implement Math.expm1 using port from fdlibm. (Closed)

Created:
6 years, 4 months ago by Yang
Modified:
6 years, 4 months ago
Reviewers:
Raymond Toy
CC:
v8-dev
Project:
v8
Visibility:
Public.

Description

Implement Math.expm1 using port from fdlibm. R=rtoy@chromium.org BUG=v8:3479 LOG=N Committed: https://code.google.com/p/v8/source/detail?r=23238

Patch Set 1 #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+269 lines, -48 lines) Patch
M src/math.js View 2 chunks +2 lines, -22 lines 0 comments Download
M test/mjsunit/es6/math-expm1.js View 2 chunks +48 lines, -8 lines 3 comments Download
M third_party/fdlibm/LICENSE View 1 chunk +1 line, -1 line 0 comments Download
M third_party/fdlibm/fdlibm.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/fdlibm/fdlibm.cc View 2 chunks +11 lines, -4 lines 0 comments Download
M third_party/fdlibm/fdlibm.js View 5 chunks +205 lines, -11 lines 4 comments Download
M tools/generate-runtime-tests.py View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 6 (0 generated)
Yang
6 years, 4 months ago (2014-08-13 13:33:19 UTC) #1
Yang
On 2014/08/13 13:33:19, Yang wrote: Title was wrong. Fixed.
6 years, 4 months ago (2014-08-13 13:37:53 UTC) #2
Raymond Toy
LGTM Just a few nits. https://codereview.chromium.org/465353002/diff/1/test/mjsunit/es6/math-expm1.js File test/mjsunit/es6/math-expm1.js (right): https://codereview.chromium.org/465353002/diff/1/test/mjsunit/es6/math-expm1.js#newcode24 test/mjsunit/es6/math-expm1.js:24: } For an additional ...
6 years, 4 months ago (2014-08-13 16:25:17 UTC) #3
Yang
https://codereview.chromium.org/465353002/diff/1/test/mjsunit/es6/math-expm1.js File test/mjsunit/es6/math-expm1.js (right): https://codereview.chromium.org/465353002/diff/1/test/mjsunit/es6/math-expm1.js#newcode24 test/mjsunit/es6/math-expm1.js:24: } On 2014/08/13 16:25:17, Raymond Toy wrote: > For ...
6 years, 4 months ago (2014-08-20 14:18:24 UTC) #4
Yang
Committed patchset #1 manually as 23238 (presubmit successful).
6 years, 4 months ago (2014-08-20 14:24:18 UTC) #5
Raymond Toy
6 years, 4 months ago (2014-08-20 16:18:20 UTC) #6
Message was sent while issue was closed.
https://codereview.chromium.org/465353002/diff/1/test/mjsunit/es6/math-expm1.js
File test/mjsunit/es6/math-expm1.js (right):

https://codereview.chromium.org/465353002/diff/1/test/mjsunit/es6/math-expm1....
test/mjsunit/es6/math-expm1.js:24: }
On 2014/08/20 14:18:24, Yang wrote:
> On 2014/08/13 16:25:17, Raymond Toy wrote:
> > For an additional sanity check, why not use the mathematical property that
> > expm1(n*log(2)) = exp(n*log(2)) - 1 = 2^n - 1? For simplicity, just use
> integer
> > n. For bonus points allow n = m/2 for integer m.  This only requires
computing
> > sqrt(2). Or perhaps Math.pow is accurate to < 1 ulp?
> > 
> > The above sanity check would fail if exp(x) is wrong, and we know that
exp(x)
> is
> > (now) less accurate than expm1.
> 
> I like the suggestion. However, n*Math.LN2 is less precise than it should be,
so
> I would have to use an assertEqualsDelta with expected*1E-14 as delta, which
> makes this rather pointless.

It has the great advantage that the test is independent of the implementation of
Math.exp and has analytically correct results.  Yes, n*Math.LN2 is not quite the
same as n*log(2), but that's life with floating-point.

https://codereview.chromium.org/465353002/diff/1/third_party/fdlibm/fdlibm.js
File third_party/fdlibm/fdlibm.js (right):

https://codereview.chromium.org/465353002/diff/1/third_party/fdlibm/fdlibm.js...
third_party/fdlibm/fdlibm.js:513: (KLOG1P(4) + z * (KLOG1P(5) + z *
KLOG1P(6)))))));
On 2014/08/20 14:18:24, Yang wrote:
> On 2014/08/13 16:25:17, Raymond Toy wrote:
> > This seems unrelated to expm1. And I can't see what actually changed here..
> 
> it used to be KLOGP1. I realized that it should be KLOG1P instead. I thought I
> could piggyback this small change here.

Sounds good. Sorry I missed that in the review of the log1p function.

Powered by Google App Engine
This is Rietveld 408576698