Bug #66364 [Com]: BCMath bcmul ignores scale parameter

From: Date: Tue, 06 Dec 2016 17:29:47 +0000
Subject: Bug #66364 [Com]: BCMath bcmul ignores scale parameter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205807@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66364&edit=1 ID: 66364 Comment by: powtac at gmx dot de Reported by: self at jacobbudin dot com Summary: BCMath bcmul ignores scale parameter Status: Analyzed Type: Bug Package: BC math related Operating System: Fedora 20 PHP Version: 5.5.7 Block user comment: N Private report: N New Comment: The problem also exists on PHP 5.6.25 Ubuntu. Previous Comments: ------------------------------------------------------------------------ [2016-07-27 05:16:27] pollita@php.net bcmul() *sort-of* ignores scale. What it does is treat the scale param as a "maximum scale". In the case of your example, the answer only has two significant decimal places, so the scale parameter of 4 is truncated to 2. That said, this seems to disagree with most other bcmath functions, so I'm less likely to call it a documentation problem and consider it a real bug. ------------------------------------------------------------------------ [2013-12-28 03:39:59] self at jacobbudin dot com Description: ------------ BCMath's bcmul function ignores the scale parameter. When the result's scale has fewer the digits than the requested scale, the trailing zeros are not appended to the returned string as is the case with bcadd, bcsub, and bcdiv. Test script: --------------- <?php echo bcmul("0.3", "0.2", 4); Expected result: ---------------- 0.0600 Actual result: -------------- 0.06 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66364&edit=1

« previous php.bugs (#205807) next »