#25650 [Opn->Bgs]: Bad number return by % operator
| From: | pollita@php.net | Date: | Thu, 25 Sep 2003 14:14:36 +0000 |
| Subject: | #25650 [Opn->Bgs]: Bad number return by % operator | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-48091@lists.php.net to get a copy of this message | ||
ID: 25650
Updated by: pollita@php.net
Reported By: jserrano at cutb dot edu dot co
-Status: Open
+Status: Bogus
Bug Type: Math related
Operating System: Mandrake 9.1
PHP Version: 4.3.1
New Comment:
63522 * 61826 is greater than the largest possible value for an integer
on a 32-bit system (2147483647).
In order to work with values of this size you must either use the
bcmath or gmp functions, or upgrade to a 64-bit processor.
Previous Comments:
------------------------------------------------------------------------
[2003-09-25 02:19:57] jserrano at cutb dot edu dot co
Description:
------------
the Operator % (modular division) return a erroneous result.
Reproduce code:
---------------
$a = 63522;
$b = 62186;
echo "a = 63522\n";
echo "b = 62186\n";
echo $num."\n";
$mod = ($a*$b) % 65536;
echo "mod = $mod";
Expected result:
----------------
$a = 63522;
$b = 62186;
$num = $a*$b;
echo $num."\n";
$p = $num/65536;
echo (int)$p."\n";
$num = $num-((int)$p*65536);
echo "re-mod = $num";
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25650&edit=1