note 95190 deleted from function.fmod by thiago
| From: | thiago@php.net | Date: | Thu, 17 Dec 2009 12:15:01 +0000 |
| Subject: | note 95190 deleted from function.fmod by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-164080@lists.php.net to get a copy of this message | ||
Note Submitter: nowhere at interest dot com
Reason: 5
----
Modulo only works for integer numbers.
$x = 5; $y = 2;
if($x%$y == fmod($x,$y)); //returns true
$x = 5.2; $y=2;
if($x%$y == fmod($x,$y)); //returns false
In the second example $x%$y returns 1 (5%2)
On the contrary $x%$y returns 1.2 (the real rest)