php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #33549 Wrong result with bcmul()
Submitted: 2005-07-02 18:03 UTC Modified: 2005-07-04 09:28 UTC
From: a dot schilder at gmx dot de Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.0.4 OS: Win XP SP2
Private report: No CVE-ID: None
 [2005-07-02 18:03 UTC] a dot schilder at gmx dot de
Description:
------------
The result returned by bcmul() with the factor X (greater than 0) and 0.00001 is 0 - it's not the expected result.

Reproduce code:
---------------
// Does not work - result is 0:
bcmul(1, 0.00001, 5);

// This workaround does it - result 0.00001:
bcdiv(bcmul(1, 0.00010, 5), 10, 5);

Expected result:
----------------
The correct result 0.00001

Actual result:
--------------
0

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-04 01:38 UTC] sniper@php.net
If you pass the numbers as strings (as expected, although the manual has it wrong in the example), this works fine:

bcmul("1", "0.00001", 5);

Reclassified as documentation issue. (the bad examples in bcmath section)


 [2005-07-04 09:28 UTC] mazzanet@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 14 07:01:49 2024 UTC