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

Float64sr round down for powers of two #74

Open
milankl opened this issue Dec 22, 2023 · 1 comment
Open

Float64sr round down for powers of two #74

milankl opened this issue Dec 22, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@milankl
Copy link
Owner

milankl commented Dec 22, 2023

julia> stochastic_round(Float64,Double64(2))
1.9999999999999998

because eps changes from [1,2) to [2,4) the eps calculated from 2 reaches into prevfloat(2.0) making it possible to round down from 2 at a chance of 1/4.

@milankl milankl added the bug Something isn't working label Dec 22, 2023
@milankl
Copy link
Owner Author

milankl commented Dec 22, 2023

@avleenk2312 I realised this issue today, but you're not using Float64sr anyway right? Also I believe in practice it's of very little importance although it looks bad because the chance to hit exactly 2 as a result of an arithmetic operation in a simulation are usually quite low?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant