MCPcopy Create free account
hub / github.com/cel-expr/cel-go / Scale

Function Scale

common/cost/model.go:760–762  ·  view source on GitHub ↗

Scale creates an expression that scales another expression by a constant factor, rounding up. Factors are constant so that a model's runtime charge depends only on the sizes reported by the sizing strategy. A cost which differs by argument type should be modeled with one OverloadModel per overload

(expr QuantityExpr, factor float64)

Source from the content-addressed store, hash-verified

758// exactly 1/10, and the product is computed exactly; an unbounded quantity stays unbounded; and
759// when a model is compiled, factors are moved outward so that each product is rounded once.
760func Scale(expr QuantityExpr, factor float64) QuantityExpr {
761 return scaleExpr{expr: expr, factor: factor, rat: rationalOf(factor)}
762}
763
764// Square creates an expression representing the square of another expression.
765func Square(expr QuantityExpr) QuantityExpr {

Callers 15

splitSizeFunction · 0.92
stringSubstringCostModelFunction · 0.92
setsCostModelFunction · 0.92
selfCompareCostFunction · 0.92
listSetOpCostModelFunction · 0.92
base64EncodeCostModelFunction · 0.92
base64DecodeCostModelFunction · 0.92
regexSearchFunction · 0.92
networkCIDRCompareCostFunction · 0.92
TestCostModelFunction · 0.92

Calls 1

rationalOfFunction · 0.85

Tested by 13

TestCostModelFunction · 0.74
TestQuantityAlgebraLawsFunction · 0.68
TestVersion1RevisionsFunction · 0.68
TestValidateRejectionsFunction · 0.68
TestQuantityExprs_TrackFunction · 0.68
TestOverloadConstructorsFunction · 0.68