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

Shrink NaN to canonical form #4279

Merged
merged 15 commits into from
Feb 27, 2025
Merged

Shrink NaN to canonical form #4279

merged 15 commits into from
Feb 27, 2025

Conversation

jobh
Copy link
Contributor

@jobh jobh commented Feb 27, 2025

Closes #4277.

The first issue (-nan) is a one-liner, switching from sign_aware_lte to math.copysign to detect the sign of a choice.

Second issue (struct.unpack('d', struct.pack('Q', 0xfff8000000000001))[0]) requires distinguishing NaNs in float shrinking, so that code is reshuffled a bit to separate out the "immutable" value for the shrinker from the "hashable" value for tracking of seen values.

@jobh jobh force-pushed the nan-shrink branch 3 times, most recently from 1c8bae9 to 6f2447c Compare February 27, 2025 17:09
Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

happy to merge as-is 🙂

@Zac-HD Zac-HD merged commit e789d4b into HypothesisWorks:master Feb 27, 2025
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shrink NaN to canonical form
3 participants