Bug 123624 - Precision errors in Math.cbrt() on GTK, EFL
Summary: Precision errors in Math.cbrt() on GTK, EFL
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Zan Dobersek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-01 10:47 PDT by Zan Dobersek
Modified: 2013-11-04 10:01 PST (History)
5 users (show)

See Also:


Attachments
Patch (1.89 KB, patch)
2013-11-02 08:20 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zan Dobersek 2013-11-01 10:47:18 PDT
Math.cbrt(), introduced in r158401, is returning unexpected values in the js/math.html layout test (and the related stress tests) that are indicating precision errors. This only occurs on GTK and EFL.
http://trac.webkit.org/changeset/158401

The precision error originates in the underlying cbrt() call in JSC::mathProtoFuncCbrt. pow() works as expected, FWIW.

Diff:
--- /home/slave/webkitgtk/gtk-linux-64-release/build/layout-test-results/js/math-expected.txt
+++ /home/slave/webkitgtk/gtk-linux-64-release/build/layout-test-results/js/math-actual.txt
@@ -184,8 +184,8 @@
 PASS Math.cbrt(NaN) is NaN
 PASS Math.cbrt(0) is 0
 PASS Math.cbrt(-0) is -0
-PASS Math.cbrt(27) is 3
-PASS Math.cbrt(-27) is -3
+FAIL Math.cbrt(27) should be 3. Was 3.0000000000000004.
+FAIL Math.cbrt(-27) should be -3. Was -3.0000000000000004.
 PASS Math.cbrt(Infinity) is Infinity
 PASS Math.cbrt(-Infinity) is -Infinity
 PASS Math.cosh(NaN) is NaN
Comment 1 Oliver Hunt 2013-11-01 15:28:54 PDT
Try changing the test to +/-8 -> +/-2
Comment 2 Zan Dobersek 2013-11-02 08:20:07 PDT
Created attachment 215808 [details]
Patch
Comment 3 Csaba Osztrogonác 2013-11-03 13:56:03 PST
Comment on attachment 215808 [details]
Patch

LGTM
Comment 4 WebKit Commit Bot 2013-11-03 14:24:57 PST
Comment on attachment 215808 [details]
Patch

Clearing flags on attachment: 215808

Committed r158545: <http://trac.webkit.org/changeset/158545>
Comment 5 WebKit Commit Bot 2013-11-03 14:25:00 PST
All reviewed patches have been landed.  Closing bug.
Comment 6 Darin Adler 2013-11-03 17:02:06 PST
This patch just stops testing for this bug, it doesn’t fix the bug. Do we want to fix the bug?
Comment 7 Oliver Hunt 2013-11-04 10:01:27 PST
(In reply to comment #6)
> This patch just stops testing for this bug, it doesn’t fix the bug. Do we want to fix the bug?

The bug is lack of precision in the linux/gtk lib math, it can't be fixed in JSC short of us reimplementing cbrt entirely