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

From: Date: Thu, 09 Sep 2010 05:37:30 +0000
Subject: Bug->Doc #52748 [Opn->Asn]: bcpow() - scale parameter doesn't influensce the result string
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-5006@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: Open +Status: Assigned -Type: Bug +Type: Documentation Problem -Package: BC math related +Package: Documentation problem Operating System: Windows XP PHP Version: trunk-SVN-2010-08-30 (SVN) -Assigned To: +Assigned To: aharvey Block user comment: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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 (#5006) next »