3 ms·
> If your language has bad defaults, you may have to ask for the right rounding mode explicitly. Is the author implying Rust's default rounding behavior is a b
by shhsshs 2y ago
> If your language has bad defaults, you may have to ask for the right rounding mode explicitly.
Is the author implying Rust's default rounding behavior is a bad default? In what world is "ties to even" a GOOD default?
- alkonaut 2y agoThe motivation for the seemingly strange rounding is that a set of numbers can be rounded before summing without biasing the sum. It has good use cases but so do all rounding modes.
- wizerno 2y agoIt's also called banker's rounding. To understand why it's a good default, you can check out https://mathematica.stackexchange.com/a/2120 https://mathematica.stackexchange.com/a/2120
- tavianator 2y agoIn general, if some recommendation from IEEE 754 (the floating-point standard) seems strange, its because someone like William Kahan thought about it in great detail and you'd be wise to follow it. https://en.wikipedia.org/wiki/Rounding#Rounding_half_to_even https://en.wikipedia.org/wiki/Rounding#Rounding_half_to_even