java math.cos_Java Math類靜態double cos(double d)示例

java math.cos

數學類靜態雙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.?

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

  • 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.?

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

  • 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.?

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

  • 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).?

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

  • This method does not throw any exception.

    此方法不會引發任何異常。

Syntax:

句法:

    public static double cos(double d){
}

Parameter(s):

參數:

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 Class
class CosMethod {
public static void main(String[] args) {
// Here we are declaring few variables
double d1 = 7.0 / 0.0;
double d2 = -7.0 / 0.0;
double d3 = 60.0;
// Display previous value of d1,d2 and d3
System.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 radians
d1 = 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() method
System.out.println("After implementing cos() so the value of d3 is :" + Math.cos(d3));
}
}

Output

輸出量

E:\Programs>javac AtanMethod.java
E:\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.0
After 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

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/379906.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/379906.shtml
英文地址,請注明出處:http://en.pswp.cn/news/379906.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

web安全---SSRF漏洞

簡介 SSRF:服務器請求偽造,是一種攻擊者構造形成由服務端發起請求 的一個安全漏洞。一般情況下,SSRF攻擊的目標是從外網無法訪問的內部系統(正是因為它是由服務端發起的,所以它能夠請求到與它相連而與外網隔離的內部系…

集合——對象數組(引用數據類型數組)

案例:我有5個學生,請把這個5個學生的信息存儲到引用數據類型數組中,并遍歷數組,獲取得到每一個學生的信息。 思路分析:首先,想要創建學生對象,就得有學生這個類,所以,首…

提升應用視覺Android效果的10個UI技巧

在Android應用開發中,風格和設計或許不是最關鍵的要素,但它們在決定Android應用成功與否上確實扮演重要的角色。以下是10個Android應用的UI設計技巧,還有個附加技巧,能夠提供你的Android應用的視覺吸引力。 技巧1:使用…

kotlin中判斷字符串_Kotlin程序查找字符串中字符的頻率

kotlin中判斷字符串Given a string and a character, we have to find the frequency of the character in the string. 給定一個字符串和一個字符,我們必須找到字符串中字符的頻率。 Example: 例: Input:string "IncludeHelp"character to…

OD使用

0x01 功能界面 序號1是匯編代碼對應的地址窗口序號2是匯編對應的十六進制機器碼窗口序號3是反匯編窗口序號4是反匯編代碼對應的注釋信息窗口序號5是寄存器信息窗口序號6是當前執行到的反匯編代碼的信息窗口序號7是數據所在的地址序號8是數據的十六進制編碼信息,序號…

windows mobile 開發總結--菜單

在開發時經常要創建菜單,并且動態顯示和隱藏菜單或者是某個子菜單。以下就是實現的方法: 1。創建并顯示菜單,先在資源里添加菜單,然后如下代碼 SHMENUBARINFO mbi; ZeroMemory(&mbi, sizeof(SHMENUBARINFO)); mbi.cbSizesizeof(SHMENUBAR…

Java——集合的概述

* A:集合的由來* 數組是容器,集合也是容器* 數組的弊端:數組的長度是固定的,當添加的元素超過了數組的長度時,需要對數組重新定義,太麻煩* Java內部給我們提供了集合類,可以存儲任意對象&#x…

排序算法中平均時間復雜度_操作系統中的作業排序(算法,時間復雜度和示例)...

排序算法中平均時間復雜度作業排序 (Job sequencing) Job sequencing is the set of jobs, associated with the job i where deadline di > 0 and profit pi > 0. For any job i the profit is earned if and only if the job is completed by its deadline. To complet…

python---文件處理

0x01 打開一個文件 python中內置了文件對象,通過open()函數就可以制定模式打開指定文件,并創建文件對象。該函數的格式如下: open(file[,moder[,buffering-1]])file:指定要打開或創建的文件名稱,如果該文件不存在當前…

簡易而又靈活的Javascript拖拽框架(四)

一、開篇 似乎拖拽已經被寫爛了,沒得寫的了,可是我這次又來了~ 上一次寫的是跨列拖放,這次我要帶給大家的是跨頁拖放。 可以到這里來看看效果:示例效果 說明:1、如果將方框拖動到頁簽上立刻釋放掉的話&…

Java——集合的基本功能測試

* 1,boolean add<E,e> 添加* 確保此 collection 包含指定的元素&#xff08;可選操作&#xff09;。* 參數&#xff1a;e - 確定此 collection 中是否存在的元素。E - 代表Object類&#xff0c;說明該add可以添加任何對象&#xff0c;任意對象都是Object的子類對象&…

《那些年啊,那些事——一個程序員的奮斗史》——78

招人風波之后&#xff0c;就很少見武總往18樓跑了&#xff0c;大部分時間都是坐在22樓的隔間。而武總對段伏櫪的抱怨&#xff0c;也僅僅只有那次&#xff0c;后來就再也沒有提過。對于段伏櫪而言&#xff0c;還要不要招新人&#xff0c;后續如何去招新人&#xff0c;已經不是自…

python---異常處理結構

python中提供了很多不同形式的異常處理結構&#xff0c;其基本思路都是先嘗試執行代碼&#xff0c;再處理可能發生的錯誤。 try…except… 在python異常處理結構中&#xff0c;try…except…使用最為頻繁&#xff0c;其中try子句中的代碼塊為可能引發異常的語句&#xff0c;e…

用css網站布局之十步實錄 (轉載)

第一步&#xff1a;規劃網站http://www.52css.com/article.asp?id175 第二步&#xff1a;創建html模板及文件目錄等http://www.52css.com/article.asp?id176 第三步&#xff1a;將網站分為五個div 網頁基本布局http://www.52css.com/article.asp?id177 第四步&#xff1a;網…

Java——集合轉數組并對其進行遍歷

* A&#xff1a;集合的遍歷* 其實就是以此獲取集合中的每一個元素* B&#xff1a;案例* 把集合轉成數組&#xff0c;可以實現集合的遍歷* public Object[] toArray() 按適當順序&#xff08;從第一個到最后一個元素&#xff09;返回包含此列表中所有元素的數組。…

魚油賬號記錄程序(續) - 零基礎入門學習Delphi39

魚油賬號記錄程序&#xff08;續&#xff09; 讓編程改變世界 Change the world by program 課件同上一講&#xff0c;這一講主要演示編程操作和修改程序&#xff01; [buy] 獲得所有教學視頻、課件、源代碼等資源打包 [/buy] [Downlink hrefhttp://kuai.xunlei.com/d/LDKX…

python---Socket編程

Sockte是計算機之間進行網絡通信的一套程序接口&#xff0c;相當于在發送端和接收端之間建立一個通信管道。在實際應用中&#xff0c;一些遠程管理軟件和網絡安全軟件大多數依賴于Socket來實現特定功能&#xff0c;由于TCP方式在網絡編程中應用非常頻繁&#xff0c;此處將對TCP…

格式轉換-----PDF格式研究筆記(一)

格式轉換-----PDF格式研究筆記&#xff08;一&#xff09; 現在我的幾個計劃都需要我能夠對PDF格式進行解碼&#xff0c;所以找了一下資料&#xff0c;找到了一個PDF1.3的手冊&#xff0c;特放出下載&#xff0c;如果誰有更高版本的&#xff0c;請給我一份&#xff0c;謝謝。 …

(X)HTML嵌套規則

本文整理于互聯網~ 簡單認識了塊元素和內嵌元素以后&#xff0c;下面就可以羅列 XHTML 標簽的嵌套規則了&#xff1a; 1. 塊元素可以包含內聯元素或某些塊元素&#xff0c;但內聯元素卻不能包含塊元素&#xff0c;它只能包含其它的內聯元素&#xff1a;<div><h1>&…

Java——集合帶All的功能演示

package com.wsq.collection;import java.util.ArrayList; import java.util.Collection; public class Demo4_CollectionAll {public static void main(String[] args) {demo1(); //c1.addAll(c2);將c2整個集合給添加到c1中,即&#xff0c;c2集合中的每…