kubernetes/vendor/github.com/google/cel-go/ext/math.go

// 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 work just as
// intended; however, there is some chance for collision.
//
// # Math.Greatest
//
// Returns the greatest valued number present in the arguments to the macro.
//
// Greatest is a variable argument count macro which must take at least one
// argument. Simple numeric and list literals are supported as valid argument
// types; however, other literals will be flagged as errors during macro
// expansion. If the argument expression does not resolve to a numeric or
// list(numeric) type during type-checking, or during runtime then an error
// will be produced. If a list argument is empty, this too will produce an
// error.
//
//	math.greatest(<arg>, ...) -> <double|int|uint>
//
// Examples:
//
//	math.greatest(1)      // 1
//	math.greatest(1u, 2u) // 2u
//	math.greatest(-42.0, -21.5, -100.0)   // -21.5
//	math.greatest([-42.0, -21.5, -100.0]) // -21.5
//	math.greatest(numbers) // numbers must be list(numeric)
//
//	math.greatest()         // parse error
//	math.greatest('string') // parse error
//	math.greatest(a, b)     // check-time error if a or b is non-numeric
//	math.greatest(dyn('string')) // runtime error
//
// # Math.Least
//
// Returns the least valued number present in the arguments to the macro.
//
// Least is a variable argument count macro which must take at least one
// argument. Simple numeric and list literals are supported as valid argument
// types; however, other literals will be flagged as errors during macro
// expansion. If the argument expression does not resolve to a numeric or
// list(numeric) type during type-checking, or during runtime then an error
// will be produced. If a list argument is empty, this too will produce an
// error.
//
//	math.least(<arg>, ...) -> <double|int|uint>
//
// Examples:
//
//	math.least(1)      // 1
//	math.least(1u, 2u) // 1u
//	math.least(-42.0, -21.5, -100.0)   // -100.0
//	math.least([-42.0, -21.5, -100.0]) // -100.0
//	math.least(numbers) // numbers must be list(numeric)
//
//	math.least()         // parse error
//	math.least('string') // parse error
//	math.least(a, b)     // check-time error if a or b is non-numeric
//	math.least(dyn('string')) // runtime error
//
// # Math.BitOr
//
// Introduced at version: 1
//
// Performs a bitwise-OR operation over two int or uint values.
//
//	math.bitOr(<int>, <int>) -> <int>
//	math.bitOr(<uint>, <uint>) -> <uint>
//
// Examples:
//
//	math.bitOr(1u, 2u)    // returns 3u
//	math.bitOr(-2, -4)    // returns -2
//
// # Math.BitAnd
//
// Introduced at version: 1
//
// Performs a bitwise-AND operation over two int or uint values.
//
//	math.bitAnd(<int>, <int>) -> <int>
//	math.bitAnd(<uint>, <uint>) -> <uint>
//
// Examples:
//
//	math.bitAnd(3u, 2u)   // return 2u
//	math.bitAnd(3, 5)     // returns 3
//	math.bitAnd(-3, -5)   // returns -7
//
// # Math.BitXor
//
// Introduced at version: 1
//
//	math.bitXor(<int>, <int>) -> <int>
//	math.bitXor(<uint>, <uint>) -> <uint>
//
// Performs a bitwise-XOR operation over two int or uint values.
//
// Examples:
//
//	math.bitXor(3u, 5u) // returns 6u
//	math.bitXor(1, 3)   // returns 2
//
// # Math.BitNot
//
// Introduced at version: 1
//
// Function which accepts a single int or uint and performs a bitwise-NOT
// ones-complement of the given binary value.
//
//	math.bitNot(<int>) -> <int>
//	math.bitNot(<uint>) -> <uint>
//
// Examples
//
//	math.bitNot(1)  // returns -1
//	math.bitNot(-1) // return 0
//	math.bitNot(0u) // returns 18446744073709551615u
//
// # Math.BitShiftLeft
//
// Introduced at version: 1
//
// Perform a left shift of bits on the first parameter, by the amount of bits
// specified in the second parameter. The first parameter is either a uint or
// an int. The second parameter must be an int.
//
// When the second parameter is 64 or greater, 0 will be always be returned
// since the number of bits shifted is greater than or equal to the total bit
// length of the number being shifted. Negative valued bit shifts will result
// in a runtime error.
//
//	math.bitShiftLeft(<int>, <int>) -> <int>
//	math.bitShiftLeft(<uint>, <int>) -> <uint>
//
// Examples
//
//	math.bitShiftLeft(1, 2)    // returns 4
//	math.bitShiftLeft(-1, 2)   // returns -4
//	math.bitShiftLeft(1u, 2)   // return 4u
//	math.bitShiftLeft(1u, 200) // returns 0u
//
// # Math.BitShiftRight
//
// Introduced at version: 1
//
// Perform a right shift of bits on the first parameter, by the amount of bits
// specified in the second parameter. The first parameter is either a uint or
// an int. The second parameter must be an int.
//
// When the second parameter is 64 or greater, 0 will always be returned since
// the number of bits shifted is greater than or equal to the total bit length
// of the number being shifted. Negative valued bit shifts will result in a
// runtime error.
//
// The sign bit extension will not be preserved for this operation: vacant bits
// on the left are filled with 0.
//
//	math.bitShiftRight(<int>, <int>) -> <int>
//	math.bitShiftRight(<uint>, <int>) -> <uint>
//
// Examples
//
//	math.bitShiftRight(1024, 2)    // returns 256
//	math.bitShiftRight(1024u, 2)   // returns 256u
//	math.bitShiftRight(1024u, 64)  // returns 0u
//
// # Math.Ceil
//
// Introduced at version: 1
//
// Compute the ceiling of a double value.
//
//	math.ceil(<double>) -> <double>
//
// Examples:
//
//	math.ceil(1.2)   // returns 2.0
//	math.ceil(-1.2)  // returns -1.0
//
// # Math.Floor
//
// Introduced at version: 1
//
// Compute the floor of a double value.
//
//	math.floor(<double>) -> <double>
//
// Examples:
//
//	math.floor(1.2)   // returns 1.0
//	math.floor(-1.2)  // returns -2.0
//
// # Math.Round
//
// Introduced at version: 1
//
// Rounds the double value to the nearest whole number with ties rounding away
// from zero, e.g. 1.5 -> 2.0, -1.5 -> -2.0.
//
//	math.round(<double>) -> <double>
//
// Examples:
//
//	math.round(1.2)  // returns 1.0
//	math.round(1.5)  // returns 2.0
//	math.round(-1.5) // returns -2.0
//
// # Math.Trunc
//
// Introduced at version: 1
//
// Truncates the fractional portion of the double value.
//
//	math.trunc(<double>) -> <double>
//
// Examples:
//
//	math.trunc(-1.3)  // returns -1.0
//	math.trunc(1.3)   // returns 1.0
//
// # Math.Abs
//
// Introduced at version: 1
//
// Returns the absolute value of the numeric type provided as input. If the
// value is NaN, the output is NaN. If the input is int64 min, the function
// will result in an overflow error.
//
//	math.abs(<double>) -> <double>
//	math.abs(<int>) -> <int>
//	math.abs(<uint>) -> <uint>
//
// Examples:
//
//	math.abs(-1)  // returns 1
//	math.abs(1)   // returns 1
//	math.abs(-9223372036854775808) // overflow error
//
// # Math.Sign
//
// Introduced at version: 1
//
// Returns the sign of the numeric type, either -1, 0, 1 as an int, double, or
// uint depending on the overload. For floating point values, if NaN is
// provided as input, the output is also NaN. The implementation does not
// differentiate between positive and negative zero.
//
//	math.sign(<double>) -> <double>
//	math.sign(<int>) -> <int>
//	math.sign(<uint>) -> <uint>
//
// Examples:
//
//	math.sign(-42) // returns -1
//	math.sign(0)   // returns 0
//	math.sign(42)  // returns 1
//
// # Math.IsInf
//
// Introduced at version: 1
//
// Returns true if the input double value is -Inf or +Inf.
//
//	math.isInf(<double>) -> <bool>
//
// Examples:
//
//	math.isInf(1.0/0.0)  // returns true
//	math.isInf(1.2)      // returns false
//
// # Math.IsNaN
//
// Introduced at version: 1
//
// Returns true if the input double value is NaN, false otherwise.
//
//	math.isNaN(<double>) -> <bool>
//
// Examples:
//
//	math.isNaN(0.0/0.0)  // returns true
//	math.isNaN(1.2)      // returns false
//
// # Math.IsFinite
//
// Introduced at version: 1
//
// Returns true if the value is a finite number. Equivalent in behavior to:
// !math.isNaN(double) && !math.isInf(double)
//
//	math.isFinite(<double>) -> <bool>
//
// Examples:
//
//	math.isFinite(0.0/0.0)  // returns false
//	math.isFinite(1.2)      // returns true
func Math() cel.EnvOption {}

