From: ngaugler at ngworld dot net Operating system: FreeBSD 4.9 / Linux 2.4.23 PHP version: 4.3.4 PHP Bug Type: Math related Bug description: The mod function of % does not return the same results of fmod.
Description: ------------ When performing a % (mod) function on two numbers, PHP returns negative values when it should not. Example: PHP: (2190988683 % 3) returns -1 fmod(2190988683,3) returns 0 Perl: (2190988683 % 3) returns 0 Reproduce code: --------------- <? echo "(2190988683 % 3) = " . (2190988683 % 3). "<br>\n"; echo "fmod(2190988683,3) = " . fmod(2190988683,3) . "<br>\n"; ?> Expected result: ---------------- (2190988683 % 3) = 0 fmod(2190988683,3) = 0 Actual result: -------------- (2190988683 % 3) = -1 fmod(2190988683,3) = 0 -- Edit bug report at http://bugs.php.net/?id=27064&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27064&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27064&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27064&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27064&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27064&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27064&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27064&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27064&r=support Expected behavior: http://bugs.php.net/fix.php?id=27064&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27064&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27064&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27064&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27064&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27064&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27064&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27064&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27064&r=float