#25751 [Ana->Csd]: pow() function return errors
| From: | nlopess@php.net | Date: | Sun, 22 Feb 2004 20:07:28 +0000 |
| Subject: | #25751 [Ana->Csd]: pow() function return errors | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969359149@lists.php.net to get a copy of this message | ||
ID: 25751
Updated by: nlopess@php.net
Reported By: dbjm at comcast dot net
-Status: Analyzed
+Status: Closed
Bug Type: Documentation problem
Operating System: *
PHP Version: Irrelevant
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:
------------------------------------------------------------------------
[2003-10-03 22:07:36] sniper@php.net
There are some documentation problems:
1. pow() no longer shows any errors, even if parameters are invalid
2. pow(-1,1.1) produces complex number which PHP does not support.
For dbjm at comcast dot net:
Look manual for "is_finite()" function.
------------------------------------------------------------------------
[2003-10-03 18:12:12] dbjm at comcast dot net
Description:
------------
The pow() function returns incorrect numbers when using a negative
number base.
This is not a crisis to fix for me - I have worked around it.
Thanks for the great work on developing PHP.
Sincerely,
Dave
Reproduce code:
---------------
echo "pow(3.125, 3.125) = " . pow(3.125, 3.125). "<br>";
echo "pow(-3.125, 3.125) = " . pow(-3.125, 3.125). "<br>";
echo "pow(3.125, -3.125) = " . pow(3.125, -3.125). "<br>";
echo "pow(-3.125, -3.125) = " . pow(-3.125, -3.125). "<br>";
Expected result:
----------------
When the same calcualtion is made using Visual Basic the results are:
3.125 ^ 3.125 = 35.1889507775869
-3.125 ^ 3.125 = -35.1889507775869
3.125 ^ -3.125 = 2.84180112763389E-02
-3.125 ^ -3.125 = -2.84180112763389E-02
Actual result:
--------------
Windows 2000:
pow(3.125, 3.125) = 35.1889507776
pow(-3.125, 3.125) = -1.#IND
pow(3.125, -3.125) = 0.0284180112763
pow(-3.125, -3.125) = -1.#IND
Linux 9:
pow(3.125, 3.125) = 35.188950777587
pow(-3.125, 3.125) = NAN
pow(3.125, -3.125) = 0.028418011276339
pow(-3.125, -3.125) = NAN
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25751&edit=1