Bug 115553 - SunSpider 1.0: 3d-morph: use epsilon to check result
Summary: SunSpider 1.0: 3d-morph: use epsilon to check result
Status: RESOLVED DUPLICATE of bug 115580
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2013-05-03 09:57 PDT by Cosmin Truta
Modified: 2013-05-04 01:28 PDT (History)
4 users (show)

See Also:

Patch (1.68 KB, patch)
2013-05-03 10:03 PDT, Cosmin Truta
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cosmin Truta 2013-05-03 09:57:25 PDT
3d-morph.js fails on QNX. The testOutput is expected to be a number that starts with a 6, but the actual output is approx. -4.97e-14.

I reimplemented 3d-morph in C, and I executed it both with double and long double on x86_64 Linux.
By using double calculations and sin(), the result was 6.75e-14.
By using long double calculations and sinl(), the result was -6.279e-14.

Is the theoretical result supposed to be zero, and the actual one closed to zero, due to error accumulations?

Running the same program on ARM QNX, the result (using double and sin()) was -4.97e-14, i.e. same as inside JSC.

Then I looked at all intermediate results returned by sin(). Out of 240 distinct calls to sin(), about ~65 of them are different by exactly 1ULP. In my understanding, that error should be acceptable.
Comment 1 Cosmin Truta 2013-05-03 10:03:04 PDT
Created attachment 200429 [details]
Comment 2 Filip Pizlo 2013-05-03 10:53:43 PDT
Comment on attachment 200429 [details]

We should test this on other platforms as well. Note that sin() is not defined to have *any* precision guarantee in ECMAScript. So even if our engine can achieve this level of erro it might not be fair to require others to.
Comment 3 Filip Pizlo 2013-05-03 10:56:04 PDT
Comment on attachment 200429 [details]

Oh. Sorry. You're making the test even more lax. I'll have to think about it.
Comment 4 Cosmin Truta 2013-05-04 01:21:26 PDT
Comment on attachment 200429 [details]

Removing r? and cq? flags. I resubmitted this patch accidentally in bug 115580, and it landed over there.
Comment 5 Cosmin Truta 2013-05-04 01:21:56 PDT

*** This bug has been marked as a duplicate of bug 115580 ***
Comment 6 Cosmin Truta 2013-05-04 01:28:22 PDT
At the WebKit meeting, Filip Pizlo required additional data to back my precision claims regarding 1ULP roundoff errors. I will provide the test program and the intermediate output values, for comparison, in the other bug.