Shrink.float improvement - #360
Merged
Merged
Conversation
jmid
force-pushed
the
shrink-float-polish
branch
from
October 30, 2025 08:52
14bcaaa to
2332a0c
Compare
Collaborator
Author
|
OK, I've now looked a bit more into this, refined it, and rebased it on top of #362.
To read the improvements
For now, I've kept the updates to all unit and expect test outputs triggered by each change.
Surely more improvements can be made, but I'm at a point of declaring "good-enough" ™️ FTR, the combination of
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR slightly improves the
QCheck.Shrink.floatalgorithm from #357.Specifically, when shrinking the leading digit, e.g.,
7in7.3542e45to1.3542e45,the PR explores using the existing
intshrinker (using repeated halving) to shrink the distancerather than repeated subtraction of
1..The first commit 3182638 documents the current behavior, whereas commit 7924e13 then documents the improvement.
Looking at the updated expect test outputs in 14bcaaa I'm however unsure whether this should be merged.
While the updates document fewer shrink steps used, producing
5.rather than4.as a counterexampleto "testinput <= pi" is unsatisfying.