After a recent discussion about mathematical rounding with my colleagues, we analyzed the rounding of different languages.
For example:
- MATLAB: "Round half away from zero"
- Python: "Round half to even"
I would not say the one is correct or the other isn't but whats bothers me is the combination of the writing in the Rust Book and what the documentation say about the round function.
The book 1:
Floating-point numbers are represented according to the IEEE-754 standard. The f32 type is a single-precision float, and f64 has double precision.
The documentation 2:
Returns the nearest integer to self. Round half-way cases away from 0.0.
My concern is that the standard rounding for IEEE-754 is "Round half to even".
Most collegues who I ask tend to use and learned mostly/only "Round half away from zero" and they where actually confused as I came up with different rounding strategies. Does the developer of rust decided because of that possible confusion against the IEEE standard?