note 51878 rejected from language.operators.arithmetic by betz
| From: | betz@php.net | Date: | Wed, 13 Apr 2005 18:35:30 +0000 |
| Subject: | note 51878 rejected from language.operators.arithmetic by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-87970@lists.php.net to get a copy of this message | ||
Note Submitter: user at host dot network
----
tested on php 4.3.8..
sometimes modulus operand and fmod() don't work as expected..
<?php
for($i=15.00; $i <= 17.00; $i += 0.01)
echo $i . ' - ' . (($i*100)%100) . '<br />';
for($i=19.00; $i <= 21.00; $i += 0.01)
echo $i . ' - ' . (fmod($i, 1)*100) . '<br />';
?>
..
15.03 - 3
15.04 - 4
15.05 - 5
15.06 - 5
15.07 - 6
15.08 - 7
..
19.98 - 98
19.99 - 99
20 - 1.56319401867E-11
20.01 - 1.00000000002
20.02 - 2.00000000002
20.03 - 3.00000000002
20.04 - 4.00000000002
..