OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --harmony-maths | 5 // Flags: --harmony-maths |
6 | 6 |
7 assertTrue(isNaN(Math.log1p(NaN))); | 7 assertTrue(isNaN(Math.log1p(NaN))); |
8 assertTrue(isNaN(Math.log1p(function() {}))); | 8 assertTrue(isNaN(Math.log1p(function() {}))); |
9 assertTrue(isNaN(Math.log1p({ toString: function() { return NaN; } }))); | 9 assertTrue(isNaN(Math.log1p({ toString: function() { return NaN; } }))); |
10 assertTrue(isNaN(Math.log1p({ valueOf: function() { return "abc"; } }))); | 10 assertTrue(isNaN(Math.log1p({ valueOf: function() { return "abc"; } }))); |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 var sum = 0; | 33 var sum = 0; |
34 while (terms.length > 0) sum += terms.pop(); | 34 while (terms.length > 0) sum += terms.pop(); |
35 return sum; | 35 return sum; |
36 } | 36 } |
37 | 37 |
38 for (var x = 1E-1; x > 1E-300; x *= 0.8) { | 38 for (var x = 1E-1; x > 1E-300; x *= 0.8) { |
39 var expected = log1p(x); | 39 var expected = log1p(x); |
40 assertEqualsDelta(expected, Math.log1p(x), expected * 1E-14); | 40 assertEqualsDelta(expected, Math.log1p(x), expected * 1E-14); |
41 } | 41 } |
OLD | NEW |