| // The Computer Language Shootout |
| // http://shootout.alioth.debian.org/ |
| // contributed by Isaac Gouy |
| var a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = 0.0; |
| var k2 = k3 = sk = ck = 0.0; |
| for (var k = 1; k <= n; k++){ |
| a1 += Math.pow(twothirds,k-1); |
| // NOTE: We don't try to validate anything from pow(), sin() or cos() because those aren't |
| // well-specified in ECMAScript. |
| return a6 + a7 + a8 + a9; |
| for (var i = 1024; i <= 2097152; i *= 2) { |
| var expected = 173.3312765300306; |
| throw "ERROR: bad result: expected " + expected + " but got " + total; |