Bug 123624

Summary: Precision errors in Math.cbrt() on GTK, EFL
Product: WebKit Reporter: Zan Dobersek <zan>
Component: JavaScriptCoreAssignee: Zan Dobersek <zan>
Severity: Normal CC: commit-queue, darin, gyuyoung.kim, msaboff, oliver
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Description Flags
Patch none

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.

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

--- /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]
Comment 3 Csaba Osztrogonác 2013-11-03 13:56:03 PST
Comment on attachment 215808 [details]

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

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