note 117742 added to function.intdiv

From: Date: Fri, 31 Jul 2015 09:34:26 +0000
Subject: note 117742 added to function.intdiv
Groups: php.notes 
Request: Send a blank email to php-notes+get-203232@lists.php.net to get a copy of this message
Without intdiv(), the following may be a good way (with $a and $b of type integer and not too big) : <?php (int)($a / $b) ?> because in case of divisible integers, the result will be integer and there is no risk of float appearing round but below their represented value (like the case (0.1+0.7)*10). $a and $b really needs to be of type integer though. If they are too big and indivisible, some precision will be lost during the conversion to float and the result may be inaccurate. ---- Server IP: 72.52.91.14 Probable Submitter: 93.93.42.250 ---- Manual Page -- http://php.net/manual/en/function.intdiv.php Edit -- https://master.php.net/note/edit/117742 Del: integrated -- https://master.php.net/note/delete/117742/integrated Del: useless -- https://master.php.net/note/delete/117742/useless Del: bad code -- https://master.php.net/note/delete/117742/bad+code Del: spam -- https://master.php.net/note/delete/117742/spam Del: non-english -- https://master.php.net/note/delete/117742/non-english Del: in docs -- https://master.php.net/note/delete/117742/in+docs Del: other reasons-- https://master.php.net/note/delete/117742 Reject -- https://master.php.net/note/reject/117742 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#203232) next »