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

Method Call

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

Source from the content-addressed store, hash-verified

155}
156
157func (p *Pow) Call(args []super.Value) super.Value {
158 a, b := args[0].Under(), args[1].Under()
159 if a.IsNull() || b.IsNull() {
160 return super.Null
161 }
162 if !super.IsNumber(a.Type().ID()) {
163 return p.sctx.WrapError("pow: not a number", args[0])
164 }
165 if !super.IsNumber(b.Type().ID()) {
166 return p.sctx.WrapError("pow: not a number", args[1])
167 }
168 x, _ := coerce.ToFloat(a, super.TypeFloat64)
169 y, _ := coerce.ToFloat(b, super.TypeFloat64)
170 return super.NewFloat64(math.Pow(x, y))
171}
172
173type Sqrt struct {
174 sctx *super.Context

Callers

nothing calls this directly

Calls 8

IsNumberFunction · 0.92
ToFloatFunction · 0.92
NewFloat64Function · 0.92
UnderMethod · 0.80
IsNullMethod · 0.80
WrapErrorMethod · 0.80
IDMethod · 0.65
TypeMethod · 0.65

Tested by

no test coverage detected