日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > java >内容正文

java

java math.cos_Java Math类静态double cos(double d)示例

發(fā)布時間:2023/12/1 java 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java math.cos_Java Math类静态double cos(double d)示例 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

java math.cos

數(shù)學類靜態(tài)雙cos(double d) (Math Class static double cos(double d))

  • This method is available in java.lang package.

    此方法在java.lang包中可用。

  • This method is used to return the trigonometric cosine of an angle of the given parameter in the method.?

    此方法用于返回該方法中給定參數(shù)的角度的三角余弦。

  • In this method, cos stands for cosine of an angle.

    在此方法中,cos代表角度的余弦。

  • This is a static method so this method is accessible with the class name too.?

    這是一個靜態(tài)方法,因此也可以使用類名訪問此方法。

  • The return type of this method is double that means it returns the?cosine value of the given angle and the value is of double type.?

    此方法的返回類型是double,這意味著它將返回給定角度的余弦值,并且該值是double類型。

  • In this method, we pass only one parameter as an argument in the method of Math class and the given parameter is those parameters for which we have to find the cosine of an angle.?

    在此方法中,我們僅將一個參數(shù)作為參數(shù)傳遞給Math類的方法,并且給定參數(shù)是那些我們必須找到角度的余弦值的參數(shù)。

  • In this method, we pass only radians type argument (i.e. First we convert given argument in radians by using toRadians() method of Math class then after we will pass the same variable in cos() method).?

    在此方法中,我們僅傳遞弧度類型的參數(shù)(即,首先,我們使用Math類的toRadians()方法將給定參數(shù)轉換為弧度,然后在cos()方法中傳遞相同的變量)。

  • This method does not throw any exception.

    此方法不會引發(fā)任何異常。

Syntax:

句法:

public static double cos(double d){}

Parameter(s):

參數(shù):

double d – A double value (angle) whose cosine value to be found.

double d –要查找其余弦值的雙精度值(角度)。

Note:

注意:

  • If we pass "NaN", it returns "NaN".

    如果我們傳遞“ NaN”,則返回“ NaN”。

  • If we pass an infinity, it returns "NaN".

    如果傳遞無窮大,則返回“ NaN”。

Return value:

返回值:

The return type of this method is double, it returns the cosine value of the given angle.

此方法的返回類型為double ,它返回給定角度的余弦值。

Java程序演示cos(double d)方法的示例 (Java program to demonstrate example of cos(double d) method)

// Java program to demonstrate the exammple of cos(double d) // method of Math Classclass CosMethod {public static void main(String[] args) {// Here we are declaring few variablesdouble d1 = 7.0 / 0.0;double d2 = -7.0 / 0.0;double d3 = 60.0;// Display previous value of d1,d2 and d3System.out.println(" Before implementing cos() so the value of d1 is :" + d1);System.out.println(" Before implementing cos() so the value of d2 is :" + d2);System.out.println(" Before implementing cos() so the value of d3 is :" + d3);// By using toRadians() method to convert // absolute value into radiansd1 = Math.toRadians(d1);d2 = Math.toRadians(d2);d3 = Math.toRadians(d3);// Here , we will get (NaN) because we are passing // parameter whose value is (infinity)System.out.println("After implementing cos() so the value of d1 is :" + Math.cos(d1));// Here , we will get (NaN) because we are passing // parameter whose value is (-infinity)System.out.println("After implementing cos() so the value of d2 is :" + Math.cos(d2));// Here we will find cosine of d3 by using cos() methodSystem.out.println("After implementing cos() so the value of d3 is :" + Math.cos(d3));} }

Output

輸出量

E:\Programs>javac AtanMethod.javaE:\Programs>java AtanMethod Before implementing cos() so the value of d1 is :Infinity Before implementing cos() so the value of d2 is :-Infinity Before implementing cos() so the value of d3 is :60.0After implementing cos() so the value of d1 is :NaN After implementing cos() so the value of d2 is :NaN After implementing cos() so the value of d3 is :0.5000000000000001

翻譯自: https://www.includehelp.com/java/math-class-static-double-cos-double-d-with-example.aspx

java math.cos

總結

以上是生活随笔為你收集整理的java math.cos_Java Math类静态double cos(double d)示例的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。