StrictMath.cos() in Java

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

Syntax:

double java.lang.StrictMath.cos(double a)

This method takes one argument of type double as its parameter. This method returns the trigonometric cosine of an angle.

Special cases:

1. If the argument is NaN or an infinity, then the result is NaN.

Parameters: One parameter is required for this method.

a: an angle, in radians.

Returns: the cosine of the argument.

Exceptions: NA

Approach

Java

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

        double a = -0.34;
        System.out.println(StrictMath.cos(a));
    }
}

Output:

0.9427546655283462


No comments:

Post a Comment