|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-10-05 20:40 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 12:00:01 2025 UTC |
Description: ------------ I used the fmod() function with float numbers, and it was an exact division, so it was supposed to return 0, instead of it, the Y value was returned. Reproduce code: --------------- <?php echo fmod(396456.06, 56636.58); ?> Expected result: ---------------- fmod(396456.06, 56636.58) = 0 Actual result: -------------- fmod(396456.06, 56636.58) = 56636.58 function f_mod($x,$y) { $i = floor($x / $y); $a = $x - $i * $y; return $a; } f_mod(396456.06, 56636.58) = 0