The following is a rounding function for whole numbers, not decimals as $round() does.
; Usage: $roundint(Number).P <---- Returns Number rounded to the nearest prop
; 'P' above must be a multiple of 10 and positive
; Example: $roundint(77).100 <--- returns 100
; Example II: $roundint(23).100 <--- returns 0
; Usage: $roundint(Number).P <---- Returns Number rounded to the nearest prop
; 'P' above must be a multiple of 10 and positive
; Example: $roundint(77).100 <--- returns 100
; Example II: $roundint(23).100 <--- returns 0
alias roundint {
if ($isid) {
if ((!$1) || (!$prop) || ($prop !isnum)) { return Invalid Parameter }
else {
if ($1 !>= $prop) {
return $iif($1 >= $calc($prop / 2),$prop,$calc($1 - $right($1,$count($prop,0))))
}
else {
return $iif($right($1,$count($prop,0)) >= $calc($prop / 2),$calc($1 + ($prop - $right($1,$count($prop,0)))),$calc($1 - $right($1,$count($prop,0))))
}
}
}
}