Hi,
Is there any function to round up a floating point variable within the hoc code?
thanks and regards
Rounding up a variable
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Rounding up a variable
int truncates toward 0, returning the integer portion of its argument. So roll your own:
Code: Select all
func round() {
if ($1>0) {
return int($1+0.5)
} else {
return int($1-0.5)
}
}