From: Jeroen van Wolffelaar Date: Sat, 4 Aug 2001 18:29:37 +0000 (+0000) Subject: Bugfix. All tests pass now on my system X-Git-Tag: PRE_ENGINE2_SPLIT~64 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b245789bdbf35a06d7a6616a615802e5bec9433f;p=php Bugfix. All tests pass now on my system --- diff --git a/ext/standard/math.c b/ext/standard/math.c index 1a448ac02c..378c206ff4 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -451,6 +451,7 @@ PHP_FUNCTION(pow) lbase = Z_LVAL_PP(zbase); + /* lexp != 0 */ switch (lbase) { case -1: RETURN_LONG( lexp & 1 ? -1 : 1 ); /* if lexp=odd ... */ @@ -464,6 +465,13 @@ PHP_FUNCTION(pow) } 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)) *