note 68469 added to language.types.float

From: Date: Thu, 27 Jul 2006 23:02:05 +0000
Subject: note 68469 added to language.types.float
Groups: php.notes 
Request: Send a blank email to php-notes+get-115289@lists.php.net to get a copy of this message
An update regarding the james dot cridland at virginradio dot co dot uk note below, I recently tried his formula using PHP 5 and it is necessary to specify the integer precision when using the round function, otherwise the output will be 0. <? echo round((69.1-floor(69.1))); ?> // prints 0 <? echo round((69.1-floor(69.1)), 1); ?> // prints 0.1 Also, it appears that "small numbers" include everything up to 64.0. So that <? echo (63.1-floor(63.1)); ?> will print 0.1 and <? echo (64.0-floor(64.0)); ?> will print 0, but <? echo round(64.1-floor(64.1)); ?> will print 0.099999999999994. ---- Server IP: 216.194.113.175 Probable Submitter: 208.44.135.19 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/language.types.float.php Edit -- http://master.php.net/note/edit/68469 Del: integrated -- http://master.php.net/note/delete/68469/integrated Del: useless -- http://master.php.net/note/delete/68469/useless Del: bad code -- http://master.php.net/note/delete/68469/bad+code Del: spam -- http://master.php.net/note/delete/68469/spam Del: non-english -- http://master.php.net/note/delete/68469/non-english Del: in docs -- http://master.php.net/note/delete/68469/in+docs Del: other reasons-- http://master.php.net/note/delete/68469 Reject -- http://master.php.net/note/reject/68469 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#115289) next »