note 23967 added to language.operators.arithmetic

From: Date: Fri, 02 Aug 2002 11:54:52 +0000
Subject: note 23967 added to language.operators.arithmetic
Groups: php.notes 
Request: Send a blank email to php-notes+get-34143@lists.php.net to get a copy of this message
Someone wrote: (int)($foo / $bar) will not always work because the number "5" in float could actually be represented as 4.9999... etc. which (int) will convert to 4. To avoid this, you can add a real tiny fraction to the total, like this: (int)($foo / $bar + 0.0000001) -- http://www.php.net/manual/en/language.operators.arithmetic.php http://master.php.net/manage/user-notes.php?action=edit+23967 http://master.php.net/manage/user-notes.php?action=delete+23967 http://master.php.net/manage/user-notes.php?action=reject+23967

« previous php.notes (#34143) next »