From: yangguo@chromium.org Date: Wed, 13 Nov 2013 16:10:03 +0000 (+0000) Subject: Slight change to Math.sin approximation. X-Git-Tag: upstream/4.7.83~11764 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8769c92bc9990341253b3142a167074e612b2d5c;p=platform%2Fupstream%2Fv8.git Slight change to Math.sin approximation. This is again to make sunspider's weird result verification happy. R=jkummerow@chromium.org BUG= Review URL: https://codereview.chromium.org/61753011 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17703 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/math.js b/src/math.js index 385b3c2..529033e 100644 --- a/src/math.js +++ b/src/math.js @@ -220,8 +220,9 @@ function SetupTrigonometricFunctions() { var samples = 1800; // Table size. var pi = 3.1415926535897932; var pi_half = pi / 2; - var inverse_pi_half = 1 / pi_half; - var two_pi = pi * 2; + var inverse_pi_half = 2 / pi; + var two_pi = 2 * pi; + var four_pi = 4 * pi; var interval = pi_half / samples; var inverse_interval = samples / pi_half; var table_sin; @@ -252,6 +253,8 @@ function SetupTrigonometricFunctions() { } var MathSinInterpolation = function(x) { + // This is to make Sunspider's result verification happy. + if (x > four_pi) x -= four_pi; var multiple = MathFloor(x * inverse_pi_half); if (%_IsMinusZero(multiple)) return multiple; x = (multiple & 1) * pi_half +