Re: round

new topic     » goto parent     » topic index » view thread      » older message » newer message

I just can't resist threads like this... smile

Rolf said:
function round_gm(atom x) -- Round to greatest magnitude
    if x < 0 then
        return floor(x - 0.5)
    else
        return floor(x + 0.5)
    end if
end function

Rolf's function 'Carl'-ised smile
function round_gm(object x) -- Round to greatest magnitude
    return floor(x-.5)*(x<0)+floor(x+.5)*(x>0)
end function

Carl

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu