Math.atan() : atan « Math « JavaScript Tutorial






Syntax

math.atan(num)

The atan() method calculates the arctangent of a number.

The return value is a numeric value between -PI/2 and PI/2 radians.

<html>
    <body>
    <script language="JavaScript">
    <!--
    function doMath(){
        var inputNum=document.form1.input.value;
        var result = Math.atan(inputNum);
        document.form1.answer.value = result;
    }
    -->
    </script>
    <form name=form1>
    This example calculates the arctangent of the input number.
    <br><br>
    Enter Number:
    <input type="text" name="input" size=10>
    <input type="button" value="Calculate" onClick='doMath()'>
    <br>
    The arctan is:
    <input type="text" name="answer" size=10>
    </form>
    </body>
    </html>








9.5.atan
9.5.1.Math.atan()