Here's a function that rounds to the nearest whole number:
define function <round>
set string <round.input; $parameter(1)$>
set string <round.dotpos; $instr(#round.input#;.)$>
if ( #round.dotpos# = 0 ) then return <#round.input#>
else {
set numeric <round.leftchars; #round.dotpos# - 1>
set numeric <round.midchars; #round.dotpos# + 1>
set numeric <round.left; $left(#round.input#; %round.leftchars%)$>
set string <round.mid; $mid(#round.input#; %round.midchars%)$>
set numeric <round.up; 0.#round.mid#>
if ( %round.up% >= 0.5 ) then inc <round.left>
return <%round.left%>
}
end define
Examples:
$round(1.4)$ returns 1
$round(1.5)$ returns 2
$round(1.6)$ returns 2
$round(1234.567)$ returns 1235