Bug #17492 Updated: pow() does not recognize integer numbers when cast as string
| From: | edink@php.net | Date: | Tue, 28 May 2002 20:01:26 +0000 |
| Subject: | Bug #17492 Updated: pow() does not recognize integer numbers when cast as string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-8798@lists.php.net to get a copy of this message | ||
ID: 17492
Updated by: edink@php.net
Reported By: joe@intware.tv
-Status: Open
+Status: Closed
Bug Type: Math related
Operating System: FreeBSD 4.5-RELEASE
PHP Version: 4.2.1
New Comment:
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a
documentation
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2002-05-28 15:51:01] joe@intware.tv
Here's code to replicate. Please see note below as to why these are
string values.
<?php
$base="2";
$exp="8";
echo pow($base,$exp);
?>
Gives me the error:
[28-May-2002 12:48:18] PHP Warning: Invalid argument(s) passed to
pow() in (....)/editMatrix.inc on line 74
---
This may seem a low-priority issue, however, in a matrix project I'm
working on the base/exponents are usually stored in a database, and the
functions to retrieve them are usually typecast as strings when
fetch()'ed and stored in an array. I have to assign temporary
variables with the value of the base and exponent re-assigned using
settype([$tmp_base|$tmp_exp],"integer") in order to get pow() to work.
This does not seem like a 'clean' solution, could perhaps pow() be a
little less strict as far as it's types, or is php heading towards
stricter casting for all functions?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=17492&edit=1