2

The IEEE754 standard defines five rounding rules. The first two round to a nearest value (ties to even, ties away from zero); the others are called directed roundings: towards zero, towards positive infinity and towards negative infinity. Which one of them is used most often and why?

Björn Lindqvist
  • 19,221
  • 20
  • 87
  • 122
Max Koretskyi
  • 101,079
  • 60
  • 333
  • 488

1 Answers1

2

The most often used mode is the default mode: round to nearest, tie to even.

Why? it's only a guess but:

  • minimizing the errors: directed rounding can have up to 1 ulp rounding error versus 1/2 ulp for round to nearest
  • avoiding rounding bias: tie away from zero might create a bias when thousands of rounding will be chained
aka.nice
  • 9,100
  • 1
  • 28
  • 40
  • can you please provide some an example for the _directed rounding can have up to 1 ulp rounding error versus 1/2 ulp for round to nearest_ ? – Max Koretskyi May 18 '16 at 08:26
  • 1
    @Maximus Suppose you are rounding up and add `1.0+1e-300`. The real number arithmetic result is **very** slightly greater than 1.0. In round up, the error would be `1 ulp - 1e-300`, almost a ulp. In round-to-nearest the error is `1e-300`. Similarly, consider rounding down and subtracting a tiny number from a representable number. – Patricia Shanahan May 18 '16 at 10:01
  • See also https://stackoverflow.com/questions/45223778/is-bankers-rounding-really-more-numerically-stable – nielses Jun 20 '22 at 19:07