StrictMath.cosh() in Java

StrictMath.cosh(): This method is available in java.lang.StrictMath class of Java.

Syntax:

double java.lang.StrictMath.cosh(double x)

This method takes one argument of type as its parameter. This method returns the hyperbolic cosine of a double value. The hyperbolic cosine of x is defined to be(e^x + e^-x)/2 where e is Euler's number.

Special cases:

1. If the argument is NaN, then the result is NaN.

2. If the argument is infinite, then the result is positive infinity.

3. If the argument is zero, then the result is 1.0

Parameters: One parameter is required for this method.

x: The number whose hyperbolic cosine is to be returned.

Returns: The hyperbolic cosine of x.

Exceptions: NA

Approach

Java

public class StrictMathcosh {
    public static void main(String[] args) {

        double x = -0.89;
        System.out.println(StrictMath.cosh(x));
    }
}

1.42289270202111


No comments:

Post a Comment