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

Function Math

ext/math.go:345–351  ·  view source on GitHub ↗

Math returns a cel.EnvOption to configure namespaced math helper macros and functions. Note, all macros use the 'math' namespace; however, at the time of macro expansion the namespace looks just like any other identifier. If you are currently using a variable named 'math', the macro will likely wor

(options ...MathOption)

Source from the content-addressed store, hash-verified

343// math.sqrt(985.25) // returns 31.388692231439016
344// math.sqrt(-15) // returns NaN
345func Math(options ...MathOption) cel.EnvOption {
346 m := &mathLib{version: math.MaxUint32}
347 for _, o := range options {
348 m = o(m)
349 }
350 return cel.Lib(m)
351}
352
353const (
354 mathNamespace = "math"

Callers 6

initFunction · 0.92
evaluator.goFile · 0.92
TestMathWithExtensionFunction · 0.85
TestMathVersionsFunction · 0.85
testMathEnvFunction · 0.85

Calls 1

LibFunction · 0.92

Tested by 4

initFunction · 0.74
TestMathWithExtensionFunction · 0.68
TestMathVersionsFunction · 0.68
testMathEnvFunction · 0.68