|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43981 gmp_div_r does not preserve the sign of 1st argument
Submitted: 2008-01-30 07:07 UTC Modified: 2008-01-30 18:27 UTC
From: ikr at xiag dot ch Assigned:
Status: Closed Package: Math related
PHP Version: 5.2.5 OS: Linux SMP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: ikr at xiag dot ch
New email:
PHP Version: OS:


 [2008-01-30 07:07 UTC] ikr at xiag dot ch
PHP manual at claims 
for gmp_div_r:

resource gmp_div_r ( resource $n , resource $d [, int $round ] )
Calculates remainder of the integer division of n by d . The remainder 
has the sign of the n argument, if not zero.


print(gmp_strval(gmp_div_r(-5, 100)) . "\n");

Will result in "5", not "-5".

Reproduce code:

print(gmp_strval(gmp_div_r(-5, 100)) . "\n");


Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-30 18:27 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 24 08:01:29 2024 UTC