#25650 [NEW]: Bad number return by % operator
| From: | jserrano at cutb dot edu dot co | Date: | Thu, 25 Sep 2003 06:19:57 +0000 |
| Subject: | #25650 [NEW]: Bad number return by % operator | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-48076@lists.php.net to get a copy of this message | ||
From: jserrano at cutb dot edu dot co
Operating system: Mandrake 9.1
PHP version: 4.3.1
PHP Bug Type: Math related
Bug description: Bad number return by % operator
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 bug report at http://bugs.php.net/?id=25650&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25650&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25650&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25650&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25650&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25650&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25650&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25650&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25650&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25650&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25650&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25650&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25650&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25650&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25650&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25650&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25650&r=float