Warp wrote:
> Slime <fak### [at] email address> wrote:
>> floor( A + 0.5 )
>
>> (Although this will cause -3.5 to be rounded to -3, which I'm not sure is
>> correct.)
you could use ceil(A-0.5) in that case or even use a switch for >0 and <0
>
> Why would rounding it to -4 be more correct? 3.5 is equally close to
> either value.
>
depends on convention. There as thus 4 ways to round halves:
up,down,towards zero and away from zero.
Post a reply to this message
|