2

I am trying to understand the difference between different rounding methods: Our application offers two different types of rounding:

In our unit tests, they seem to do the same thing for the cases being tested. However, I haven't found anyone in the office who can explain what is meant when selecting rounding mode of IEEE

2
  • 3
    What?! You don't already have unit tests to validate the difference between the two rounding methods? That seems like the easiest place to check and verify their operation.
    – user53019
    Commented Aug 4, 2014 at 20:01
  • @GlenH7 I'll be sure to add them now :p Commented Aug 4, 2014 at 20:03

2 Answers 2

2

According to wikipedia, IEEE 754 specifies round to even when the next digit is a 5, while the paper you cite says that a digit of 5 means add one to the preceding digit.

2
  • I was just typing an answer, that is the actual behavior in our application. However, where in that document does that say that it should round to even? Doesn't it say that there are 5 different types of tie-breakers? Commented Aug 4, 2014 at 20:09
  • @JuanMendes Under Round to even: "This is the default rounding mode used in IEEE 754 computing functions and operators."
    – clcto
    Commented Aug 4, 2014 at 20:10
1

I haven't fully figured it out. However, I know enough to keep working. IEEE rounding has 5 different modes. http://en.wikipedia.org/wiki/IEEE_floating_point#Rounding_rules

In our application, we are using C#'s default method, Math.round() which uses MidpointRounding.ToEven, that is, 4.5 rounds to 4 and 5.5 rounds to 6. So when our applications says IEEE rounding, they mean http://en.wikipedia.org/wiki/Rounding#Round_half_to_even

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.