+ 1
Why 'round' function in python works like this
Output of print(round(51.5)) is 52 but output of print(round(52.5)) is also 52. Does anyone knows why this kolaveri D?
3 odpowiedzi
+ 3
If you want usual sense of rounding, write your own function
def myRound(num) :
if num % 1 == 0.5 :
return num + 0.5
else :
return round(num)
+ 5
Banker's rounding.
When summing up a large number of bank account amount, helps balance the error caused by keeping rounding up at 0.5
https://wiki.c2.com/?BankersRounding
+ 1
Is there any other round function which doesn't uses bankers rounding?