const mathNamespace

const leastMacro

const greatestMacro

const minFunc

const maxFunc

const ceilFunc

const floorFunc

const roundFunc

const truncFunc

const isInfFunc

const isNanFunc

const isFiniteFunc

const absFunc

const signFunc

const bitAndFunc

const bitOrFunc

const bitXorFunc

const bitNotFunc

const bitShiftLeftFunc

const bitShiftRightFunc

var errIntOverflow

type MathOption

func MathVersion(version uint32) MathOption {}

type mathLib

// LibraryName implements the SingletonLibrary interface method.
func (*mathLib) LibraryName() string {}

// CompileOptions implements the Library interface method.
func (lib *mathLib) CompileOptions() []cel.EnvOption {}

// ProgramOptions implements the Library interface method.
func (*mathLib) ProgramOptions() []cel.ProgramOption {}

func mathLeast(meh cel.MacroExprFactory, target ast.Expr, args []ast.Expr) (ast.Expr, *cel.Error) {}

func mathGreatest(mef cel.MacroExprFactory, target ast.Expr, args []ast.Expr) (ast.Expr, *cel.Error) {}

func identity(val ref.Val) ref.Val {}

func ceil(val ref.Val) ref.Val {}

func floor(val ref.Val) ref.Val {}

func round(val ref.Val) ref.Val {}

