Math.atan()

JavaScript 1.0+, ECMAScript 1.0+, JScript 1.0+ Nav2+, NES2+, IE 3+, Opera3+ Syntax

							math.atan(num)
						

Description

The atan() method of the Math object is used to calculate the arctangent of a number. The return value is a numeric value between –PI/2 and PI/2 radians.

Example

Listing 6.154 shows how the atan() method is used to calculate the arctangent of a number.

Listing 6.154 Example of the atan() Method
 <html> <body> <script language="JavaScript"> <!–– Hide // function calculates the arctangent of the input number function doMath(){ var inputNum=document.form1.input.value; var result = Math.atan(inputNum); document.form1.answer.value = result; } // End Hide ––> </script> <form name=form1> This example calculates the arctangent ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.