-
-
Notifications
You must be signed in to change notification settings - Fork 478
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
Randomizer.Double returns Infinity for certain inputs #422
Comments
ChristoWolf
changed the title
Randomizer.Double return Infinity for certain inputs
Randomizer.Double returns Infinity for certain inputs
Jun 18, 2022
ChristoWolf
added a commit
to ChristoWolf/Bogus
that referenced
this issue
Jun 19, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @bchavez!
Version Information
What locale are you using with Bogus?
en
What is the expected behavior?
Calling
Random.Double(double.MinValue, double.MaxValue)
should generated adouble
between these constraints.What is the actual behavior?
The method always returns
Infinity
.This does not happen though when using e.g.
double.MinValue, 0
0, double.MaxValue
.A quick look at the
Double
method revealed that there is no magnitute/value limitation in line 186.In particular, the calculation
(max - min) + min
causes this behavior.Similar behavior can be reproduced for the
Float
andDecimal
randomizers.Please provide a stack trace.
Any possible solutions?
See proposed solution in PR #429.
How do you reproduce the issue?
See above.
Do you have a unit test that can demonstrate the bug?
Added to PR #429.
Can you identify the location in Bogus' source code where the problem exists?
See above.
If the bug is confirmed, would you be willing to submit a PR?
Submitted PR #429.
The text was updated successfully, but these errors were encountered: