#43981 [Opn->Csd]: gmp_div_r does not preserve the sign of 1st argument
| From: | iliaa@php.net | Date: | Wed, 30 Jan 2008 18:27:11 +0000 |
| Subject: | #43981 [Opn->Csd]: gmp_div_r does not preserve the sign of 1st argument | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-121791@lists.php.net to get a copy of this message | ||
ID: 43981
Updated by: iliaa@php.net
Reported By: ikr at xiag dot ch
-Status: Open
+Status: Closed
Bug Type: Math related
Operating System: Linux 2.6.22.13-0.3-default SMP
PHP Version: 5.2.5
New Comment:
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
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2008-01-30 07:07:22] ikr at xiag dot ch
Description:
------------
PHP manual at http://ch2.php.net/manual/en/function.gmp-div-r.php
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.
-----
However,
print(gmp_strval(gmp_div_r(-5, 100)) . "\n");
Will result in "5", not "-5".
Reproduce code:
---------------
<?php
print(gmp_strval(gmp_div_r(-5, 100)) . "\n");
?>
Expected result:
----------------
-5
Actual result:
--------------
5
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43981&edit=1