Math.acosh( ) In JavaScript
The Math.acosh() function in Javascript is used to return the hyperbolic arc-cosine of a number.
Math.acosh (x) = arcosh(x) = y ≧ 0 such that cosh (y)=x
acosh() is a static method of Math, therefore it is always used as Math.acosh(), rather than as a method of a Math object created.
Syntax:
Math.acosh(value)
Parameters: This function accepts single parameter value which is the number whose hyperbolic arc-cosine you want to know.
Returns: It returns the hyperbolic arc-cosine of the given number and if the parameter passed is less than 1, it returns NaN.
Examples:
Input : Math.acosh(1) Output : 0 Input : Math.acosh(0) Output : NaN Input : Math.acosh(-1) Output : NaN Input : Math.acosh(2) Output : 1.3169578969248166
- Example 1: When 1 is passed as a parameter.
<
script
type
=
"text/javascript"
>
document.write("Output : " + Math.acosh(1));
</
script
>
Output:
Output : 0
- Example 2: When 0 is passed as a parameter.
<
script
type
=
"text/javascript"
>
document.write("Output : " + Math.acosh(0));
</
script
>
Output:
Output : NaN
- Example 3: When a number less than 0 is passed as a parameter.
<
script
type
=
"text/javascript"
>
document.write("Output : " + Math.acosh(-1));
</
script
>
Output:
Output : NaN
- Example 4: When 2 is passed as a parameter.
<
script
type
=
"text/javascript"
>
document.write("Output : " + Math.acosh(2));
</
script
>
Output:
Output : 1.3169578969248166
Supported Browsers: The browsers supported by JavaScript Math.acosh( ) function are listed below:
- Google Chrome 38.0
- Internet Explorer 12.0
- Firefox 25.0
- Opera 25.0
- Safari 8.0