Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(744)

Unified Diff: src/math.js

Issue 71473004: Merged r17703 into trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/math.js
diff --git a/src/math.js b/src/math.js
index 385b3c2a221832bbe1d15cc268ed7ae2b6ac74e0..529033ebd82ccad43fd949f39cfdfd89d65c519b 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 +
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698