ID: 41802 Updated by: [EMAIL PROTECTED] Reported By: cosborne83 at hotmail dot com Status: Open -Bug Type: Scripting Engine problem +Bug Type: Documentation problem Operating System: Windows XP PHP Version: 5.2.3 New Comment:
This is how it works in C, hence this is how it should work in PHP. Reclassified as docu problem. Previous Comments: ------------------------------------------------------------------------ [2007-06-25 14:18:36] cosborne83 at hotmail dot com Description: ------------ When applying the % (modulo) operator to floats, the values are implicitly converted to int, which causes problems in many instances. This means that you can't use floats to store integer values larger than the maximum int value if you wish to perform modulo operations. Theis behaviour is also invalid since modulo is well defined on floats as well as ints. Reproduce code: --------------- $m = 5000000000; $n = 3.5; // Integer modulo but with large int stored as float print $m % 10; print "\n"; // Non-integer modulo. print $n % 1.5; Expected result: ---------------- 0 0.5 Actual result: -------------- 4 0 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41802&edit=1
