if($a<$b),if($a==$b), if($a>$b), if($a!=$b)
one should useif(bccomp($a,$b)<0), if(bccomp($a,$b)==0), if(bccomp($a,$b)>0), if(bccomp($a,$b))
to be on the safe side.<?php $large_number1 = 2147483648; $large_number2 = 2147483647; $large_number3 = -2147483647; $large_number4 = -2147483648; var_dump($large_number1); echo "<br>\n"; var_dump($large_number2); echo "<br>\n"; var_dump($large_number3); echo "<br>\n"; var_dump($large_number4); echo "<br>\n"; ?>The output is
float(2147483648) int(2147483647) int(-2147483647) float(-2147483648)Example 2.
<?php $test1="10000000000000000"; $test2="10000000000000001"; if($test1>$test2){ echo "10000000000000000 > 10000000000000001<br>\n"; }elseif($test1==$test2){ echo "10000000000000000 = 10000000000000001<br>\n"; }else{ echo "10000000000000000 < 10000000000000001<br>\n"; } $t=bccomp($test1,$test2); if($t==1){ echo "10000000000000000 > 10000000000000001<br>\n"; }elseif($t==0){ echo "10000000000000000 = 10000000000000001<br>\n"; }else{ echo "10000000000000000 < 10000000000000001<br>\n"; } $t=strcmp($test1,$test2); if($t==1){ echo "10000000000000000 > 10000000000000001<br>\n"; }elseif($t==0){ echo "10000000000000000 = 10000000000000001<br>\n"; }else{ echo "10000000000000000 < 10000000000000001<br>\n"; } ?>The output is
10000000000000000 = 10000000000000001 10000000000000000 < 10000000000000001 10000000000000000 < 10000000000000001
$a="123456789123456";
instead of$a=123456789123456;
There seems to be no problem if $a has less than 15 digits.for($i="0";bccomp($i,$n)<0;$i++).
Instead this should be written asfor($i="0";bccomp($i,$n)<0;$i=bcadd($i,"1")).
Similarly, one cannot use i++ inside while.http://stackoverflow.com/questions/2516599/php-2d-array-output-all-combinations
print "matrix[$i][$j]=$matrix[$i][$j] "; /* does not work */ $t=$matrix[$i][$j]; print "matrix[$i][$j]=$t "; /* works */
sort -k2n -k1n ecubed_table > ecubed_table_sorted
to sort the list of the first 250,000 partial quotients of e3 into the list list, ordered with regard to increasing size.
Please email any comments or suggestions to Keith Matthews
Last modified 9th August 2017
Return to main page