mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-10-30 21:30:16 +00:00 
			
		
		
		
	fix overeager find-and-replace
This commit is contained in:
		| @@ -169,7 +169,7 @@ func ParseQuantity(str string) (*Quantity, error) { | |||||||
| 		return nil, ErrSuffix | 		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 { | 	if base == 10 { | ||||||
| 		amount.SetScale(amount.Scale() + inf.Scale(-exponent)) | 		amount.SetScale(amount.Scale() + inf.Scale(-exponent)) | ||||||
| 	} else if base == 2 { | 	} else if base == 2 { | ||||||
| @@ -184,12 +184,12 @@ func ParseQuantity(str string) (*Quantity, error) { | |||||||
| 	if sign == -1 { | 	if sign == -1 { | ||||||
| 		amount.Neg(amount) | 		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 | 	// value, under the theory that if you want some resources, you | ||||||
| 	// should get some resources, even if you asked for way too small | 	// should get some resources, even if you asked for way too small | ||||||
| 	// of an amount. | 	// of an amount. | ||||||
| 	// Arguably, this should be inf.RoundHalfUp (normal rounding), but | 	// 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) | 	amount.Round(amount, 3, inf.RoundUp) | ||||||
|  |  | ||||||
| 	// The max is just a simple cap. | 	// The max is just a simple cap. | ||||||
| @@ -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). | // Canonicalize returns the canonical form of q and its suffix (see comment on Quantity). | ||||||
| // | // | ||||||
| // Note about BinarySI: | // 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. | //   -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 | // * Otherwise, if q.Format is set to BinarySI, frational parts of q.Amount will be | ||||||
| //   rounded up. (1.1i becomes 2i.) | //   rounded up. (1.1i becomes 2i.) | ||||||
| @@ -257,7 +257,7 @@ func (q *Quantity) Canonicalize() (string, suffix) { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// TODO: If BinarySI formatting is requested but would cause rounding, upgrade to | 	// TODO: If BinarySI formatting is requested but would cause rounding, upgrade to | ||||||
| 	// bigOne of the other formats. | 	// one of the other formats. | ||||||
| 	switch format { | 	switch format { | ||||||
| 	case DecimalExponent, DecimalSI: | 	case DecimalExponent, DecimalSI: | ||||||
| 		mantissa := q.Amount.UnscaledBig() | 		mantissa := q.Amount.UnscaledBig() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user