Method: CMath.cosh
- Defined in:
- lib/cmath.rb
.cosh(z) ⇒ Object
Returns the hyperbolic cosine of z, where z is given in radians
CMath.cosh(1 + 1i) #=> (0.8337300251311491+0.9888977057628651i)
232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/cmath.rb', line 232 def cosh(z) begin if z.real? RealMath.cosh(z) else Complex(RealMath.cosh(z.real) * RealMath.cos(z.imag), RealMath.sinh(z.real) * RealMath.sin(z.imag)) end rescue NoMethodError handle_no_method_error end end |