Javatpoint Logo
Javatpoint Logo

Java Math.cos() method

The java.lang.Math.cos() is used to return the trigonometric cosine of an angle. This method returns value between -1 to 1.

Syntax

Parameter

Return

  • If the argument is positive or negative number, this method will return the Cosine value.
  • If the argument is NaN or infinity, this method will return NaN.

Example 1

Test it Now

Output:

0.5000000000000001

Example 2

Test it Now

Output:

1.0

Example 3

Test it Now

Output:

NaN

Example 4

Test it Now

Output:

0.37127941669980136

Next TopicJava Math




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA