log(0) in any base (except 0, which would be silly) is an undefined number. the libc log() function will return an exceedingly small number to avoid causing widepsread panic when log(0) is attempted (-1.7976931348623E+308 shown below). The test function for log:
$x2 = (int) pow($base, log($x, $base)); attempts to check that $x2 is close to $x, but since log(0,*) will return an excessively small number, pow() winds up choking. Suggest: $x2 = (int) log(pow($x,base),$base); instead. -Pollita P.S. example below using log in base 1 is also nonsensical... only log(1,1) is a valid use of log with a base parameter of 1, any other value results in "undefined" > Hi, > > php4-STABLE-200211152030 dumps core on Tru64/Alpha with > ext/standard/tests/math/log.phpt: > > ---- EXPECTED OUTPUT > On failure, please mail result to [EMAIL PROTECTED] > 200 > 50 > 50 > 50 > 50 > 50 > 50 > 50 > 50 > 50 > ---- ACTUAL OUTPUT > On failure, please mail result to [EMAIL PROTECTED] > 200 > ---- FAILED > > Looking which values it doesn't like: > > # sapi/cli/php -r 'echo log(0, 2),"\n";' > Floating point exception (core dumped) > # sapi/cli/php -r 'echo log(0, 3),"\n";' > -1.6363308087894E+308 > # sapi/cli/php -r 'echo log(0, 10),"\n";' > -7.8072820862606E+307 > # sapi/cli/php -r 'echo log(0, 1),"\n";' > Floating point exception (core dumped) > # sapi/cli/php -r 'echo log(0),"\n";' > -1.7976931348623E+308 > > Regards... > Michael > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php