ID:               41802
 Updated by:       [EMAIL PROTECTED]
 Reported By:      cosborne83 at hotmail dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Documentation problem
 Operating System: Windows XP
 PHP Version:      5.2.3
 New Comment:

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation
better.

"Operands of modulus are converted to integers (by stripping the
decimal part) before processing. "


Previous Comments:
------------------------------------------------------------------------

[2007-06-25 14:35:25] [EMAIL PROTECTED]

This is how it works in C, hence this is how it should work in PHP.
Reclassified as docu problem.

------------------------------------------------------------------------

[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

Reply via email to