-
Notifications
You must be signed in to change notification settings - Fork 226
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
ibeta_inv with subnormal a
or b
sets the FE_UNDERFLOW exception
#882
Comments
On the other hand, if I change the policy to disable promoting
That overflow is the result of |
OK, I have a fix in the works for the second case, but the first is more problematic. The question is this: do we want to store and reset FPU flags on every special function call? We can certainly do that, at some small extra cost, but note that this potentially effects every special function, as almost any expression can underflow harmlessly and the function still give the correct result. Likewise there may be (mostly) harmless overflows in all sorts of intermediate calculations... in this case I say "mostly" because some floating point types may not support infinity and almost anything might happen in that case. What do folks think? It would be relatively trivial to write a scoped object that saves and restores FPU exception flags, maybe with a sanity check for genuine underflow. It's really just a question of whether it's worth the effort. @WarrenWeckesser do you have a situation where these flags being set is more than just a minor nuisance? I must admit having the overflow flag incorrectly set just looks plain wrong. |
It depends, but in this case, it is fine just to know what to expect from boost/math. I ran into these behaviors while tracking down a seg. fault in the SciPy wrapper, and I wasn't sure if boost/math made any promises about the state of the flags after a call to a boost function. That seg. fault turned out to be a bug in the SciPy code that handled the overflow exception generated by a call such as |
@jzmaddock, after #883, with double promotion disabled, the call |
Can this issue be closed now, or are there still things to address? |
This is another case where I'm not sure if the behavior is expected, undefined or a bug. If I call
ibeta_inv(a, b, p)
witha
orb
a subnormal number with the default Policy (e.g.ibeta_inv(12.5, 1e-320, 0.9)
, on return the floating point exception flagFE_UNDERFLOW
is set. Does the default policy of ignoring underflow imply that the floating point flagFE_UNDERFLOW
should not be set on return?Demonstration code
The text was updated successfully, but these errors were encountered: