ID: 41108 Updated by: [EMAIL PROTECTED] -Summary: pow() doesn't handle negative exponents Reported By: jack dot nerad at comcast dot net -Status: Open +Status: Verified Bug Type: Documentation problem -PHP Version: 6CVS-2007-04-17 (CVS) +PHP Version: Irrelevant New Comment:
Thank you guys for the bug report and patch, it's the right idea but the php manual has change logs for functions. Tasks for tackling this bug report: - Find out exactly which PHP version(s) this behavior changed - Add an entry to the changelog role in math/functions/pow.xml - Add an example to these docs using a negative exponent, and if appropriate add version info within the example comments - Decide if other functions were affected by this change in the php sources (See also: NEWS, php-src/) - If a 'fairly recent' change, add a nice example that works in all versions - Clean user notes A good starting place: - http://cvs.php.net/viewvc.cgi/php-src/ext/standard/math.c?view=log - http://php.net/manual/en/function.pow Previous Comments: ------------------------------------------------------------------------ [2007-04-18 20:23:24] ljbuesch at purdue dot edu ### Eclipse Workspace Patch 1.0 #P PHPDoc Index: en/reference/math/functions/pow.xml =================================================================== RCS file: /repository/phpdoc/en/reference/math/functions/pow.xml,v retrieving revision 1.11 diff -u -r1.11 pow.xml --- en/reference/math/functions/pow.xml 31 Mar 2007 19:18:23 -0000 1.11 +++ en/reference/math/functions/pow.xml 18 Apr 2007 20:18:37 -0000 @@ -16,11 +16,6 @@ Returns <parameter>base</parameter> raised to the power of <parameter>exp</parameter>. </para> - <note> - <para> - PHP cannot handle negative <parameter>exp</parameter>s. - </para> - </note> <warning> <para> In PHP 4.0.6 and earlier <function>pow</function> always returned ------------------------------------------------------------------------ [2007-04-18 06:09:11] [EMAIL PROTECTED] Made it a doc problem, which it is. It might be that in the past this negative exponent did not work though. ------------------------------------------------------------------------ [2007-04-18 00:36:25] jack dot nerad at comcast dot net Now that's turnaround time! I didn't even have to upgrade to the latest version! :) Actually, I was looking for how to do exponentiation in the docs, found pow(), and read: "Note: PHP cannot handle negative exps." at http://us.php.net/manual/en/function.pow.php There's pretty much only one way to read that, I think, so I didn't bother to look for features explicitly ruled out by the docs. In addition, there are a bunch of notes with hacks on how to get around the no negative exponents 'feature?' (shrug) Close this feature request, or whatever. Maybe change it to a bug in the docs? ------------------------------------------------------------------------ [2007-04-17 08:27:42] [EMAIL PROTECTED] What are you talking about? # php -r 'var_dump(pow(2,-2));' float(0.25) ------------------------------------------------------------------------ [2007-04-17 01:37:39] jack dot nerad at comcast dot net Description: ------------ It is a sin that PHP cannot handle negative exponents. Every other respectable language that has half the vocabulary that PHP has can handle negative exponents. Heck, even the windows calculator can handle negative exponents. Please. Mature and refine the language to include this ability. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41108&edit=1