Doc #55426 [NEW]: pow() claims to return FALSE but actually does not
| From: | alex dot schuch at gmx dot de | Date: | Mon, 15 Aug 2011 19:10:08 +0000 |
| Subject: | Doc #55426 [NEW]: pow() claims to return FALSE but actually does not | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-7007@lists.php.net to get a copy of this message | ||
From:
Operating system: -/-
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:pow() claims to return FALSE but actually does not
Description:
------------
---
From manual page: http://www.php.net/function.pow%23Changelog
---
The manual says that pow() returns FALSE on error. Furthermore, it states
that
"PHP stops to emit a warning if the value can't be computed, it will now
silently return FALSE only." since PHP 4.2.0.
I checked the source code of PHP 4.2.0, PHP 5.2 and PHP 5.3 and I simply
cannot
find a case where FALSE is returned. I even tried values like INF, NAN,
-INF, 0,
1.5, -1.5, array(), new stdClass(), TRUE, FALSE, NULL for the arguments
$base
and $exp, but FALSE is never returned.
The result can be an integer, a float, or a pseudo-float like INF, NAN or
-INF,
but just never FALSE.
a) Is the documentation still right when stating that pow() can return
FALSE?
EDIT: I just checked the the source code of PHP 4.0.7 and there, FALSE can
be
returned.
Conclusion: Since PHP 4.2.0, no warning is emitted anymore, but neither can
a
FALSE be returned. It simply will return NAN on error.
Expected result:
----------------
Remove the line "If the power cannot be computed FALSE will be returned
instead."
and instead add "Be aware that non-finite values can be returned like INF,
-INF or
NAN in case of an error like overflow or underflow."
"Since 4.2.0 - PHP stops to emit a warning if the value can't be computed,
it will
now silently return FALSE only." should be changed to "Since 4.2.0 - PHP
stops to
emit a warning and return FALSE if the value can't be computer, it will
return
INF, -INF or NAN in case of an error."
--
Edit bug report at https://bugs.php.net/bug.php?id=55426&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55426&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55426&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55426&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=55426&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55426&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=55426&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=55426&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=55426&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=55426&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=55426&r=support
Expected behavior: https://bugs.php.net/fix.php?id=55426&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=55426&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=55426&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=55426&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55426&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=55426&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=55426&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=55426&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=55426&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=55426&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=55426&r=mysqlcfg