Status: New
Owner: ----
New issue 2234 by [email protected]: Math.sin(0) is sometimes incorrect
on ARM
http://code.google.com/p/v8/issues/detail?id=2234
Math.sin(0) will intermittently return a non-zero value on ARM platforms.
Here is a html file that reproduces the problem.
When run inside the Android Chrome browser the following alert will pop-up:
sin of 0 is broken, expected = 0, actual = -0.70089924904199
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Sin Test</title>
</head>
<body>
<script>
// only accurate for -pi <= theta <= pi, error 0.00692527
var powerSin = function (x) {
return x - (x*x*x)/6 + (x*x*x*x*x)/120 - (x*x*x*x*x*x*x)/5040 +
(x*x*x*x*x*x*x*x*x)/362880;
}
var testSin = function (x) {
var expected = powerSin(x);
var actual = Math.sin(x);
if (Math.abs(expected - actual) > 0.01) {
alert("sin of " + x + " is broken, expected = " + expected + ", actual
= " + actual);
return false;
}
return true;
}
for (i = 0; i < 1000000; ++i) {
if (!testSin((Math.random() * 2 * Math.PI) - Math.PI))
break;
if (!testSin(0))
break;
}
alert("done");
</script>
</body>
</html>
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev