PageRenderTime 19ms CodeModel.GetById 11ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/js/src/jit-test/tests/jaeger/inline/mathSqrt.js

http://github.com/zpao/v8monkey
JavaScript | 29 lines | 23 code | 4 blank | 2 comment | 0 complexity | 76afbe15b0e8d73bb6216c654a5e6d5e MD5 | raw file
 1
 2assertEq(Math.sqrt(-Infinity), NaN);
 3assertEq(Math.sqrt(-3.14), NaN);
 4assertEq(Math.sqrt(-2), NaN);
 5assertEq(Math.sqrt(-0), -0);
 6assertEq(Math.sqrt(0), 0);
 7assertEq(Math.sqrt(2), Math.SQRT2);
 8assertEq(Math.sqrt(49), 7);
 9assertEq(Math.sqrt(Infinity), Infinity);
10
11/* Inferred as sqrt(double). */
12function sqrt1(x) {
13    return Math.sqrt(x);
14}
15assertEq(sqrt1(NaN), NaN);
16assertEq(sqrt1(-Infinity), NaN);
17assertEq(sqrt1(Infinity), Infinity);
18assertEq(sqrt1(-0), -0);
19assertEq(sqrt1(2), Math.SQRT2);
20assertEq(sqrt1(16), 4);
21
22/* Inferred as sqrt(int). */
23function sqrt2(x) {
24    return Math.sqrt(x);
25}
26assertEq(sqrt2(4), 2);
27assertEq(sqrt2(169), 13);
28assertEq(sqrt2(0), 0);
29