Method: CMath.acos
- Defined in:
- lib/cmath.rb
.acos(z) ⇒ Object
Returns the arc cosine of z
CMath.acos(1 + 1i) #=> (0.9045568943023813-1.0612750619050357i)
281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/cmath.rb', line 281 def acos(z) begin if z.real? and z >= -1 and z <= 1 RealMath.acos(z) else (-1.0).i * log(z + 1.0.i * sqrt(1.0 - z * z)) end rescue NoMethodError handle_no_method_error end end |