Forum Moderators: coopster
Which configuration directive did you set in the
php.ini?
You may want to check out the BCMath Arbitrary Precision Mathematics Functions [php.net] that PHP has to offer as well.
in php.ini I put it as:
precision = 25
I've tried the BC functions and they work well. However, I need to maintain the same precision in other functions as well, e.g: pi(), cos(), sin()
<?php
ini_set('precision',25);
$abc1 = 0.04545454545454545454; //20 decimal points
$abc2 = 0.23232323232323232323; //20 decimal points
$abc1 = $abc1 + $abc2;
echo "<br>";
print "Result: " . $abc1;
echo "<p>";
$abc3 = 10/3;
print "abc3 " . $abc3;
print "<br>";
bcscale(25);
echo bcdiv(1100, 3) . "<br>";
echo bcmul(1234567890123456, 9876543210123456) . "<br>";
echo sin(1) . "<br>";
echo pi() . "<br>";
?>
/*
Using Windows Calculator (Scientific View)
sin(1) = 0.8414709848078965066525023216303//radian
pi = 3.1415926535897932384626433832795
PHP Result
abc3 3.3333333333333335
366.6666666666666666666666666
12193263112635260231976841383936
0.8414709848078965
3.1415926535897931
*/