note 31622 added to language.types.float

From: Date: Mon, 28 Apr 2003 12:44:07 +0000
Subject: note 31622 added to language.types.float
Groups: php.notes 
Request: Send a blank email to php-notes+get-47203@lists.php.net to get a copy of this message
The 'floating point precision' box in practice means: <? echo (69.1-floor(69.1)); ?> Think this'll return 0.1? It doesn't - it returns 0.099999999999994 <? echo round((69.1-floor(69.1))); ?> This returns 0.1 and is the workaround we use. Note that <? echo (4.1-floor(4.1)); ?> *does* return 0.1 - so if you, like us, test this with low numbers, you won't, like us, understand why all of a sudden your script stops working, until you spend a lot of time, like us, debugging it. So, that's all lovely then. -- http://www.php.net/manual/en/language.types.float.php http://master.php.net/manage/user-notes.php?action=edit+31622 http://master.php.net/manage/user-notes.php?action=delete+31622 http://master.php.net/manage/user-notes.php?action=reject+31622

« previous php.notes (#47203) next »