MCPcopy Create free account
hub / github.com/brimdata/super / Call

Method Call

runtime/sam/expr/function/math.go:15–33  ·  view source on GitHub ↗
(args []super.Value)

Source from the content-addressed store, hash-verified

13}
14
15func (a *Abs) Call(args []super.Value) super.Value {
16 val := args[0].Under()
17 if val.IsNull() {
18 return val
19 }
20 switch id := val.Type().ID(); {
21 case super.IsUnsigned(id):
22 return val
23 case super.IsSigned(id):
24 x := val.Int()
25 if x < 0 {
26 x = -x
27 }
28 return super.NewInt(val.Type(), x)
29 case super.IsFloat(id):
30 return super.NewFloat(val.Type(), math.Abs(val.Float()))
31 }
32 return a.sctx.WrapError("abs: not a number", val)
33}
34
35type Ceil struct {
36 sctx *super.Context

Callers

nothing calls this directly

Calls 12

IsUnsignedFunction · 0.92
IsSignedFunction · 0.92
NewIntFunction · 0.92
IsFloatFunction · 0.92
NewFloatFunction · 0.92
UnderMethod · 0.80
IsNullMethod · 0.80
FloatMethod · 0.80
WrapErrorMethod · 0.80
IDMethod · 0.65
TypeMethod · 0.65
IntMethod · 0.45

Tested by

no test coverage detected