gitee.com/quant1x/num@v0.3.2/arithmetics_div.go (about)

     1  package num
     2  
     3  import (
     4  	"gitee.com/quant1x/num/x32"
     5  	"gitee.com/quant1x/num/x64"
     6  	"slices"
     7  )
     8  
     9  // Div arithmetics 除法
    10  func Div[T Number](x []T, y any) []T {
    11  	return BinaryOperations(x, y, x32.Div, x64.Div, __div_go[T])
    12  }
    13  
    14  func __div_go[T Number](x, y []T) []T {
    15  	x = slices.Clone(x)
    16  	for i := 0; i < len(x); i++ {
    17  		x[i] /= y[i]
    18  	}
    19  	return x
    20  }