Learn and Learn

Learn And Learn - great place for tutorials, references and how-to

Ruby – Find Arc Tangent – atan() Method – Examples & Explanation

atan() a method in CMath library which is used to find the arc tangent of any given complex number in Ruby language.

atan() method in Ruby

atan() method exists in Standard CMath Library of Ruby. The purpose of this method is to provide perfect arc tangent of any given complex number.

Syntax of the atan() method in Ruby

Syntax of atan() method is:

Parameter of atan() method in Ruby

x – Where x is Any valid complex number. This parameter is required.
Note: If the x parameter is not a complex number, atan() method will return an error.

 

Return Value of atan()

atan() method will return the arc tangent of any given complex number.

Get the arc tangent of any complex number in Ruby


Output
1.490839765215787+0.03976617365742172i

 

Ruby atan() (arc tangent) Example 1


Output
-1.490839765215787+0.03976617365742172i

 

Ruby atan() (inverse of tangent) Example 2


Output
1.4711276743037345-5.551115123125783e-17i

 

Ruby atan() (arc tangent) Example 3


Output
Error

 

Ruby atan() (arc tangent) Example 4


Output
-1.4711276743037347

 

Loading...
LearnAndLearn.com © 2018 - All rights reserved