bcscale(100);/*
* Computes the natural logarithm using a series.
* @author Thomas Oldbury.
* @license Public domain.
*/functionbcln($a,$iter=10)
{$result="0.0";
for($i=0;$i
{$pow= (1+ (2*$i));$mul=bcdiv("1.0",$pow);$fraction=bcmul($mul,bcpow(bcsub($a,"1.0") /bcadd($a,"1.0"),$pow));$result=bcadd($fraction,$result);
}
returnbcmul("2.0",$result);
}/*
* Computes the base2 log using baseN log.
* @note Requires above functions.
* @author Thomas Oldbury.
* @license Public domain.
*/functionbclog2($a,$iter=10)
{
returnbcdiv(bcln($a,$iter),bcln("2",$iter));
}/*
* Computes the base10 log using baseN log.
* @note Requires above functions.
* @author Thomas Oldbury.
* @license Public domain.
*/functionbclog10($a,$iter=10)
{
returnbcdiv(bcln($a,$iter),bcln("10",$iter));
}?>