Edit report at https://bugs.php.net/bug.php?id=53397&edit=1
ID: 53397 Updated by: yohg...@php.net Reported by: mryaggi at hotmail dot com Summary: Modulo is not accurate with double -Status: Open +Status: Verified Type: Bug -Package: Variables related +Package: Scripting Engine problem Operating System: All PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Test with 5.5.1 32bit. This issue exists still. Previous Comments: ------------------------------------------------------------------------ [2010-11-24 15:12:40] mryaggi at hotmail dot com Description: ------------ In C++ : 1290594600000 % 86400000 = 37800000 //correct But In PHP : 1290594600000 % 86400000 = 30811200 //wrong However, in PHP : 1290594600000 - (floor(1290594600000/86400000)*86400000) = 37800000 //correct! Can modulo opertor be implemented this way when left value > PHP_INT_MAX ? See Patch in attachement Test script: --------------- echo 1290594600000 % 86400000; echo "\n"; echo 1290594600000 - (floor(1290594600000/86400000)*86400000); Expected result: ---------------- 37800000 37800000 Actual result: -------------- 30811200 37800000 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=53397&edit=1