JavaScript Math atanh( ) Method

Below is the example of the Math atanh() Method.

  • Example:
    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <script type="text/javascript">
           document.write("When 1 is passed as a parameter: " 
                         + Math.atanh(1));
    </script>

    chevron_right

    
    

  • Output:
    When 1 is passed as a parameter: Infinity

The Math.atanh() method is used to return the hyperbolic arctangent of a number. The atanh() is a static method of Math, therefore it is always used as Math.atanh(), rather than as a method of a Math object created.

Math.atanh (x) = arctanh(x) = y such that tanh (y) = x

Syntax:

Math.atanh(value)

Parameters: This method accepts a single parameter as mentioned above and described below:



  • value: This parameter holds the number whose hyperbolic arc-tangent you want to know.

Returns: It returns the hyperbolic arc-tangent of the given number.

Below examples illustrate the Math atanh( ) method in JavaScript

  • Example 1:
    Input : Math.atanh(1)
    Output : Infinity
  • Example 2:
    Input : Math.atanh(0)
    Output : 0
  • Example 3:
    Input : Math.atanh(2)
    Output : NaN
  • Example 4:
    Input : Math.atanh(0.5)
    Output : 0.5493061443340548

More example codes for the above method are as follows:

Pogram 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<script type="text/javascript">
       document.write("When 0 is passed as a parameter: " 
       + Math.atanh(0));
</script>

chevron_right


Output:

When 0 is passed as a parameter: 0

Program 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<script type="text/javascript">
        document.write("When 2 is passed as a parameter: " 
        + Math.atanh(2));
</script>

chevron_right


Output:

When 2 is passed as a parameter: NaN

Program 3:

filter_none

edit
close

play_arrow

link
brightness_4
code

<script type="text/javascript">
        document.write("When 0.5 is passed as a parameter: " 
        + Math.atanh(0.5));
</script>

chevron_right


Output:

When 0.5 is passed as a parameter: 0.5493061443340548

Supported Browsers:

  • Google Chrome 38.0
  • Internet Explorer 12.0
  • Firefox 25.0
  • Opera 25.0
  • Safari 8.0

full-stack-img




My Personal Notes arrow_drop_up


If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.