Hacker News new | past | comments | ask | show | jobs | submit login

> I have seen banking regulators getting upset in the past because of roundings not following the usual convention ("banker's rounding").

That… is exactly the behaviour python implements, and what GP was surprised by…

It is also, incidentally, the IEEE 754 recommendation.

Python 2 used to round away from 0.




Ok sorry, I think that's me misinterpreting what banker's rounding mean. But I know the regulator will expect round(0.5) = 1, not 0.


Banker's rounding is "round to even", because it limits the amount of bias introduced by the rounding.

> But I know the regulator will expect round(0.5) = 1, not 0.

That's not necessarily the most helpful, as there's at least two tie-breakings which provide that, but differ in their treatment of negative numbers (round up or round to +∞, and round away from zero or round to ∞).




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: