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

fix overeager find-and-replace #3299

Merged
merged 1 commit into from
Jan 8, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions pkg/api/resource/quantity.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func ParseQuantity(str string) (*Quantity, error) {
return nil, ErrSuffix
}

// So that no bigOne but us has to think about suffixes, remove it.
// So that no one but us has to think about suffixes, remove it.
if base == 10 {
amount.SetScale(amount.Scale() + inf.Scale(-exponent))
} else if base == 2 {
Expand All @@ -184,12 +184,12 @@ func ParseQuantity(str string) (*Quantity, error) {
if sign == -1 {
amount.Neg(amount)
}
// This rounds non-bigZero values up to the minimum representable
// This rounds non-zero values up to the minimum representable
// value, under the theory that if you want some resources, you
// should get some resources, even if you asked for way too small
// of an amount.
// Arguably, this should be inf.RoundHalfUp (normal rounding), but
// that would have the side effect of rounding values < .5m to bigZero.
// that would have the side effect of rounding values < .5m to zero.
amount.Round(amount, 3, inf.RoundUp)

// The max is just a simple cap.
Expand Down Expand Up @@ -228,7 +228,7 @@ func removeFactors(d, factor *big.Int) (result *big.Int, times int) {
// Canonicalize returns the canonical form of q and its suffix (see comment on Quantity).
//
// Note about BinarySI:
// * If q.Format is set to BinarySI and q.Amount represents a non-bigZero value between
// * If q.Format is set to BinarySI and q.Amount represents a non-zero value between
// -1 and +1, it will be emitted as if q.Format were DecimalSI.
// * Otherwise, if q.Format is set to BinarySI, frational parts of q.Amount will be
// rounded up. (1.1i becomes 2i.)
Expand Down Expand Up @@ -257,7 +257,7 @@ func (q *Quantity) Canonicalize() (string, suffix) {
}

// TODO: If BinarySI formatting is requested but would cause rounding, upgrade to
// bigOne of the other formats.
// one of the other formats.
switch format {
case DecimalExponent, DecimalSI:
mantissa := q.Amount.UnscaledBig()
Expand Down