Doc #38573 [Asn->Csd]: BCMath bcmul not round the last decimal
| From: | aharvey@php.net | Date: | Tue, 14 Jun 2011 14:50:30 +0000 |
| Subject: | Doc #38573 [Asn->Csd]: BCMath bcmul not round the last decimal | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-6747@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=38573&edit=1
ID: 38573
Updated by: aharvey@php.net
Reported by: jeanphilg at hotmail dot com
Summary: BCMath bcmul not round the last decimal
-Status: Assigned
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
Operating System: Unix
PHP Version: Irrelevant
-Assigned To:
+Assigned To: nlopess
Block user comment: N
Private report: N
New Comment:
The example in the documentation has been right since revision 219196, which was committed in 2006,
so I'm pretty happy leaving this closed. :)
Previous Comments:
------------------------------------------------------------------------
[2011-06-03 17:29:16] jeanphilg at hotmail dot com
robert, you're absolutely right.
nlopess, 5 years and this bug is still not corrected. Please take time to check my testcase
correctly before replying that's all is OK !
Thanks,
- JP 2011
------------------------------------------------------------------------
[2011-06-03 13:47:06] robert at idacmedia dot com
> I already fixed this one (because of a user note).
With the test case given by jeanphilg I still get 47.161.
PHP 5.3.5 with Win7 x64
------------------------------------------------------------------------
[2006-09-06 10:34:13] nlopess@php.net
I already fixed this one (because of a user note).
------------------------------------------------------------------------
[2006-08-23 20:12:27] jeanphilg at hotmail dot com
Description:
------------
This example is totally false :
echo bcmul('1.34747474747', '35', 3); //47.162
If you use this line of code in your app, PHP will not round the last decimal. The value will be
truncated at the third position and... here's the result :
-------> 47.161 <-------
Please at least change the doc.
- JP
Reproduce code:
---------------
//Give 47.161, not 47.162
echo bcmul('1.34747474747', '35', 3);
Expected result:
----------------
47.162
Actual result:
--------------
47.161
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=38573&edit=1