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

Function numericKey

interpreter/async.go:163–174  ·  view source on GitHub ↗

numericKey returns the canonical hash contribution for a CEL numeric value. Int, Uint, and Double all funnel through float64 because CEL numeric equality is heterogeneous and exact: any Int/Uint/Double values that compare equal convert to identical float64 bits. Values above 2^53 lose precision and

(d float64)

Source from the content-addressed store, hash-verified

161// identical float64 bits. Values above 2^53 lose precision and may share a bucket,
162// which is benign — findInBucket resolves it.
163func numericKey(d float64) uint64 {
164 if math.IsNaN(d) {
165 // matches treats NaN as equal to NaN for dispatch purposes, so collapse all
166 // payloads onto one quiet-NaN pattern.
167 return 0x7ff8000000000000
168 }
169 if d == 0 {
170 // Normalizes -0.0, which CEL equality treats as 0.0.
171 return 0
172 }
173 return math.Float64bits(d)
174}
175
176func hashArg(arg ref.Val) uint64 {
177 switch v := arg.(type) {

Callers 1

hashArgFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected