-
Notifications
You must be signed in to change notification settings - Fork 6
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
[BUG] Invalid stochastic rounding with infinite #48
Comments
Sorry @Thukisdo, missed that issue. Yes, I observed that earlier, but couldn't be bothered resolve this, as I didn't think this would be of practical importance. But maybe that's also me thinking that NaR (= one bitpattern for NaN, +-Inf) from posits is a good idea. I guess this could be resolved by another early exit, something like |
No problem :) Indeed, i also solved it using an early exit in my code. |
Happy for you to create a PR with your solution? |
I applied this fix in a C++ adaptation of your rounding method here, so i unfortunately do not have a patched Julia version. |
Thanks @Thukisdo, this is addressed in upcoming v0.6.1 as I've replaced the stochastic rounding via signed integer arithmetic with unsigned integers. This avoids any stochastic rounding between Inf and NaN and doesn't require a check for special cases like |
Hi,
We've spotted an issue in
Float32_stochastic_round()
where rounding an Infinite will sometime return NaN, where we may expect Infinite, see output below.The only difference between NaN and infinite is an empty mantissa, hence adding a random noise will result in NaN.
The text was updated successfully, but these errors were encountered: