gitee.com/quant1x/num@v0.3.2/pow.go (about) 1 package num 2 3 import ( 4 "math" 5 ) 6 7 func Pow[T Number](v []T, n int) []T { 8 x := make([]T, len(v)) 9 for i := 0; i < len(v); i++ { 10 x[i] = __go_pow(v[i], n) 11 } 12 return x 13 } 14 15 func __go_pow[T Number](x T, n int) T { 16 y := math.Pow(float64(x), float64(n)) 17 return T(y) 18 }