cvs: php4 /ext/standard math.c

From: Date: Sat, 04 Aug 2001 18:29:37 +0000
Subject: cvs: php4 /ext/standard math.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-6553@lists.php.net to get a copy of this message
jeroen Sat Aug 4 14:29:37 2001 EDT Modified files: /php4/ext/standard math.c Log: Bugfix. All tests pass now on my system Index: php4/ext/standard/math.c diff -u php4/ext/standard/math.c:1.46 php4/ext/standard/math.c:1.47 --- php4/ext/standard/math.c:1.46 Sat Aug 4 09:11:17 2001 +++ php4/ext/standard/math.c Sat Aug 4 14:29:37 2001 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: math.c,v 1.46 2001/08/04 13:11:17 jeroen Exp $ */ +/* $Id: math.c,v 1.47 2001/08/04 18:29:37 jeroen Exp $ */ #include "php.h" #include "php_math.h" @@ -451,6 +451,7 @@ lbase = Z_LVAL_PP(zbase); + /* lexp != 0 */ switch (lbase) { case -1: RETURN_LONG( lexp & 1 ? -1 : 1 ); /* if lexp=odd ... */ @@ -464,6 +465,13 @@ } case 1: RETURN_LONG(1); + case LONG_MIN: /* special case since -LONG_MIN == 0 */ + /* lexp != 0, and only lexp==1 is LONG, DOUBLE otherwise */ + if (lexp == 1) { + RETURN_LONG(LONG_MIN); + } else { + RETURN_DOUBLE(exp(log(-(double)LONG_MIN) * (double)lexp)); + } default: /* abs(lbase) > 1 */ dval = exp(log((double) (lbase>0?lbase:-lbase)) *

« previous php.cvs (#6553) next »