Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Floating point exception handling #38

Open
abgandar opened this issue Sep 16, 2022 · 0 comments
Open

Floating point exception handling #38

abgandar opened this issue Sep 16, 2022 · 0 comments
Assignees

Comments

@abgandar
Copy link
Collaborator

Problem

Currently, the DACE does not check for floating point exceptions in any of its calculations, nor are non-normal values taken into account when DA calculations are performed. This has some strange consequences, for example:

  • Anything multiplied by a zero DA becomes zero, even if the other DA contains infinities (overflows)
  • Tanh becomes zero due to this for large arguments causing overflow during sinh/cosh (see Wrong hyperbolic tangent for argument >> 0 #37)
  • most certainly other functions may suffer from similar effects

Open Questions

This is a very difficult problem for which we first have to answer several very basic question before a solution can be implemented.

What constitutes an error?

To really solve this, we have to decide what FP exceptions actually mean in DA context. Is an overflow in order 20 reason to make the entire DA invalid? Do we care about underflows?

How to signal errors

Should these throw visible exceptions/errors the user must handle right there (like sqrt(-1)) or should DAs have a silent error flag? Should there be several error flags indicating different errors (inf, nan, ...)? How is this exposed to the different DACE interfaces?

How to propagate errors

How does each and every built-in operation propagate errors / non-normal DA input? E.g. 1/inf = 0 is perfectly valid in FP, but inf/inf yields a nan.

How do we detect these problems in the first place?

  • Range checks for each function to make sure it can't overflow? How would this make sure the high order coefficients don't overflow either?
  • Checking each and every coefficient in a result for non-normal? Surely this will be incredibly slow...
  • Checking the FP environment flags after each DA operation for errors? Is this portable/reliable/fast? How does this interact with other libraries manipulating the FP environment (see here)
@abgandar abgandar self-assigned this Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant