note 106961 deleted from function.round by googleguy

From: Date: Sun, 09 Dec 2012 08:13:57 +0000
Subject: note 106961 deleted from function.round by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-192408@lists.php.net to get a copy of this message
Note Submitter: LT Workshop ---- <?php /** * 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; } ?>

« previous php.notes (#192408) next »