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

cmp/internal/value: fix handling of negative zero for floats #152

Merged
merged 2 commits into from
Aug 5, 2019

Conversation

dsnet
Copy link
Collaborator

@dsnet dsnet commented Aug 5, 2019

  • Fix IsZero to properly report false for IsZero(-0.0) since
    we define IsZero as whether it is equal to the zero memory value.
  • Add note to isLess that we don't need to handle -0.0 since
    we can't possibly have both keys present in the same map.
  • Use sort.SliceStable in SortedKeys for deterministic output since
    it is possible to have both -0.0 and +0.0 from two different maps.
    The zero key from the left left map will be taken over the right map.

Fix IsZero to properly report false for IsZero(-0.0) since
we define IsZero as whether it is equal to the zero memory value.
Add note to isLess that we don't need to handle -0.0 since
we can't possibly have both keys present in the same map.
Use sort.SliceStable in SortedKeys for deterministic output since
it is possible to have both -0.0 and +0.0 from two different maps.
@dsnet dsnet requested a review from neild August 5, 2019 19:44
@dsnet dsnet merged commit 2d0692c into master Aug 5, 2019
@dsnet dsnet deleted the fix-float-zero branch August 5, 2019 20:51
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.

None yet

2 participants