Revert "make hphpc able to use ini files"
[hiphop-php.git] / hphp / test / zend / bad / ext / standard / tests / serialize / precision.php
blobb835cb44cef3d0b969191d77f81226e6975cf65b
1 <?php
3 $numbers = array(
4 "0000000000000000", //0
5 "2d431cebe2362a3f", //.0002
6 "2e431cebe2362a3f", //.0002 + 10^-Accuracy[.0002]*1.01
7 "0000000000001000", //2^-1022. (minimum normal double)
8 "0100000000001000", //2^-1022. + 10^-Accuracy[2^-1022.]*1.01
9 "ffffffffffffef7f", //2^1024. (maximum normal double)
10 "feffffffffffef7f", //2^1024. - 10^-Accuracy[2^1024.]
11 "0100000000000000", //minumum subnormal double
12 "0200000000000000", //2nd minumum subnormal double
13 "fffffffffffff000", //maximum subnormal double
14 "fefffffffffff000", //2nd maximum subnormal double
15 "0000000000000f7f", //+inf
16 "0000000000000fff", //-inf
19 foreach ($numbers as $ns) {
20 $num = unpack("d", pack("H*", $ns)); $num = reset($num);
21 echo "number: ", sprintf("%.17e", $num), "... ";
22 $num2 = unserialize(serialize($num));
23 $repr = unpack("H*", pack("d", $num2)); $repr = reset($repr);
24 if ($repr == $ns)
25 echo "OK\n";
26 else
27 echo "mismatch\n\twas: $ns\n\tbecame: $repr\n";