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 // Tests from Mozilla 15.8.2.13. |
| 145 assertEquals(2, Math.pow.length); |
| 146 assertEquals(NaN, Math.pow()); |
| 147 assertEquals(1, Math.pow(null, null)); |
| 148 assertEquals(NaN, Math.pow(void 0, void 0)); |
| 149 assertEquals(1, Math.pow(true, false)); |
| 150 assertEquals(0, Math.pow(false, true)); |
| 151 assertEquals(Infinity, Math.pow(-Infinity, Infinity)); |
| 152 assertEquals(0, Math.pow(-Infinity, -Infinity)); |
| 153 assertEquals(1, Math.pow(0, 0)); |
| 154 assertEquals(0, Math.pow(0, Infinity)); |
| 155 assertEquals(NaN, Math.pow(NaN, 0.5)); |
| 156 assertEquals(NaN, Math.pow(NaN, -0.5)); |
143 | 157 |
144 // Tests from Sputnik S8.5_A13_T1. | 158 // Tests from Sputnik S8.5_A13_T1. |
145 assertTrue( | 159 assertTrue( |
146 (1*((Math.pow(2,53))-1)*(Math.pow(2,-1074))) === 4.4501477170144023e-308); | 160 (1*((Math.pow(2,53))-1)*(Math.pow(2,-1074))) === 4.4501477170144023e-308); |
147 assertTrue( | 161 assertTrue( |
148 (1*(Math.pow(2,52))*(Math.pow(2,-1074))) === 2.2250738585072014e-308); | 162 (1*(Math.pow(2,52))*(Math.pow(2,-1074))) === 2.2250738585072014e-308); |
149 assertTrue( | 163 assertTrue( |
150 (-1*(Math.pow(2,52))*(Math.pow(2,-1074))) === -2.2250738585072014e-308); | 164 (-1*(Math.pow(2,52))*(Math.pow(2,-1074))) === -2.2250738585072014e-308); |
151 } | 165 } |
152 | 166 |
153 test(); | 167 test(); |
154 test(); | 168 test(); |
155 %OptimizeFunctionOnNextCall(test); | 169 %OptimizeFunctionOnNextCall(test); |
156 test(); | 170 test(); |
OLD | NEW |