note 33178 added to function.round

From: Date: Wed, 18 Jun 2003 10:39:35 +0000
Subject: note 33178 added to function.round
Groups: php.notes 
Request: Send a blank email to php-notes+get-50570@lists.php.net to get a copy of this message
The function below regards a higher number of digits for rounding as the number of digits you want to round! At least it rounds a Value to the number of digits you want to: function MyRound($iValue, $iDigits, $iPrecision){ $iDigits = intval($iDigits); $iPrecision = intval($iPrecision); if($iDigits > $iPrecision){ $iPrecision = $iDigits; } for($i = $iPrecision; $i >= $iDigits; $i--){ $iValue = round($iValue, $i); } // for($i = $iPrecision; $i >= $iDigits; $i--) -- END return $iValue; } ---- Manual Page -- http://www.php.net/manual/en/function.round.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33178 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33178&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33178&report=yes

« previous php.notes (#50570) next »