1--TEST-- 2Test pow() - basic function test pow() 3--INI-- 4precision=14 5--SKIPIF-- 6<?php 7if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); 8?> 9--FILE-- 10<?php 11$bases = array(23, 12 -23, 13 23.1, 14 -23.1, 15 2.345e1, 16 -2.345e1, 17 0x17, 18 027, 19 "23", 20 "23.45", 21 "2.345e1", 22 PHP_INT_MAX, 23 -PHP_INT_MAX - 1); 24 25$exponents = array(0, 26 1, 27 -1, 28 2, 29 -2, 30 3, 31 -3, 32 2.5, 33 -2.5, 34 500, 35 -500, 36 2147483647, 37 -2147483648); 38 39foreach($bases as $base) { 40 echo "\n\nBase = $base"; 41 foreach($exponents as $exponent) { 42 echo "\n..... Exponent = $exponent Result = "; 43 $res = pow($base, $exponent); 44 echo $res; 45 } 46 echo "\n\n"; 47} 48?> 49--EXPECT-- 50Base = 23 51..... Exponent = 0 Result = 1 52..... Exponent = 1 Result = 23 53..... Exponent = -1 Result = 0.043478260869565 54..... Exponent = 2 Result = 529 55..... Exponent = -2 Result = 0.001890359168242 56..... Exponent = 3 Result = 12167 57..... Exponent = -3 Result = 8.2189529053999E-5 58..... Exponent = 2.5 Result = 2536.9948758324 59..... Exponent = -2.5 Result = 0.00039416713432339 60..... Exponent = 500 Result = INF 61..... Exponent = -500 Result = 0 62..... Exponent = 2147483647 Result = INF 63..... Exponent = -2147483648 Result = 0 64 65 66 67Base = -23 68..... Exponent = 0 Result = 1 69..... Exponent = 1 Result = -23 70..... Exponent = -1 Result = -0.043478260869565 71..... Exponent = 2 Result = 529 72..... Exponent = -2 Result = 0.001890359168242 73..... Exponent = 3 Result = -12167 74..... Exponent = -3 Result = -8.2189529053999E-5 75..... Exponent = 2.5 Result = NAN 76..... Exponent = -2.5 Result = NAN 77..... Exponent = 500 Result = INF 78..... Exponent = -500 Result = 0 79..... Exponent = 2147483647 Result = -INF 80..... Exponent = -2147483648 Result = 0 81 82 83 84Base = 23.1 85..... Exponent = 0 Result = 1 86..... Exponent = 1 Result = 23.1 87..... Exponent = -1 Result = 0.043290043290043 88..... Exponent = 2 Result = 533.61 89..... Exponent = -2 Result = 0.0018740278480538 90..... Exponent = 3 Result = 12326.391 91..... Exponent = -3 Result = 8.1126746668997E-5 92..... Exponent = 2.5 Result = 2564.6608940579 93..... Exponent = -2.5 Result = 0.00038991509650141 94..... Exponent = 500 Result = INF 95..... Exponent = -500 Result = 0 96..... Exponent = 2147483647 Result = INF 97..... Exponent = -2147483648 Result = 0 98 99 100 101Base = -23.1 102..... Exponent = 0 Result = 1 103..... Exponent = 1 Result = -23.1 104..... Exponent = -1 Result = -0.043290043290043 105..... Exponent = 2 Result = 533.61 106..... Exponent = -2 Result = 0.0018740278480538 107..... Exponent = 3 Result = -12326.391 108..... Exponent = -3 Result = -8.1126746668997E-5 109..... Exponent = 2.5 Result = NAN 110..... Exponent = -2.5 Result = NAN 111..... Exponent = 500 Result = INF 112..... Exponent = -500 Result = 0 113..... Exponent = 2147483647 Result = -INF 114..... Exponent = -2147483648 Result = 0 115 116 117 118Base = 23.45 119..... Exponent = 0 Result = 1 120..... Exponent = 1 Result = 23.45 121..... Exponent = -1 Result = 0.042643923240938 122..... Exponent = 2 Result = 549.9025 123..... Exponent = -2 Result = 0.001818504189379 124..... Exponent = 3 Result = 12895.213625 125..... Exponent = -3 Result = 7.7548153065204E-5 126..... Exponent = 2.5 Result = 2662.9138571162 127..... Exponent = -2.5 Result = 0.00037552848257846 128..... Exponent = 500 Result = INF 129..... Exponent = -500 Result = 0 130..... Exponent = 2147483647 Result = INF 131..... Exponent = -2147483648 Result = 0 132 133 134 135Base = -23.45 136..... Exponent = 0 Result = 1 137..... Exponent = 1 Result = -23.45 138..... Exponent = -1 Result = -0.042643923240938 139..... Exponent = 2 Result = 549.9025 140..... Exponent = -2 Result = 0.001818504189379 141..... Exponent = 3 Result = -12895.213625 142..... Exponent = -3 Result = -7.7548153065204E-5 143..... Exponent = 2.5 Result = NAN 144..... Exponent = -2.5 Result = NAN 145..... Exponent = 500 Result = INF 146..... Exponent = -500 Result = 0 147..... Exponent = 2147483647 Result = -INF 148..... Exponent = -2147483648 Result = 0 149 150 151 152Base = 23 153..... Exponent = 0 Result = 1 154..... Exponent = 1 Result = 23 155..... Exponent = -1 Result = 0.043478260869565 156..... Exponent = 2 Result = 529 157..... Exponent = -2 Result = 0.001890359168242 158..... Exponent = 3 Result = 12167 159..... Exponent = -3 Result = 8.2189529053999E-5 160..... Exponent = 2.5 Result = 2536.9948758324 161..... Exponent = -2.5 Result = 0.00039416713432339 162..... Exponent = 500 Result = INF 163..... Exponent = -500 Result = 0 164..... Exponent = 2147483647 Result = INF 165..... Exponent = -2147483648 Result = 0 166 167 168 169Base = 23 170..... Exponent = 0 Result = 1 171..... Exponent = 1 Result = 23 172..... Exponent = -1 Result = 0.043478260869565 173..... Exponent = 2 Result = 529 174..... Exponent = -2 Result = 0.001890359168242 175..... Exponent = 3 Result = 12167 176..... Exponent = -3 Result = 8.2189529053999E-5 177..... Exponent = 2.5 Result = 2536.9948758324 178..... Exponent = -2.5 Result = 0.00039416713432339 179..... Exponent = 500 Result = INF 180..... Exponent = -500 Result = 0 181..... Exponent = 2147483647 Result = INF 182..... Exponent = -2147483648 Result = 0 183 184 185 186Base = 23 187..... Exponent = 0 Result = 1 188..... Exponent = 1 Result = 23 189..... Exponent = -1 Result = 0.043478260869565 190..... Exponent = 2 Result = 529 191..... Exponent = -2 Result = 0.001890359168242 192..... Exponent = 3 Result = 12167 193..... Exponent = -3 Result = 8.2189529053999E-5 194..... Exponent = 2.5 Result = 2536.9948758324 195..... Exponent = -2.5 Result = 0.00039416713432339 196..... Exponent = 500 Result = INF 197..... Exponent = -500 Result = 0 198..... Exponent = 2147483647 Result = INF 199..... Exponent = -2147483648 Result = 0 200 201 202 203Base = 23.45 204..... Exponent = 0 Result = 1 205..... Exponent = 1 Result = 23.45 206..... Exponent = -1 Result = 0.042643923240938 207..... Exponent = 2 Result = 549.9025 208..... Exponent = -2 Result = 0.001818504189379 209..... Exponent = 3 Result = 12895.213625 210..... Exponent = -3 Result = 7.7548153065204E-5 211..... Exponent = 2.5 Result = 2662.9138571162 212..... Exponent = -2.5 Result = 0.00037552848257846 213..... Exponent = 500 Result = INF 214..... Exponent = -500 Result = 0 215..... Exponent = 2147483647 Result = INF 216..... Exponent = -2147483648 Result = 0 217 218 219 220Base = 2.345e1 221..... Exponent = 0 Result = 1 222..... Exponent = 1 Result = 23.45 223..... Exponent = -1 Result = 0.042643923240938 224..... Exponent = 2 Result = 549.9025 225..... Exponent = -2 Result = 0.001818504189379 226..... Exponent = 3 Result = 12895.213625 227..... Exponent = -3 Result = 7.7548153065204E-5 228..... Exponent = 2.5 Result = 2662.9138571162 229..... Exponent = -2.5 Result = 0.00037552848257846 230..... Exponent = 500 Result = INF 231..... Exponent = -500 Result = 0 232..... Exponent = 2147483647 Result = INF 233..... Exponent = -2147483648 Result = 0 234 235 236 237Base = 9223372036854775807 238..... Exponent = 0 Result = 1 239..... Exponent = 1 Result = 9223372036854775807 240..... Exponent = -1 Result = 1.0842021724855E-19 241..... Exponent = 2 Result = 8.5070591730235E+37 242..... Exponent = -2 Result = 1.1754943508223E-38 243..... Exponent = 3 Result = 7.8463771692334E+56 244..... Exponent = -3 Result = 1.274473528906E-57 245..... Exponent = 2.5 Result = 2.5835942961798E+47 246..... Exponent = -2.5 Result = 3.8705767444936E-48 247..... Exponent = 500 Result = INF 248..... Exponent = -500 Result = 0 249..... Exponent = 2147483647 Result = INF 250..... Exponent = -2147483648 Result = 0 251 252 253 254Base = -9223372036854775808 255..... Exponent = 0 Result = 1 256..... Exponent = 1 Result = -9223372036854775808 257..... Exponent = -1 Result = -1.0842021724855E-19 258..... Exponent = 2 Result = 8.5070591730235E+37 259..... Exponent = -2 Result = 1.1754943508223E-38 260..... Exponent = 3 Result = -7.8463771692334E+56 261..... Exponent = -3 Result = -1.274473528906E-57 262..... Exponent = 2.5 Result = NAN 263..... Exponent = -2.5 Result = NAN 264..... Exponent = 500 Result = INF 265..... Exponent = -500 Result = 0 266..... Exponent = 2147483647 Result = -INF 267..... Exponent = -2147483648 Result = 0 268 269