Bug #66364 [Ana->Csd]: BCMath bcmul ignores scale parameter

From: Date: Mon, 18 Sep 2017 13:21:39 +0000
Subject: Bug #66364 [Ana->Csd]: BCMath bcmul ignores scale parameter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211209@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 Updated by: cmb@php.net Reported by: self at jacobbudin dot com Summary: BCMath bcmul ignores scale parameter -Status: Analyzed +Status: Closed Type: Bug Package: BC math related Operating System: Fedora 20 PHP Version: 5.5.7 Block user comment: N Private report: N New Comment: Automatic comment on behalf of cmbecker69@gmx.de Revision: http://git.php.net/?p=php-src.git;a=commit;h=870ed5106d6274905b5aa4341429deef12c92e55 Log: Fixed bug #66364 (BCMath bcmul ignores scale parameter) Previous Comments: ------------------------------------------------------------------------ [2016-12-06 17:29:46] powtac at gmx dot de The problem also exists on PHP 5.6.25 Ubuntu. ------------------------------------------------------------------------ [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 (#211209) next »