Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for negativeScaleInt64 (0.21 sec)

  1. staging/src/k8s.io/apimachinery/pkg/api/resource/math.go

    				return 0, false
    			}
    		}
    		return value, true
    	}
    }
    
    // negativeScaleInt64 reduces base by the provided scale, rounding up, until the
    // value is zero or the scale is reached. Passing a negative scale is undefined.
    // The value returned, if not exact, is rounded away from zero.
    func negativeScaleInt64(base int64, scale Scale) (result int64, exact bool) {
    	if scale == 0 {
    		return base, true
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Jan 23 13:07:14 UTC 2020
    - 7.3K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apimachinery/pkg/api/resource/amount.go

    // return 1, because 0.000001 is rounded up to 1.
    func (a int64Amount) AsScaledInt64(scale Scale) (result int64, ok bool) {
    	if a.scale < scale {
    		result, _ = negativeScaleInt64(a.value, scale-a.scale)
    		return result, true
    	}
    	return positiveScaleInt64(a.value, a.scale-scale)
    }
    
    // AsDec returns an inf.Dec representation of this value.
    func (a int64Amount) AsDec() *inf.Dec {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Oct 13 19:42:28 UTC 2023
    - 9.3K bytes
    - Viewed (0)
  3. staging/src/k8s.io/apimachinery/pkg/api/resource/math_test.go

    		{-1000, 4, -1, false},
    
    		{0, 0, 0, true},
    		{0, 1, 0, true},
    		{0, 2, 0, true},
    
    		// negative scale is undefined behavior
    		{1000, -1, 1000, true},
    	} {
    		result, exact := negativeScaleInt64(test.base, test.scale)
    		if result != test.result {
    			t.Errorf("%v: unexpected result: %d", test, result)
    		}
    		if exact != test.exact {
    			t.Errorf("%v: unexpected exact: %t", test, exact)
    		}
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sun Jan 29 20:41:44 UTC 2017
    - 5.1K bytes
    - Viewed (0)
Back to top