note 87819 deleted from function.round by danbrown
| From: | danbrown@php.net | Date: | Tue, 18 Jan 2011 14:34:45 +0000 |
| Subject: | note 87819 deleted from function.round by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-175864@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Precision rounding. Works for any value, including negative values, and values between 1 and 0.
<?php
function roundPrecision($value, $precision=3 ){
$round = $precision - floor(log10(abs($value))) - 1;
return round($value, $round);
}
?>