How should I compute the maximum absolute and relative error of the following IEEE-754 floating-point expression?

a.y + (x - a.x) * ((b.y - a.y) / (b.x - a.x))

Also, we assume, that

  • the optimizer leaves the expression in the specified form
  • the default rounding mode (round to nearest even)
  • 3
    $\begingroup$ Hint: the absolute error on a sum/difference is the sum of the absolute errors and the relative error on a product/quotient is the sum of the relative errors. $\endgroup$
    – user16034
    May 29, 2018 at 12:27
  • $\begingroup$ Depending on the values, the absolute and relative error could be very high. Particularly when a.y is close to b.y or b.x is close to a.x, your error could be awful. $\endgroup$
    – HackerBoss
    Dec 15, 2020 at 19:18

2 Answers 2


IEEE 754 gives you the maximum relative error of each operation. You have three differences with a maximum relative error each. Multiplication and division adds the maximum relative error of each operand, plus the maximum relative error of the multiplication and division.

Then you have a final addition. If the right hand side is very close to the negative of the left hand side of the "+" then the relative error is unlimited. You'd need to analyse how close to -a.y the right hand side can be.

For absolute error, you convert the relative error of the right hand side into an absolute error.


Let the absolute errors on all variables be equal to $\delta$.

The absolute errors on the differences are $2\delta$ and the relative errors on the second term is


So the final absolute error,





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.