php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46564 bcmod( '1071', '357.5' ) returns '0'
Submitted: 2008-11-13 12:46 UTC Modified: 2011-11-16 13:23 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: shelby at coolpage dot com Assigned:
Status: Closed Package: BC math related
PHP Version: 5.*, 6CVS (2009-04-01) OS: *
Private report: No CVE-ID: None
 [2008-11-13 12:46 UTC] shelby at coolpage dot com
Description:
------------
bcmod( '1071', '357.5' ) returns '0'

Reproduce code:
---------------
echo bcmod( '1071', '357.5' );

Expected result:
----------------
bcmod( '1071', '357.5' ) should return '356'


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-13 13:03 UTC] support at coolpage dot com
Here is function that works correctly:

function bcmod( $op, $mod, $scale )
{
   while( ($t = bcsub( $op, $mod, $scale )) > 0 ) $op = $t;
   return $op;
}
 [2008-11-13 13:20 UTC] shelby at coolpage dot com
Correction, need ">= 0":

function bcmod( $op, $mod, $scale )
{
   while( ($t = bcsub( $op, $mod, $scale )) >= 0 ) $op = $t;
   return $op;
}
 [2011-11-16 13:23 UTC] felipe@php.net
-Status: Verified +Status: Bogus
 [2011-11-16 13:23 UTC] felipe@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Not a PHP bug.
 [2011-11-16 14:22 UTC] shelby at coolpage dot com
Is it your position that the bug is in a 3rd party library that PHP uses for the 
BC math API?

If yes, is it your position that marking a bug as bogus, is okay even while the 
API performs erroneous to the documentation?

Thanks for providing yet another evidence that bug reporting is a waste of time.
 [2017-01-07 18:10 UTC] nikic@php.net
Automatic comment on behalf of liborm85@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=90dcbbe3cb9aed197cbb854afe2eed0f6479a95a
Log: Fixed bug #46564
 [2017-01-07 18:10 UTC] nikic@php.net
-Status: Not a bug +Status: Closed
 [2017-01-12 09:12 UTC] krakjoe@php.net
Automatic comment on behalf of liborm85@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=90dcbbe3cb9aed197cbb854afe2eed0f6479a95a
Log: Fixed bug #46564
 [2017-09-09 13:02 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=343029
Log: Document change due to fixing bug #46564
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC