Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 36 for RoundUp (0.12 sec)

  1. src/go/doc/testdata/benchmark.go

    	for n > 10 {
    		n = n / 10
    		tens++
    	}
    	// result = 10^tens
    	result := 1
    	for i := 0; i < tens; i++ {
    		result *= 10
    	}
    	return result
    }
    
    // roundUp rounds x up to a number of the form [1eX, 2eX, 5eX].
    func roundUp(n int) int {
    	base := roundDown10(n)
    	if n < (2 * base) {
    		return 2 * base
    	}
    	if n < (5 * base) {
    		return 5 * base
    	}
    	return 10 * base
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sun Oct 02 02:28:27 UTC 2022
    - 7.4K bytes
    - Viewed (0)
  2. src/math/big/decimal.go

    // If n < 0, x remains unchanged.
    func (x *decimal) round(n int) {
    	if n < 0 || n >= len(x.mant) {
    		return // nothing to do
    	}
    
    	if shouldRoundUp(x, n) {
    		x.roundUp(n)
    	} else {
    		x.roundDown(n)
    	}
    }
    
    func (x *decimal) roundUp(n int) {
    	if n < 0 || n >= len(x.mant) {
    		return // nothing to do
    	}
    	// 0 <= n < len(x.mant)
    
    	// find first digit < '9'
    	for n > 0 && x.mant[n-1] >= '9' {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 29 22:45:29 UTC 2020
    - 6.6K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/ssagen/pgen.go

    			}
    		}
    	}
    
    	s.stksize = types.RoundUp(s.stksize, s.stkalign)
    	s.stkptrsize = types.RoundUp(s.stkptrsize, s.stkalign)
    }
    
    const maxStackSize = 1 << 30
    
    // Compile builds an SSA backend function,
    // uses it to generate a plist,
    // and flushes that plist to machine code.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 15:44:14 UTC 2024
    - 13.1K bytes
    - Viewed (0)
  4. src/go/doc/testdata/testing.1.golden

    	// 
    	func min(x, y int) int
    
    	// 
    	func parseCpuList()
    
    	// roundDown10 rounds a number down to the nearest power of 10. 
    	func roundDown10(n int) int
    
    	// roundUp rounds x up to a number of the form [1eX, 2eX, 5eX]. 
    	func roundUp(n int) int
    
    	// startAlarm starts an alarm if requested. 
    	func startAlarm()
    
    	// stopAlarm turns off the alarm. 
    	func stopAlarm()
    
    	// 
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 8.4K bytes
    - Viewed (0)
  5. src/strconv/decimal.go

    		return
    	}
    	if shouldRoundUp(a, nd) {
    		a.RoundUp(nd)
    	} else {
    		a.RoundDown(nd)
    	}
    }
    
    // Round a down to nd digits (or fewer).
    func (a *decimal) RoundDown(nd int) {
    	if nd < 0 || nd >= a.nd {
    		return
    	}
    	a.nd = nd
    	trim(a)
    }
    
    // Round a up to nd digits (or fewer).
    func (a *decimal) RoundUp(nd int) {
    	if nd < 0 || nd >= a.nd {
    		return
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Jul 15 19:41:25 UTC 2017
    - 11K bytes
    - Viewed (0)
  6. staging/src/k8s.io/apimachinery/pkg/api/resource/amount.go

    // was lost. (1.1e5).AsScale(5) would return 1.1e5, but (1.1e5).AsScale(6) would return 1e6.
    func (a infDecAmount) AsScale(scale Scale) (infDecAmount, bool) {
    	tmp := &inf.Dec{}
    	tmp.Round(a.Dec, scale.infScale(), inf.RoundUp)
    	return infDecAmount{tmp}, tmp.Cmp(a.Dec) == 0
    }
    
    // AsCanonicalBytes accepts a buffer to write the base-10 string value of this field to, and returns
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Oct 13 19:42:28 UTC 2023
    - 9.3K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go

    		return q.d.AsScale(scale)
    	}
    	return q.i.AsScale(scale)
    }
    
    // RoundUp updates the quantity to the provided scale, ensuring that the value is at
    // least 1. False is returned if the rounding operation resulted in a loss of precision.
    // Negative numbers are rounded away from zero (-9 scale 1 rounds to -10).
    func (q *Quantity) RoundUp(scale Scale) bool {
    	if q.d.Dec != nil {
    		q.s = ""
    		d, exact := q.d.AsScale(scale)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 29 21:48:10 UTC 2024
    - 23.8K bytes
    - Viewed (0)
  8. pkg/quota/v1/evaluator/core/persistent_volume_claims.go

    	var result *resource.Quantity
    	roundUpFunc := func(i *resource.Quantity) *resource.Quantity {
    		roundedRequest := i.DeepCopy()
    		if !roundedRequest.RoundUp(0) {
    			// Ensure storage requests are counted as whole byte values, to pass resourcequota validation.
    			// See https://issue.k8s.io/94313
    			return &roundedRequest
    		}
    		return i
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Sep 23 23:36:24 UTC 2022
    - 9.2K bytes
    - Viewed (0)
  9. pkg/apis/core/v1/defaults.go

    	for key, val := range *obj {
    		// TODO(#18538): We round up resource values to milli scale to maintain API compatibility.
    		// In the future, we should instead reject values that need rounding.
    		const milliScale = -3
    		val.RoundUp(milliScale)
    
    		(*obj)[v1.ResourceName(key)] = val
    	}
    }
    
    func SetDefaults_ReplicationController(obj *v1.ReplicationController) {
    	var labels map[string]string
    	if obj.Spec.Template != nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Apr 19 22:24:15 UTC 2024
    - 14.8K bytes
    - Viewed (0)
  10. src/cmd/compile/internal/ssagen/abi.go

    	}
    
    	ir.InitLSym(fn, true)
    
    	setupWasmABI(fn)
    
    	pp := objw.NewProgs(fn, 0)
    	defer pp.Free()
    	pp.Text.To.Type = obj.TYPE_TEXTSIZE
    	pp.Text.To.Val = int32(types.RoundUp(fn.Type().ArgWidth(), int64(types.RegSize)))
    	// Wrapper functions never need their own stack frame
    	pp.Text.To.Offset = 0
    	pp.Flush()
    
    	return true
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 19:57:43 UTC 2024
    - 13.8K bytes
    - Viewed (0)
Back to top