MCPcopy Create free account
hub / github.com/expr-lang/expr / Negate

Function Negate

vm/runtime/runtime.go:276–305  ·  view source on GitHub ↗
(i any)

Source from the content-addressed store, hash-verified

274}
275
276func Negate(i any) any {
277 switch v := i.(type) {
278 case float32:
279 return -v
280 case float64:
281 return -v
282 case int:
283 return -v
284 case int8:
285 return -v
286 case int16:
287 return -v
288 case int32:
289 return -v
290 case int64:
291 return -v
292 case uint:
293 return -v
294 case uint8:
295 return -v
296 case uint16:
297 return -v
298 case uint32:
299 return -v
300 case uint64:
301 return -v
302 default:
303 panic(fmt.Sprintf("invalid operation: - %T", v))
304 }
305}
306
307func Exponent(a, b any) float64 {
308 return math.Pow(ToFloat64(a), ToFloat64(b))

Callers 1

RunMethod · 0.92

Calls 1

SprintfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…