88// AVG(x...)
99// Returns the average of all values of X
1010var avg = func (x ... interface {}) interface {} {
11- if values , ok := cast .AsFloatArray (flatten (x )... ); ok {
11+ if values , ok := cast .AsFloat64Slice (flatten (x )... ); ok {
1212 if s , err := stats .Mean (values ); err == nil {
1313 return s
1414 }
@@ -38,7 +38,7 @@ var countdistinct = func(x ...interface{}) interface{} {
3838// CUSUM(x...)
3939// Returns the cumulative sum of values of X
4040var cusum = func (x ... interface {}) interface {} {
41- if values , ok := cast .AsFloatArray (flatten (x )... ); ok {
41+ if values , ok := cast .AsFloat64Slice (flatten (x )... ); ok {
4242 if s , err := stats .CumulativeSum (values ); err == nil {
4343 return s
4444 }
@@ -49,7 +49,7 @@ var cusum = func(x ...interface{}) interface{} {
4949// MAX(x...)
5050// Returns the maximum value of X
5151var max = func (x ... interface {}) interface {} {
52- if values , ok := cast .AsFloatArray (flatten (x )... ); ok {
52+ if values , ok := cast .AsFloat64Slice (flatten (x )... ); ok {
5353 if s , err := stats .Max (values ); err == nil {
5454 return s
5555 }
@@ -60,7 +60,7 @@ var max = func(x ...interface{}) interface{} {
6060// MEDIAN(x...)
6161// Returns the median of all values of X
6262var median = func (x ... interface {}) interface {} {
63- if values , ok := cast .AsFloatArray (flatten (x )... ); ok {
63+ if values , ok := cast .AsFloat64Slice (flatten (x )... ); ok {
6464 if s , err := stats .Median (values ); err == nil {
6565 return s
6666 }
@@ -71,7 +71,7 @@ var median = func(x ...interface{}) interface{} {
7171// MIN(x...)
7272// Returns the minimum value of X
7373var min = func (x ... interface {}) interface {} {
74- if values , ok := cast .AsFloatArray (flatten (x )... ); ok {
74+ if values , ok := cast .AsFloat64Slice (flatten (x )... ); ok {
7575 if s , err := stats .Min (values ); err == nil {
7676 return s
7777 }
@@ -82,8 +82,8 @@ var min = func(x ...interface{}) interface{} {
8282// PERCENTILE(r, x...)
8383// Returns the percentile rank R of X
8484var percentile = func (r interface {}, x ... interface {}) interface {} {
85- if rank , rok := cast .AsFloat (r ); rok {
86- if values , ok := cast .AsFloatArray (flatten (x )... ); ok {
85+ if rank , rok := cast .AsFloat64 (r ); rok {
86+ if values , ok := cast .AsFloat64Slice (flatten (x )... ); ok {
8787 if s , err := stats .Percentile (values , rank ); err == nil {
8888 return s
8989 }
@@ -95,7 +95,7 @@ var percentile = func(r interface{}, x ...interface{}) interface{} {
9595// STDDEV(x...)
9696// Returns the standard deviation of X
9797var stddev = func (x ... interface {}) interface {} {
98- if values , ok := cast .AsFloatArray (flatten (x )... ); ok {
98+ if values , ok := cast .AsFloat64Slice (flatten (x )... ); ok {
9999 if s , err := stats .StandardDeviation (values ); err == nil {
100100 return s
101101 }
@@ -106,7 +106,7 @@ var stddev = func(x ...interface{}) interface{} {
106106// SUM(x...)
107107// Returns the sum of all values of X
108108var sum = func (x ... interface {}) interface {} {
109- if values , ok := cast .AsFloatArray (flatten (x )... ); ok {
109+ if values , ok := cast .AsFloat64Slice (flatten (x )... ); ok {
110110 if s , err := stats .Sum (values ); err == nil {
111111 return s
112112 }
@@ -117,7 +117,7 @@ var sum = func(x ...interface{}) interface{} {
117117// VARIANCE(x...)
118118// Returns the variance of X
119119var variance = func (x ... interface {}) interface {} {
120- if values , ok := cast .AsFloatArray (flatten (x )... ); ok {
120+ if values , ok := cast .AsFloat64Slice (flatten (x )... ); ok {
121121 if s , err := stats .Variance (values ); err == nil {
122122 return s
123123 }
0 commit comments