-
Notifications
You must be signed in to change notification settings - Fork 149
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
Arbitrary f32 and f64's should include special values #27
Comments
I agree, this would be nice to have. For what it's worth, Haskell's QuickCheck generates none of those values for its |
Does anyone know why Haskell's QuickCheck doesn't generate those special values? |
Including subnormals might be good too. |
Related problem: quickcheck! {
fn float_range(n: f64) -> bool {
n < 100.0 && n > -100.0
}
} This test never fails. quickcheck version = 0.4.2 |
Regarding Haskell's quickcheck and floats here is related discussion: |
Doesn't sound like an issue for Rust, just saying, due to |
This commit tweaks the Arbitrary impls of number types (integers, floats) to use the full range with a small bias toward "problem" values. This is a change from prior behavior that would use the `size` parameter to control the range of integers. In retrospect, using the `size` parameter this way was probably misguided. Instead, it should only be used to control the sizes of data structures instead of also constraining numeric ranges. By constraining numeric ranges, we leave out a huge space of values that are never tested. Fixes #27, Fixes #119, Fixes #190, Fixes #233, Closes #240
Currently
INFINITY
,NEG_INFINITY
,NAN
and possibly-0.0
are never generated by quickcheck. These values are valid floats, and should be tested for.The text was updated successfully, but these errors were encountered: