note 106961 added to function.round
| From: | LTWorkshop at osu1 dot php dot net | Date: | Wed, 21 Dec 2011 10:10:55 +0000 |
| Subject: | note 106961 added to function.round | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-185191@lists.php.net to get a copy of this message | ||
/**
* Normal Round Up Method
*
* @param double $val
* @param int $precision
* @return double
*/
function round_up ( $val, $precision ) {
$p = pow ( 10, $precision );
$a = $p * $val;
$b = ceil($a);
if((round($b - $a, 2) > 0.5)){
$b -= 1.0;
}
return $b / $p;
}
----
Server IP: 180.92.182.81
Probable Submitter: 203.186.131.38
----
Manual Page -- http://www.php.net/manual/en/function.round.php
Edit -- https://master.php.net/note/edit/106961
Del: integrated -- https://master.php.net/note/delete/106961/integrated
Del: useless -- https://master.php.net/note/delete/106961/useless
Del: bad code -- https://master.php.net/note/delete/106961/bad+code
Del: spam -- https://master.php.net/note/delete/106961/spam
Del: non-english -- https://master.php.net/note/delete/106961/non-english
Del: in docs -- https://master.php.net/note/delete/106961/in+docs
Del: other reasons-- https://master.php.net/note/delete/106961
Reject -- https://master.php.net/note/reject/106961
Search -- https://master.php.net/manage/user-notes.php