4 ms·
The "0.5 rounds up" is kind of arbitrary, but it has the advantage of "you only need to look one digit out to round." 4.49 obviously rounds to 4. 4.51 obvious
by danielweber 12y ago
The "0.5 rounds up" is kind of arbitrary, but it has the advantage of "you only need to look one digit out to round."
4.49 obviously rounds to 4.
4.51 obviously rounds to 5.
4.50, since it "should"[1] follow the same rules as any other number that starts with "4.5", thus rounds to 5.
Say I were looking at a real number of arbitrary length, such that it starts with 4.500000000000... and maybe has a non-zero digit somewhere in it before it terminates. With the "round up on .5" rule, I don't have to keep on reading out indefinitely to round it.
[1] This "should" is assertion.