Source for file demo.php
Documentation is available at demo.php
// $Id: demo.php,v 1.3 2006/10/26 22:17:10 terrafrost Exp $
// Example of how to use of BigInteger. The output can be compared to the output that the BCMath functions would yield.
// bcpowmod is included with Math_BigInteger.php via PHP_Compat.
include('../Math_BigInteger.php');
$_result = $_x->add ($_y);
echo "\$result = \$x+\$y;\r\n";
echo $_result->toString ();
$result = bcsub ($result,$y);
$_result = $_result->subtract ($_y);
echo "\$result = \$result-\$y;\r\n";
echo $_result->toString ();
list ($_result,) = $_x->divide ($_y);
echo "\$result = \$x/\$y;\r\n";
echo $_result->toString ();
list (,$_result) = $_y->divide ($_z);
echo "\$result = \$x%\$y;\r\n";
echo $_result->toString ();
$_result = $_x->multiply ($_z);
echo "\$result = \$x*\$z;\r\n";
echo $_result->toString ();
$result = bcpowmod ($x,$y,$result);
$_result = $_x->modPow ($_y,$_result);
echo "\$result = (\$x**\$y)%\$result;\r\n";
echo $_result->toString ();
// modInverse isn't demo'd because no equivalent to it exists in BCMath.
Documentation generated on Thu, 16 Nov 2006 21:00:04 -0500 by phpDocumentor 1.3.0. PEAR Logo Copyright © PHP Group 2004.
|