mirror of
https://github.com/make-42/xyosc
synced 2025-01-19 02:57:34 +01:00
11 lines
139 B
Go
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
|
||
|
}
|