Doc #52748 [Asn->Csd]: bcpow() - scale parameter doesn't influensce the result string

From: Date: Thu, 09 Sep 2010 05:45:59 +0000
Subject: Doc #52748 [Asn->Csd]: bcpow() - scale parameter doesn't influensce the result string
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-5007@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52748&edit=1 ID: 52748 Updated by: aharvey@php.net Reported by: k.schroeder@php.net Summary: bcpow() - scale parameter doesn't influensce the result string -Status: Assigned +Status: Closed Type: Documentation Problem Package: Documentation problem Operating System: Windows XP PHP Version: trunk-SVN-2010-08-30 (SVN) Assigned To: aharvey Block user comment: 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: ------------------------------------------------------------------------ [2010-09-09 07:45:42] aharvey@php.net Automatic comment from SVN on behalf of aharvey Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=303202 Log: Fix (doc) bug #52748 (bcpow() - scale parameter doesn't influensce the result string) by adding a clarifying note about bcpow's exact behaviour when dealing with scale. ------------------------------------------------------------------------ [2010-09-09 07:37:29] aharvey@php.net It actually does influence the result, but libbcmath's bc_raise() function manipulates the scale internally for its own purposes, so you may end up with a result of lesser scale than the scale parameter would indicate. (It appears that you'll never end up with a result of greater scale, though.) Morphing into a doc bug, since libbcmath itself appears to behave logically; I'll add a note to the bcpow() manual page that the result scale may not be quite what you expect. ------------------------------------------------------------------------ [2010-08-30 22:52:40] k.schroeder@php.net Description: ------------ Executing bcpow('-2', '5') and bcpow('-2', '5', 2) results in same string ("-32"). Test script: --------------- --TEST-- bcpow() - scale parameter doesn't influensce the result string --SKIPIF-- <?php if(! extension_loaded('bcmath')) print 'extension bcmath not loaded'; ?> --INI-- bcmath.scale=0 --FILE-- <?php var_dump(bcpow('-2', '5')); var_dump(bcpow('-2', '5', 2)); ?> --EXPECT-- string(3) "-32" string(5) "-32.00" Expected result: ---------------- string(3) "-32" string(5) "-32.00" Actual result: -------------- string(3) "-32" string(3) "-32" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52748&edit=1

« previous php.doc.bugs (#5007) next »