Skip to content

fix: distinguish -0.0 from 0.0 when caching pack_key#18

Merged
h4l merged 2 commits intomainfrom
improve-kv-key2
Dec 26, 2024
Merged

fix: distinguish -0.0 from 0.0 when caching pack_key#18
h4l merged 2 commits intomainfrom
improve-kv-key2

Conversation

@h4l
Copy link
Owner

@h4l h4l commented Dec 26, 2024

test_increment_packed_key was failing because hypothesis generated an
example with -0.0, 0.0 which failed because pack_key was caching -0.0
and 0.0 as being equivalent, so the (cached) packed representation of
both was the same.

pack_key() now distinguishes negative/positive zero float values when
caching packed keys.

h4l added 2 commits December 26, 2024 06:56
test_increment_packed_key was failing because hypothesis generated an
example with -0.0, 0.0 which failed because pack_key was caching -0.0
and 0.0 as being equivalent, so the (cached) packed representation of
both was the same.

pack_key() now distinguishes negative/positive zero float values when
caching packed keys.
KvKey now implements __bytes__() to return the packed key value.
@h4l h4l merged commit ac235e6 into main Dec 26, 2024
23 checks passed
@h4l h4l deleted the improve-kv-key2 branch December 26, 2024 07:03
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