New issue
Advanced search Search tips

Issue 3509 link

Starred by 5 users

Issue metadata

Status: Fixed
Owner:
Closed: Jul 2016
Cc:
Components:
HW: All
NextAction: ----
OS: All
Priority: 1
Type: Bug

Blocking:
issue 5086



Sign in to add a comment

Math.acosh issues

Project Member Reported by rtoy@chromium.org, Aug 12 2014

Issue description

Here are some issues with Math.acosh.

This provides a bit more detail than the info in https://code.google.com/p/v8/issues/detail?id=3266.

Math.acosh(1+1e-10) -> 0.000014142136208733941

The correct answer is 1.4142136208675862d-5.

Math.acosh(1.79e308) -> Infinity

The correct answer is about 710.4758.

 

Comment 1 by rtoy@chromium.org, Aug 12 2014

For large x, acosh(x) = log(x+sqrt(x^2-1)) ~ log(2*x) = log(2) + log(x). This holds for x such that x^2 - 1 = x^2, or x^2 > 2^53 or x ~> 9.49e7.

Getting accurate values for x near 1 seems a bit more difficult.

Comment 2 by rtoy@chromium.org, Aug 12 2014

Actually fdlibm uses the following:

1 < x < 2:
acosh(x) = log1p(t + sqrt(2*t+t*t)), where t = x - 1.

2 < x < 2^28
acosh(x) = log(2x-1/(sqrt(x*x-1)+x))

2^28 < x:
acosh(x) = log(2) + log(x)

Comment 3 by rtoy@chromium.org, Aug 13 2014

See www/V8/acosh.js for a port of fdlibm's acosh.  acosh-tests.js contains the tests that are run by www/V8/test-acosh.html.

Comment 4 by rtoy@chromium.org, Aug 19 2014

Oops. The correct links are www/~rtoy/V8/acosh.js, www/~rtoy/V8/acosh-tests.js and www/~rtoy/V8/test-acosh.html

Owner: yangguo@chromium.org
Labels: Type-Bug Area-Runtime Priority-Medium
Status: Assigned
Blocking: 5086
Cc: mvstan...@chromium.org yangguo@chromium.org
Components: Compiler
Labels: Hotlist-Fixit-PE2016 HelpWanted TurboFan HW-All OS-All Priority-High
Owner: bmeu...@chromium.org
Project Member

Comment 8 by bugdroid1@chromium.org, Jul 1 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/0a0fe8fb8b06d5e90b082838739ebf44cab04028

commit 0a0fe8fb8b06d5e90b082838739ebf44cab04028
Author: bmeurer <bmeurer@chromium.org>
Date: Fri Jul 01 11:11:33 2016

[builtins] Unify most of the remaining Math builtins.

Import fdlibm versions of acos, acosh, asin and asinh, which are more
precise and produce the same result across platforms (we were using
libm versions for asin and acos so far, where both speed and precision
depended on the operating system so far). Introduce appropriate TurboFan
operators for these functions and use them both for inlining and for the
generic builtin.

Also migrate the Math.imul and Math.fround builtins to TurboFan builtins
to ensure that their behavior is always exactly the same as the inlined
TurboFan version (i.e. C++ truncation semantics for double to float
don't necessarily meet the JavaScript semantics).

For completeness, also migrate Math.sign, which can even get some nice
love in TurboFan.

Drive-by-fix: Some alpha-sorting on the Math related functions, and
cleanup the list of Math intrinsics that we have to export via the
native context currently.

BUG= v8:3266 , v8:3496 , v8:3509 , v8:3952 , v8:5169 , v8:5170 , v8:5171 , v8:5172 
TBR=rossberg@chromium.org
R=franzih@chromium.org

Review-Url: https://codereview.chromium.org/2116753002
Cr-Commit-Position: refs/heads/master@{#37476}

[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/assembler.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/assembler.h
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/base/ieee754.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/base/ieee754.h
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/bootstrapper.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/builtins.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/builtins.h
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/arm/code-generator-arm.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/arm64/code-generator-arm64.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/code-assembler.h
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/ia32/code-generator-ia32.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/instruction-codes.h
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/instruction-scheduler.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/instruction-selector.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/js-builtin-reducer.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/js-builtin-reducer.h
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/machine-operator-reducer.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/machine-operator.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/machine-operator.h
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/mips/code-generator-mips.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/mips64/code-generator-mips64.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/opcodes.h
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/raw-machine-assembler.h
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/representation-change.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/simplified-lowering.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/simplified-lowering.h
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/simplified-operator.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/simplified-operator.h
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/typer.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/verifier.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/compiler/x64/code-generator-x64.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/contexts.h
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/external-reference-table.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/js/math.js
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/js/v8natives.js
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/objects.h
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/parsing/parser.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/src/type-cache.h
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/test/cctest/compiler/test-run-machops.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/test/cctest/test-serialize.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/test/mjsunit/compiler/deopt-materialize-accumulator.js
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/test/unittests/base/ieee754-unittest.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/test/unittests/compiler/js-builtin-reducer-unittest.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/test/unittests/compiler/machine-operator-reducer-unittest.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/test/unittests/compiler/node-test-utils.cc
[modify] https://crrev.com/0a0fe8fb8b06d5e90b082838739ebf44cab04028/test/unittests/compiler/node-test-utils.h

Status: Fixed (was: Assigned)
Project Member

Comment 10 by bugdroid1@chromium.org, Jul 5 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/305d42c01022061faf50de0070ae0a6c4b00f739

commit 305d42c01022061faf50de0070ae0a6c4b00f739
Author: bjaideep <bjaideep@ca.ibm.com>
Date: Tue Jul 05 18:12:00 2016

PPC/s390: [builtins] Unify most of the remaining Math builtins.

Port 0a0fe8fb8b06d5e90b082838739ebf44cab04028

Original commit message:

Import fdlibm versions of acos, acosh, asin and asinh, which are more
    precise and produce the same result across platforms (we were using
    libm versions for asin and acos so far, where both speed and precision
    depended on the operating system so far). Introduce appropriate TurboFan
    operators for these functions and use them both for inlining and for the
    generic builtin.

    Also migrate the Math.imul and Math.fround builtins to TurboFan builtins
    to ensure that their behavior is always exactly the same as the inlined
    TurboFan version (i.e. C++ truncation semantics for double to float
    don't necessarily meet the JavaScript semantics).

    For completeness, also migrate Math.sign, which can even get some nice
    love in TurboFan.

    Drive-by-fix: Some alpha-sorting on the Math related functions, and
    cleanup the list of Math intrinsics that we have to export via the
    native context currently.

R=bmeurer@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com

BUG= v8:3266 , v8:3496 , v8:3509 , v8:3952 , v8:5169 , v8:5170 , v8:5171 , v8:5172 
LOG=N

Review-Url: https://codereview.chromium.org/2125723002
Cr-Commit-Position: refs/heads/master@{#37539}

[modify] https://crrev.com/305d42c01022061faf50de0070ae0a6c4b00f739/src/compiler/ppc/code-generator-ppc.cc
[modify] https://crrev.com/305d42c01022061faf50de0070ae0a6c4b00f739/src/compiler/s390/code-generator-s390.cc

Labels: Priority-1

Sign in to add a comment