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
Member

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.
cmp/internal/value: fix handling of negative zero for floats
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 Aug 5, 2019

@neild

neild approved these changes Aug 5, 2019

@dsnet dsnet merged commit 2d0692c into master Aug 5, 2019

3 checks passed

cla/google All necessary CLAs are signed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@dsnet dsnet deleted the fix-float-zero branch Aug 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.