Doc #66288 [Nab]: pow() gives unexpected results if exponent is negative
| From: | datibbaw@php.net | Date: | Sat, 14 Dec 2013 00:20:28 +0000 |
| Subject: | Doc #66288 [Nab]: pow() gives unexpected results if exponent is negative | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-10710@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66288&edit=1
ID: 66288
Updated by: datibbaw@php.net
Reported by: mattT1227 at gmail dot com
Summary: pow() gives unexpected results if exponent is
negative
Status: Not a bug
Type: Documentation Problem
Package: *General Issues
PHP Version: 5.5.7
Block user comment: N
Private report: N
New Comment:
The square root of 4 is calculated with a power of 1/2, i.e.
pow(4, 0.5) == float(2)
Previous Comments:
------------------------------------------------------------------------
[2013-12-13 22:15:00] rasmus@php.net
By the way, where is the suspended bug on this? We should mark that as Not-a-bug as well. 4^-2 is
the same as 1/(4^2) which is most definitely not the same as the square root of 4. Where in the
world did you get that from?
------------------------------------------------------------------------
[2013-12-13 18:24:51] aharvey@php.net
pow() handles negative exponents fine: pow(4, -2) is 0.0625, which seems correct to me and also to
Wolfram|Alpha: http://www.wolframalpha.com/input/?i=4^-2
Closing not a bug.
------------------------------------------------------------------------
[2013-12-13 16:11:35] mattT1227 at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.pow
---
At least show example that negative exponents are not correctly implemented by pow.
Note, reporting system shows this problem has been suspended. It is still a problem.
Test script:
---------------
echo pow(4, -2); // should be same as square root of 4
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66288&edit=1