note 51748 added to function.round
| From: | bobson at oak dot pl | Date: | Sat, 09 Apr 2005 17:16:25 +0000 |
| Subject: | note 51748 added to function.round | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-87761@lists.php.net to get a copy of this message | ||
I rewrite rounding function to not to use php round(). Seems to work properly.
function myRound($val,$d){
$dd = pow(10,$d);
$f = 0.5/$dd;
return ((int) (($val+$f)*$dd))/$dd;
};
----
Manual Page -- http://www.php.net/manual/en/function.round.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51748
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51748&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51748&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51748&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51748&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51748&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51748&report=yes
Search -- http://master.php.net/manage/user-notes.php