func trunc(val ref.Val) ref.Val {}

func isInf(val ref.Val) ref.Val {}

func isFinite(val ref.Val) ref.Val {}

func isNaN(val ref.Val) ref.Val {}

func absDouble(val ref.Val) ref.Val {}

func absInt(val ref.Val) ref.Val {}

func sign(val ref.Val) ref.Val {}

func bitAndPairInt(first, second ref.Val) ref.Val {}

func bitAndPairUint(first, second ref.Val) ref.Val {}

func bitOrPairInt(first, second ref.Val) ref.Val {}

func bitOrPairUint(first, second ref.Val) ref.Val {}

func bitXorPairInt(first, second ref.Val) ref.Val {}

func bitXorPairUint(first, second ref.Val) ref.Val {}

func bitNotInt(value ref.Val) ref.Val {}

func bitNotUint(value ref.Val) ref.Val {}

func bitShiftLeftIntInt(value, bits ref.Val) ref.Val {}

func bitShiftLeftUintInt(value, bits ref.Val) ref.Val {}

func bitShiftRightIntInt(value, bits ref.Val) ref.Val {}

func bitShiftRightUintInt(value, bits ref.Val) ref.Val {}

func minPair(first, second ref.Val) ref.Val {}

func minList(numList ref.Val) ref.Val {}

func maxPair(first, second ref.Val) ref.Val {}

func maxList(numList ref.Val) ref.Val {}

func checkInvalidArgs(meh cel.MacroExprFactory, funcName string, args []ast.Expr) *cel.Error {}

func checkInvalidArgLiteral(funcName string, arg ast.Expr) error {}

func isNumericArgType(arg ast.Expr) bool {}

func isListLiteralWithNumericArgs(arg ast.Expr) bool {}

func maybeSuffixError(val ref.Val, suffix string) ref.Val {}