archive

PHP: Significant Numbers

… and another one ….

Works on negative numbers too. $sigdigs should be >= 0

= 1) {
$number /= 10;
$multiplier *= 10;
}
return round($number, $sigdigs) * $multiplier;
}
?>

Comments are closed.