| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 test_id(Math.tanh, Math.atanh, -x); | 53 test_id(Math.tanh, Math.atanh, -x); |
| 54 }); | 54 }); |
| 55 | 55 |
| 56 | 56 |
| 57 [Math.sinh, Math.asinh, Math.tanh, Math.atanh].forEach(function(fun) { | 57 [Math.sinh, Math.asinh, Math.tanh, Math.atanh].forEach(function(fun) { |
| 58 assertEquals("-Infinity", String(1/fun(-0))); | 58 assertEquals("-Infinity", String(1/fun(-0))); |
| 59 assertEquals("Infinity", String(1/fun(0))); | 59 assertEquals("Infinity", String(1/fun(0))); |
| 60 }); | 60 }); |
| 61 | 61 |
| 62 | 62 |
| 63 [Math.sinh, Math.asinh, Math.cosh].forEach(function(fun) { | 63 [Math.sinh, Math.asinh].forEach(function(fun) { |
| 64 assertEquals("-Infinity", String(fun(-Infinity))); | 64 assertEquals("-Infinity", String(fun(-Infinity))); |
| 65 assertEquals("Infinity", String(fun(Infinity))); | 65 assertEquals("Infinity", String(fun(Infinity))); |
| 66 assertEquals("-Infinity", String(fun("-Infinity"))); | 66 assertEquals("-Infinity", String(fun("-Infinity"))); |
| 67 assertEquals("Infinity", String(fun("Infinity"))); | 67 assertEquals("Infinity", String(fun("Infinity"))); |
| 68 }); | 68 }); |
| 69 | 69 |
| 70 | 70 |
| 71 assertEquals("Infinity", String(Math.cosh(-Infinity))); |
| 72 assertEquals("Infinity", String(Math.cosh(Infinity))); |
| 73 assertEquals("Infinity", String(Math.cosh("-Infinity"))); |
| 74 assertEquals("Infinity", String(Math.cosh("Infinity"))); |
| 75 |
| 76 |
| 71 assertEquals("-Infinity", String(Math.atanh(-1))); | 77 assertEquals("-Infinity", String(Math.atanh(-1))); |
| 72 assertEquals("Infinity", String(Math.atanh(1))); | 78 assertEquals("Infinity", String(Math.atanh(1))); |
| 73 | 79 |
| 74 // Math.atanh(x) is NaN for |x| > 1 and NaN | 80 // Math.atanh(x) is NaN for |x| > 1 and NaN |
| 75 [1.000000000001, Math.PI, 10000000, 2, Infinity, NaN].forEach(function(x) { | 81 [1.000000000001, Math.PI, 10000000, 2, Infinity, NaN].forEach(function(x) { |
| 76 assertTrue(isNaN(Math.atanh(-x))); | 82 assertTrue(isNaN(Math.atanh(-x))); |
| 77 assertTrue(isNaN(Math.atanh(x))); | 83 assertTrue(isNaN(Math.atanh(x))); |
| 78 }); | 84 }); |
| 79 | 85 |
| 80 | 86 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 assertEqualsDelta(-0.5493061443341, Math.atanh(-0.5), 1E-12); | 129 assertEqualsDelta(-0.5493061443341, Math.atanh(-0.5), 1E-12); |
| 124 assertEqualsDelta(-0.1003353477311, Math.atanh(-0.1), 1E-12); | 130 assertEqualsDelta(-0.1003353477311, Math.atanh(-0.1), 1E-12); |
| 125 | 131 |
| 126 [0, 1E-50, 1E-10, 1E10, 1E50, 1E100, 1E150].forEach(function(x) { | 132 [0, 1E-50, 1E-10, 1E10, 1E50, 1E100, 1E150].forEach(function(x) { |
| 127 assertEqualsDelta(Math.asinh(x), -Math.asinh(-x), 1E-12); | 133 assertEqualsDelta(Math.asinh(x), -Math.asinh(-x), 1E-12); |
| 128 }); | 134 }); |
| 129 | 135 |
| 130 [1-(1E-16), 0, 1E-10, 1E-50].forEach(function(x) { | 136 [1-(1E-16), 0, 1E-10, 1E-50].forEach(function(x) { |
| 131 assertEqualsDelta(Math.atanh(x), -Math.atanh(-x), 1E-12); | 137 assertEqualsDelta(Math.atanh(x), -Math.atanh(-x), 1E-12); |
| 132 }); | 138 }); |
| OLD | NEW |