(args ...vector.Any)
| 177 | } |
| 178 | |
| 179 | func (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 | |
| 201 | type Round struct { |
| 202 | sctx *super.Context |
nothing calls this directly
no test coverage detected