Re: ext/standard/tests/math/log.phpt coredump on Tru64

From: Date: Sun, 17 Nov 2002 00:46:18 +0000
Subject: Re: ext/standard/tests/math/log.phpt coredump on Tru64
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-91157@lists.php.net to get a copy of this message
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 php-dev@lists.php.net > 200 > 50 > 50 > 50 > 50 > 50 > 50 > 50 > 50 > 50 > ---- ACTUAL OUTPUT > On failure, please mail result to php-dev@lists.php.net > 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

« previous php.dev (#91157) next »