php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #38573 BCMath bcmul not round the last decimal
Submitted: 2006-08-23 20:12 UTC Modified: 2011-06-14 16:50 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: jeanphilg at hotmail dot com Assigned: nlopess (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Unix
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jeanphilg at hotmail dot com
New email:
PHP Version: OS:

 

 [2006-08-23 20:12 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-06 10:34 UTC] nlopess@php.net
I already fixed this one (because of a user note).
 [2011-06-03 13:47 UTC] 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
 [2011-06-03 17:29 UTC] jeanphilg at hotmail dot com
-Status: Closed +Status: Assigned
 [2011-06-03 17:29 UTC] 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-14 16:50 UTC] aharvey@php.net
-Status: Assigned +Status: Closed -Assigned To: +Assigned To: nlopess
 [2011-06-14 16:50 UTC] aharvey@php.net
The example in the documentation has been right since revision 219196, which was committed in 2006, so I'm pretty happy leaving this closed. :)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 07 09:01:33 2025 UTC