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 AsApproximateFloat64() for BinarySI #103751
Conversation
Welcome @y-tag! |
Hi @y-tag. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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/test-infra repository. |
/assign @yliaog |
/ok-to-test |
/retest |
/lgtm |
/assign @deads2k |
@liggitt I would be grateful for your approval of this PR. |
/unassign |
{decQuantity(7*1024*1024, 4, BinarySI), (7 * 1024 * 1024) * 10000}, | ||
{decQuantity(7*1024*1024, 8, BinarySI), (7 * 1024 * 1024) * 100000000}, | ||
{decQuantity(7*1024*1024, -1, BinarySI), (7 * 1024 * 1024) * math.Pow10(-1)}, // '* Pow10' and '/ float(10)' do not round the same way | ||
{decQuantity(7*1024*1024, -8, BinarySI), (7 * 1024 * 1024) / float64(100000000)}, |
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.
Looks correct, please pull in the changes in #104757 (the additional test added to quantity_test.go and the change to scheduler resources_test.go to surface the problem).
The release note needs to be changed to read:
Scheduler resource metrics over fractional binary quantities (
2.5Gi
,1.1Ki
) were incorrectly reported as very small values.
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.
I appreciate your help! 🙇
I pulled in the changes in #104757 and updated the release note.
Looks good except for the additional test changes. Once those are integrated and the release note updated I'll tag. |
/priority important-soon |
Fractional binary SI quantities that cannot be represented as decimal internally were incorrectly calculated.
@smarterclayton Could you check if I have followed your instructions? |
/lgtm Thanks! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: smarterclayton, y-tag 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 |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #103748
Special notes for your reviewer:
Since
Format
, such asDecimalSI
andBinarySI
, would be used for conversion from/to string, the value ofAsApproximateFloat64()
does not depend onFormat
.After applying this patch, the result of
main.go
in #103748 changes as follow:Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: