diff options
author | Jeroen van Wolffelaar <jeroen@php.net> | 2001-08-04 18:29:37 +0000 |
---|---|---|
committer | Jeroen van Wolffelaar <jeroen@php.net> | 2001-08-04 18:29:37 +0000 |
commit | b245789bdbf35a06d7a6616a615802e5bec9433f (patch) | |
tree | d847efec0006d7867a9e6cbb6efa8f2c76eb1f16 | |
parent | cc40cdc7d760cedc6ed4bafa60a03b67c8b9e437 (diff) | |
download | php-git-b245789bdbf35a06d7a6616a615802e5bec9433f.tar.gz |
Bugfix. All tests pass now on my system
-rw-r--r-- | ext/standard/math.c | 8 |
1 files changed, 8 insertions, 0 deletions
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)) * |