-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
util: fix codec for negative zero | tidb-test=pr/2427 #57343
Conversation
Hi @wshwsh12. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #57343 +/- ##
================================================
+ Coverage 72.9236% 73.4596% +0.5359%
================================================
Files 1672 1672
Lines 462267 462315 +48
================================================
+ Hits 337102 339615 +2513
+ Misses 104417 102008 -2409
+ Partials 20748 20692 -56
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/retest |
@wshwsh12: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
@@ -22,7 +22,7 @@ import ( | |||
|
|||
func encodeFloatToCmpUint64(f float64) uint64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some comments to make it more readable
func encodeFloatToCmpUint64(f float64) uint64 {
u := math.Float64bits(f)
// Check the sign bit (the highest bit in the IEEE 754 representation).
// If the sign bit is 0, the number is non-negative (+0 is considered non-negative).
if u&signMask == 0 {
// For non-negative numbers (+0 included), set the sign bit to 1.
// This ensures non-negative numbers are ordered after negative numbers
// when compared as unsigned integers.
u |= signMask
} else {
// For negative numbers (-0 included), invert all bits.
// This reorders negative numbers so that the smallest (closest to 0)
// has the smallest encoded value, and the most negative has the largest.
u = ^u
}
return u
}
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: guo-shaoge, XuHuaiyu The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
/retest |
@wshwsh12: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/test fast_test_tiprow |
@wshwsh12: The specified target(s) for
The following commands are available to trigger optional jobs:
Use
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@wshwsh12: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/ok-to-test |
/test fast_test_tiprow |
@wshwsh12: The specified target(s) for
The following commands are available to trigger optional jobs:
Use
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
In response to a cherrypick label: new pull request created to branch |
…)" This reverts commit 2cb550a.
This reverts commit 9b26569.
What problem does this PR solve?
Issue Number: close #41878
Negative zero is incorrectly converted to zero after being encoded and then decoded.
Problem Summary:
Correctly handle the encoding issue of negative zero.
What changed and how does it work?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.