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

Reply via email to