Python/numpy: catch IEEE-754 "inexact" exception

Viewed 111

numpy allows one to handle IEEE-754 exceptions originating from floating-point by using np.seterr appropriately. However seterr only supports the following keywords each corresponding to a IEEE-754 exception:

  • divide – Treatment for division by zero.
  • under – Treatment for floating-point overflow.
  • over – Treatment for floating-point overflow.
  • invalid – Treatment for invalid floating-point operation.

However, there's no keyword for the "inexact" IEEE-754 exception. How can one handle that in Python?

0 Answers
Related