Why round(14.5) is 14 instead of 15?

round(14.5) #Showing 14
round(13.5) #Showing 14

There is an explanation in

?round

that round goes to the even digit.

I believe this is one of the charming differences between what we are taught in math class versus what we are taught in computer class.

If you want to read more about rounding, see Rounding - Wikipedia

There are some other differences between math and computer science, for example in order of operations. Even Excel has some quirks. Enter = -3^2 in Excel and ask if you are happy with that result.

It is a nightmare across a lot of software.

curious.math.table.pdf (127.5 KB)

1 Like

Yes, besides the issue of whether -3^2 equals -(3^2) or (-3)^2, software differs on the order of successive exponentiation, where a^(b^c) does not usually equal (a^b)^c.

Use extra parentheses to be sure.