| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 assertEquals(NaN, Math.pow(NaN, -1)); | 51 assertEquals(NaN, Math.pow(NaN, -1)); |
| 52 assertEquals(NaN, Math.pow(NaN, -2.2)); | 52 assertEquals(NaN, Math.pow(NaN, -2.2)); |
| 53 assertEquals(NaN, Math.pow(NaN, Infinity)); | 53 assertEquals(NaN, Math.pow(NaN, Infinity)); |
| 54 assertEquals(NaN, Math.pow(NaN, -Infinity)); | 54 assertEquals(NaN, Math.pow(NaN, -Infinity)); |
| 55 | 55 |
| 56 assertEquals(Infinity, Math.pow(1.1, Infinity)); | 56 assertEquals(Infinity, Math.pow(1.1, Infinity)); |
| 57 assertEquals(Infinity, Math.pow(-1.1, Infinity)); | 57 assertEquals(Infinity, Math.pow(-1.1, Infinity)); |
| 58 assertEquals(Infinity, Math.pow(2, Infinity)); | 58 assertEquals(Infinity, Math.pow(2, Infinity)); |
| 59 assertEquals(Infinity, Math.pow(-2, Infinity)); | 59 assertEquals(Infinity, Math.pow(-2, Infinity)); |
| 60 | 60 |
| 61 assertEquals(+0, Math.pow(1.1, -Infinity)); | 61 // Because +0 == -0, we need to compare 1/{+,-}0 to {+,-}Infinity |
| 62 assertEquals(+0, Math.pow(-1.1, -Infinity)); | 62 assertEquals(+Infinity, 1/Math.pow(1.1, -Infinity)); |
| 63 assertEquals(+0, Math.pow(2, -Infinity)); | 63 assertEquals(+Infinity, 1/Math.pow(-1.1, -Infinity)); |
| 64 assertEquals(+0, Math.pow(-2, -Infinity)); | 64 assertEquals(+Infinity, 1/Math.pow(2, -Infinity)); |
| 65 assertEquals(+Infinity, 1/Math.pow(-2, -Infinity)); |
| 65 | 66 |
| 66 assertEquals(NaN, Math.pow(1, Infinity)); | 67 assertEquals(NaN, Math.pow(1, Infinity)); |
| 67 assertEquals(NaN, Math.pow(1, -Infinity)); | 68 assertEquals(NaN, Math.pow(1, -Infinity)); |
| 68 assertEquals(NaN, Math.pow(-1, Infinity)); | 69 assertEquals(NaN, Math.pow(-1, Infinity)); |
| 69 assertEquals(NaN, Math.pow(-1, -Infinity)); | 70 assertEquals(NaN, Math.pow(-1, -Infinity)); |
| 70 | 71 |
| 71 assertEquals(+0, Math.pow(0.1, Infinity)); | 72 assertEquals(+0, Math.pow(0.1, Infinity)); |
| 72 assertEquals(+0, Math.pow(-0.1, Infinity)); | 73 assertEquals(+0, Math.pow(-0.1, Infinity)); |
| 73 assertEquals(+0, Math.pow(0.999, Infinity)); | 74 assertEquals(+0, Math.pow(0.999, Infinity)); |
| 74 assertEquals(+0, Math.pow(-0.999, Infinity)); | 75 assertEquals(+0, Math.pow(-0.999, Infinity)); |
| 75 | 76 |
| 76 assertEquals(Infinity, Math.pow(0.1, -Infinity)); | 77 assertEquals(Infinity, Math.pow(0.1, -Infinity)); |
| 77 assertEquals(Infinity, Math.pow(-0.1, -Infinity)); | 78 assertEquals(Infinity, Math.pow(-0.1, -Infinity)); |
| 78 assertEquals(Infinity, Math.pow(0.999, -Infinity)); | 79 assertEquals(Infinity, Math.pow(0.999, -Infinity)); |
| 79 assertEquals(Infinity, Math.pow(-0.999, -Infinity)); | 80 assertEquals(Infinity, Math.pow(-0.999, -Infinity)); |
| 80 | 81 |
| 81 assertEquals(Infinity, Math.pow(Infinity, 0.1)); | 82 assertEquals(Infinity, Math.pow(Infinity, 0.1)); |
| 82 assertEquals(Infinity, Math.pow(Infinity, 2)); | 83 assertEquals(Infinity, Math.pow(Infinity, 2)); |
| 83 | 84 |
| 84 assertEquals(+0, Math.pow(Infinity, -0.1)); | 85 assertEquals(+Infinity, 1/Math.pow(Infinity, -0.1)); |
| 85 assertEquals(+0, Math.pow(Infinity, -2)); | 86 assertEquals(+Infinity, 1/Math.pow(Infinity, -2)); |
| 86 | 87 |
| 87 assertEquals(-Infinity, Math.pow(-Infinity, 3)); | 88 assertEquals(-Infinity, Math.pow(-Infinity, 3)); |
| 88 assertEquals(-Infinity, Math.pow(-Infinity, 13)); | 89 assertEquals(-Infinity, Math.pow(-Infinity, 13)); |
| 89 | 90 |
| 90 assertEquals(Infinity, Math.pow(-Infinity, 3.1)); | 91 assertEquals(Infinity, Math.pow(-Infinity, 3.1)); |
| 91 assertEquals(Infinity, Math.pow(-Infinity, 2)); | 92 assertEquals(Infinity, Math.pow(-Infinity, 2)); |
| 92 | 93 |
| 93 assertEquals(-0, Math.pow(-Infinity, -3)); | 94 assertEquals(-Infinity, 1/Math.pow(-Infinity, -3)); |
| 94 assertEquals(-0, Math.pow(-Infinity, -13)); | 95 assertEquals(-Infinity, 1/Math.pow(-Infinity, -13)); |
| 95 | 96 |
| 96 assertEquals(+0, Math.pow(-Infinity, -3.1)); | 97 assertEquals(+Infinity, 1/Math.pow(-Infinity, -3.1)); |
| 97 assertEquals(+0, Math.pow(-Infinity, -2)); | 98 assertEquals(+Infinity, 1/Math.pow(-Infinity, -2)); |
| 98 | 99 |
| 99 assertEquals(+0, Math.pow(+0, 1.1)); | 100 assertEquals(+Infinity, 1/Math.pow(+0, 1.1)); |
| 100 assertEquals(+0, Math.pow(+0, 2)); | 101 assertEquals(+Infinity, 1/Math.pow(+0, 2)); |
| 101 | 102 |
| 102 assertEquals(Infinity, Math.pow(+0, -1.1)); | 103 assertEquals(Infinity, Math.pow(+0, -1.1)); |
| 103 assertEquals(Infinity, Math.pow(+0, -2)); | 104 assertEquals(Infinity, Math.pow(+0, -2)); |
| 104 | 105 |
| 105 assertEquals(-0, Math.pow(-0, 3)); | 106 assertEquals(-Infinity, 1/Math.pow(-0, 3)); |
| 106 assertEquals(-0, Math.pow(-0, 13)); | 107 assertEquals(-Infinity, 1/Math.pow(-0, 13)); |
| 107 | 108 |
| 108 assertEquals(+0, Math.pow(-0, 3.1)); | 109 assertEquals(+Infinity, 1/Math.pow(-0, 3.1)); |
| 109 assertEquals(+0, Math.pow(-0, 2)); | 110 assertEquals(+Infinity, 1/Math.pow(-0, 2)); |
| 110 | 111 |
| 111 assertEquals(-Infinity, Math.pow(-0, -3)); | 112 assertEquals(-Infinity, Math.pow(-0, -3)); |
| 112 assertEquals(-Infinity, Math.pow(-0, -13)); | 113 assertEquals(-Infinity, Math.pow(-0, -13)); |
| 113 | 114 |
| 114 assertEquals(Infinity, Math.pow(-0, -3.1)); | 115 assertEquals(Infinity, Math.pow(-0, -3.1)); |
| 115 assertEquals(Infinity, Math.pow(-0, -2)); | 116 assertEquals(Infinity, Math.pow(-0, -2)); |
| 116 | 117 |
| 117 assertEquals(NaN, Math.pow(-0.00001, 1.1)); | 118 assertEquals(NaN, Math.pow(-0.00001, 1.1)); |
| 118 assertEquals(NaN, Math.pow(-0.00001, -1.1)); | 119 assertEquals(NaN, Math.pow(-0.00001, -1.1)); |
| 119 assertEquals(NaN, Math.pow(-1.1, 1.1)); | 120 assertEquals(NaN, Math.pow(-1.1, 1.1)); |
| 120 assertEquals(NaN, Math.pow(-1.1, -1.1)); | 121 assertEquals(NaN, Math.pow(-1.1, -1.1)); |
| 121 assertEquals(NaN, Math.pow(-2, 1.1)); | 122 assertEquals(NaN, Math.pow(-2, 1.1)); |
| 122 assertEquals(NaN, Math.pow(-2, -1.1)); | 123 assertEquals(NaN, Math.pow(-2, -1.1)); |
| 123 assertEquals(NaN, Math.pow(-1000, 1.1)); | 124 assertEquals(NaN, Math.pow(-1000, 1.1)); |
| 124 assertEquals(NaN, Math.pow(-1000, -1.1)); | 125 assertEquals(NaN, Math.pow(-1000, -1.1)); |
| 125 | 126 |
| 127 assertEquals(+Infinity, 1/Math.pow(-0, 0.5)); |
| 128 assertEquals(+Infinity, 1/Math.pow(-0, 0.6)); |
| 129 assertEquals(-Infinity, 1/Math.pow(-0, 1)); |
| 130 assertEquals(-Infinity, 1/Math.pow(-0, 10000000001)); |
| 131 |
| 132 assertEquals(+Infinity, Math.pow(-0, -0.5)); |
| 133 assertEquals(+Infinity, Math.pow(-0, -0.6)); |
| 134 assertEquals(-Infinity, Math.pow(-0, -1)); |
| 135 assertEquals(-Infinity, Math.pow(-0, -10000000001)); |
| 136 |
| 137 |
| 138 |
| 126 // Tests from Sputnik S8.5_A13_T1. | 139 // Tests from Sputnik S8.5_A13_T1. |
| 127 assertTrue((1*((Math.pow(2,53))-1)*(Math.pow(2,-1074))) === 4.4501477170144023e-
308); | 140 assertTrue((1*((Math.pow(2,53))-1)*(Math.pow(2,-1074))) === 4.4501477170144023e-
308); |
| 128 assertTrue((1*(Math.pow(2,52))*(Math.pow(2,-1074))) === 2.2250738585072014e-308)
; | 141 assertTrue((1*(Math.pow(2,52))*(Math.pow(2,-1074))) === 2.2250738585072014e-308)
; |
| 129 assertTrue((-1*(Math.pow(2,52))*(Math.pow(2,-1074))) === -2.2250738585072014e-30
8); | 142 assertTrue((-1*(Math.pow(2,52))*(Math.pow(2,-1074))) === -2.2250738585072014e-30
8); |
| OLD | NEW |