Skip to content
Prev 172098 / 398502 Next

rounding problem

Ted,

Actually, the documentation (at least for R-2.8.1) doesn't say that.  The
number 1.5 can be represented exactly on most systems that I know, and
therefore it will round to the even digit, i.e. round(1.5) = 2.0 .  The
documentation says that 0.15 cannot be represented exactly, and therefore
whether it rounds to 0.1 or 0.2 depends on the OS and the machine
architecture.  So on my WinXP Pentium IV system, 1.5 rounds to 2.0 and it
also happens that round(0.15, 1) equals 0.2  .  You say you want 1.5 to
round to 2.0.  What would you like the result of round(2.5) to equal?

Dan

Daniel Nordlund
Bothell, WA USA