gitee.com/quant1x/num@v0.3.2/math32/asin.go (about) 1 package math32 2 3 func Asin(x float32) float32 { 4 if x == 0 { 5 return x // special case 6 } 7 sign := false 8 if x < 0 { 9 x = -x 10 sign = true 11 } 12 if x > 1 { 13 return NaN() // special case 14 } 15 16 temp := Sqrt(1 - x*x) 17 if x > 0.7 { 18 temp = Pi/2 - satan(temp/x) 19 } else { 20 temp = satan(x / temp) 21 } 22 23 if sign { 24 temp = -temp 25 } 26 return temp 27 }