Index: test/mjsunit/regress/regress-164442.js |
diff --git a/test/mjsunit/regress/regress-sqrt.js b/test/mjsunit/regress/regress-164442.js |
similarity index 86% |
copy from test/mjsunit/regress/regress-sqrt.js |
copy to test/mjsunit/regress/regress-164442.js |
index f2a7e55242cbcdfb281f8e05c465000c98b5a8bc..1160d874f5bc9c73b9f0952627babe59771c1c8f 100644 |
--- a/test/mjsunit/regress/regress-sqrt.js |
+++ b/test/mjsunit/regress/regress-164442.js |
@@ -27,21 +27,19 @@ |
// Flags: --allow-natives-syntax |
-// Check that Math.sqrt returns the same value regardless of being |
-// optimized or not. |
+// Should not take a very long time (n^2 algorithms are bad) |
-function f(x) { |
- return Math.sqrt(x); |
+ |
+function ensureNotNegative(x) { |
+ return Math.max(0, x | 0); |
} |
-var x = 7.0506280066499245e-233; |
-var a = f(x); |
+ensureNotNegative(1); |
+ensureNotNegative(2); |
-f(0.1); |
-f(0.2); |
-%OptimizeFunctionOnNextCall(f); |
+%OptimizeFunctionOnNextCall(ensureNotNegative); |
-var b = f(x); |
+var r = ensureNotNegative(-1); |
-assertEquals(a, b); |
+assertEquals(0, r); |