note 66807 deleted from function.floor by danbrown

From: Date: Thu, 10 Mar 2011 15:22:04 +0000
Subject: note 66807 deleted from function.floor by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-177761@lists.php.net to get a copy of this message
Note Submitter: Jared Fine ---- Due to the floating point precision issue (http://www.php.net/float) if you round() one additional decimal point prior to calling floor() you will get the expected result. For example: echo floor((0.1 + 0.7) * 10); // echo's 7 echo floor(round((0.1 + 0.7) * 10, 1)); // echo's 8

« previous php.notes (#177761) next »