| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 assertEquals(+Infinity, Math.pow(-0, -0.5)); | 134 assertEquals(+Infinity, Math.pow(-0, -0.5)); |
| 135 assertEquals(+Infinity, Math.pow(-0, -0.6)); | 135 assertEquals(+Infinity, Math.pow(-0, -0.6)); |
| 136 assertEquals(-Infinity, Math.pow(-0, -1)); | 136 assertEquals(-Infinity, Math.pow(-0, -1)); |
| 137 assertEquals(-Infinity, Math.pow(-0, -10000000001)); | 137 assertEquals(-Infinity, Math.pow(-0, -10000000001)); |
| 138 | 138 |
| 139 assertEquals(4, Math.pow(16, 0.5)); | 139 assertEquals(4, Math.pow(16, 0.5)); |
| 140 assertEquals(NaN, Math.pow(-16, 0.5)); | 140 assertEquals(NaN, Math.pow(-16, 0.5)); |
| 141 assertEquals(0.25, Math.pow(16, -0.5)); | 141 assertEquals(0.25, Math.pow(16, -0.5)); |
| 142 assertEquals(NaN, Math.pow(-16, -0.5)); | 142 assertEquals(NaN, Math.pow(-16, -0.5)); |
| 143 |
| 144 // Test detecting and converting integer value as double. |
| 145 assertEquals(8, Math.pow(2, Math.sqrt(9))); |
| 143 | 146 |
| 144 // Tests from Mozilla 15.8.2.13. | 147 // Tests from Mozilla 15.8.2.13. |
| 145 assertEquals(2, Math.pow.length); | 148 assertEquals(2, Math.pow.length); |
| 146 assertEquals(NaN, Math.pow()); | 149 assertEquals(NaN, Math.pow()); |
| 147 assertEquals(1, Math.pow(null, null)); | 150 assertEquals(1, Math.pow(null, null)); |
| 148 assertEquals(NaN, Math.pow(void 0, void 0)); | 151 assertEquals(NaN, Math.pow(void 0, void 0)); |
| 149 assertEquals(1, Math.pow(true, false)); | 152 assertEquals(1, Math.pow(true, false)); |
| 150 assertEquals(0, Math.pow(false, true)); | 153 assertEquals(0, Math.pow(false, true)); |
| 151 assertEquals(Infinity, Math.pow(-Infinity, Infinity)); | 154 assertEquals(Infinity, Math.pow(-Infinity, Infinity)); |
| 152 assertEquals(0, Math.pow(-Infinity, -Infinity)); | 155 assertEquals(0, Math.pow(-Infinity, -Infinity)); |
| 153 assertEquals(1, Math.pow(0, 0)); | 156 assertEquals(1, Math.pow(0, 0)); |
| 154 assertEquals(0, Math.pow(0, Infinity)); | 157 assertEquals(0, Math.pow(0, Infinity)); |
| 155 assertEquals(NaN, Math.pow(NaN, 0.5)); | 158 assertEquals(NaN, Math.pow(NaN, 0.5)); |
| 156 assertEquals(NaN, Math.pow(NaN, -0.5)); | 159 assertEquals(NaN, Math.pow(NaN, -0.5)); |
| 157 | 160 |
| 158 // Tests from Sputnik S8.5_A13_T1. | 161 // Tests from Sputnik S8.5_A13_T1. |
| 159 assertTrue( | 162 assertTrue( |
| 160 (1*((Math.pow(2,53))-1)*(Math.pow(2,-1074))) === 4.4501477170144023e-308); | 163 (1*((Math.pow(2,53))-1)*(Math.pow(2,-1074))) === 4.4501477170144023e-308); |
| 161 assertTrue( | 164 assertTrue( |
| 162 (1*(Math.pow(2,52))*(Math.pow(2,-1074))) === 2.2250738585072014e-308); | 165 (1*(Math.pow(2,52))*(Math.pow(2,-1074))) === 2.2250738585072014e-308); |
| 163 assertTrue( | 166 assertTrue( |
| 164 (-1*(Math.pow(2,52))*(Math.pow(2,-1074))) === -2.2250738585072014e-308); | 167 (-1*(Math.pow(2,52))*(Math.pow(2,-1074))) === -2.2250738585072014e-308); |
| 165 } | 168 } |
| 166 | 169 |
| 167 test(); | 170 test(); |
| 168 test(); | 171 test(); |
| 169 %OptimizeFunctionOnNextCall(test); | 172 %OptimizeFunctionOnNextCall(test); |
| 170 test(); | 173 test(); |
| OLD | NEW |