Closed gampleman closed 2 years ago
Random remark: Hypothesis, to do this, has had to do their own bit remapping of the IEEE 754 float format. But that might be more related to their "automatic shrinking" machinery that goes with "smaller bit representation == simpler value" assumption. I have some code doing that in Elm in my WIP PR in this repo.
Perhaps there is an easy-enough way to do this with current elm-explorations/test implementation and a custom shrinker though.
This is now implemented on master
and will be published in 2.0.0
! :tada: I think we can close this issue 🙂
Right now shrinkers for floats shrink towards zero. However, if the test doesn't fail at zero, you are likely to get wonderful values like
-9.99999e-7
and0.000001
.The problem is that floating point arithmetic can also produce small errors. This makes it hard to tell if the comparison is wrong or the algorithm is wrong.
I think it would be nicer to shrink towards integers. For me it is easier to work with
-3
and12
rather than-9.99999e-7
and0.000001
.