kubernetes: Sign error in comment on resource.ScaledValue
Is this a BUG REPORT or FEATURE REQUEST?:
Uncomment only one, leave it on its own line:
/kind bug
/kind feature
What happened:
I invoked ScaledValue(-9)
on a resource.Quantity, and got a result that was multiplied by a factor of 10^9.
What you expected to happen: I expected to get a value that was multiplied by a factor of 10^-9, because the comment says “ScaledValue returns the value of ceil(q * 10^scale)”.
How to reproduce it (as minimally and precisely as possible):
q, _ := resource.ParseQuantity("10")
i := q.ScaledValue(-1)
print i
. You will find it is 100, not 1.
Anything else we need to know?:
Look at the meaning of the AsScaledInt64
method invoked in the integer case. This method returns the quantity expressed as a multiple of 10^scale. 10 is 100 tenths.
Environment:
- Kubernetes version (use
kubectl version
): master
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 32 (25 by maintainers)
I am sorry, but the comment was and remains wrong. I updated that PR with some support.