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

Method Call

runtime/vam/expr/function/math.go:179–199  ·  view source on GitHub ↗
(args ...vector.Any)

Source from the content-addressed store, hash-verified

177}
178
179func (p *Pow) Call(args ...vector.Any) vector.Any {
180 if vec, ok := expr.CheckForNullThenError(args); ok {
181 return vec
182 }
183 a, b := vector.Under(args[0]), vector.Under(args[1])
184 if !super.IsNumber(a.Type().ID()) {
185 return vector.NewWrappedError(p.sctx, "pow: not a number", args[0])
186 }
187 if !super.IsNumber(b.Type().ID()) {
188 return vector.NewWrappedError(p.sctx, "pow: not a number", args[1])
189 }
190 a = cast.To(p.sctx, a, super.TypeFloat64)
191 b = cast.To(p.sctx, b, super.TypeFloat64)
192 vals := make([]float64, a.Len())
193 for i := range a.Len() {
194 x := vector.FloatValue(a, i)
195 y := vector.FloatValue(b, i)
196 vals[i] = math.Pow(x, y)
197 }
198 return vector.NewFloat(super.TypeFloat64, vals)
199}
200
201type Round struct {
202 sctx *super.Context

Callers

nothing calls this directly

Calls 10

CheckForNullThenErrorFunction · 0.92
UnderFunction · 0.92
IsNumberFunction · 0.92
NewWrappedErrorFunction · 0.92
ToFunction · 0.92
FloatValueFunction · 0.92
NewFloatFunction · 0.92
IDMethod · 0.65
TypeMethod · 0.65
LenMethod · 0.65

Tested by

no test coverage detected