See Also Example
Returns the arctangent of a number.
Syntax
Atn(number)
Remarks
The argument number can be any valid numeric expression
The Atn function takes the ratio (number) of two sides of a right triangle and returns the corresponding angle. The ratio is the length of the side opposite the angle divided by the length of the side adjacent to the angle.
The result is expressed in radians and is in the range -Pi/2 to Pi/2 radians. Pi is approximately 3.141593.
To convert degrees to radians, multiply degrees by Pi/180. To convert radians to degrees, multiply radians by 180/Pi.
Note Atn is the inverse trigonometric function of Tan, which takes an angle as its argument and returns the ratio of two sides of a right triangle. Do not confuse Atn with the cotangent, which is the simple inverse of a tangent (1/tangent).
Cos Function
Sin Function
Tan Function
Math Functions
Derived Math Functions
The example uses Atn to calculate Pi. By definition, Atn(1) is 45 degrees; 180 degrees equals Pi radians. To try this example, paste the code into the Declarations section of a form. Then press F5 and click the form.
Sub Form_Click ()
Dim Msg, Pi ' Declare variables.
Pi = 4 * Atn(1) ' Calculate Pi.
Msg = "Pi is equal to " & Pi
MsgBox Msg ' Display results.
End Sub