xyosc/vendor/github.com/chewxy/math32/cosh.go
2024-12-21 17:38:26 +01:00

11 lines
139 B
Go

package math32
func Cosh(x float32) float32 {
x = Abs(x)
if x > 21 {
return Exp(x) * 0.5
}
ex := Exp(x)
return (ex + 1/ex) * 0.5
}