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

Fix denormal double parsing #135

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

aschmolck
Copy link

Constant._parse_float64 blows up on denormal doubles. This PR fixes this, adds a few more test cases and also slightly cleans up _parse_float32 (missing base 16 for int call in an assertion, removal of always false test if mantissa_bits == 23 etc).

@aschmolck
Copy link
Author

aschmolck commented Sep 25, 2023

For what it's worth, I'm not sure if there's some reason to prefer converting to a hex float literal and then parsing that to just doing something something like return struct.unpack("<Q", struct.pack("d", number))[0] for float64 and return struct.unpack("<L", struct.pack("f", number))[0] for float32.

I mostly stuck to the hex parsing approach because that's what the existing code was already using.

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.

1 participant