Doc #55426 [Opn->Csd]: pow() claims to return FALSE but actually does not
| From: | bjori@php.net | Date: | Wed, 17 Aug 2011 10:50:34 +0000 |
| Subject: | Doc #55426 [Opn->Csd]: pow() claims to return FALSE but actually does not | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-7020@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55426&edit=1
ID: 55426
Updated by: bjori@php.net
Reported by: alex dot schuch at gmx dot de
Summary: pow() claims to return FALSE but actually does not
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
Operating System: -/-
PHP Version: Irrelevant
-Assigned To:
+Assigned To: bjori
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
Previous Comments:
------------------------------------------------------------------------
[2011-08-17 10:50:24] bjori@php.net
Automatic comment from SVN on behalf of bjori
Revision: http://svn.php.net/viewvc/?view=revision&revision=315057
Log: Sort the changelog properly, kill bogus warning and wrong error return value. fixes bug#55426
------------------------------------------------------------------------
[2011-08-15 19:10:08] alex dot schuch at gmx dot de
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 this bug report at https://bugs.php.net/bug.php?id=55426&edit=1