First of all, I've read this question and all the related answers. As explained there, the round
function rounds a half number to the nearest even number. A simple example:
>>> round(0.5)
0
>>> round(1.5)
2
>>> round(2.5)
2
>>> round(3.5)
4
>>> round(4.5)
4
>>> round(5.5)
6
Now, I still don't understand how the round
function works when we set the number of digits:
>>> round(0.05, 1)
0.1
>>> round(0.15, 1)
0.1
>>> round(0.25, 1)
0.2
>>> round(0.35, 1)
0.3
>>> round(0.45, 1)
0.5
>>> round(0.55, 1)
0.6
>>> round(0.65, 1)
0.7
>>> round(0.75, 1)
0.8
>>> round(0.85, 1)
0.8
>>> round(0.95, 1)
0.9
What's going on here? Why am I getting these results and what's the rationale behind them? It doesn't look like it is using even numbers.