note 19389 added to function.printf

From: Date: Tue, 26 Feb 2002 12:20:59 +0000
Subject: note 19389 added to function.printf
Groups: php.notes 
Request: Send a blank email to php-notes+get-27054@lists.php.net to get a copy of this message
instead of writing a function to round off a float (let's call it 'x') accurately, it's much easier to add a small number to x and then truncate it... For example: if you want to round off to the nearest integer, just add 0.5 to x and then truncate it. if x=12.6, then it would calculate 13.1, and truncate it to 13. If x=14.4, it would calculate 14.9 and truncate it to 14. -- http://www.php.net/manual/en/function.printf.php http://master.php.net/manage/user-notes.php?action=edit+19389 http://master.php.net/manage/user-notes.php?action=delete+19389 http://master.php.net/manage/user-notes.php?action=reject+19389

« previous php.notes (#27054) next »