strictmath_Java StrictMath log1p()方法與示例

strictmath

StrictMath類log1p()方法 (StrictMath Class log1p() method)

  • log1p() method is available in java.lang package.

    log1p()方法在java.lang包中可用。

  • log1p() method is used to return (the logarithm of the sum of the given argument and 1 like log(1+d) in the method.

    log1p()方法用于返回(給定參數和1之和的對數,如log(1 + d)在該方法中。

  • log1p() method is a static method so it is accessible with the class name and if we try to access the method with the class object then also we will not get an error.

    log1p()方法是靜態方法,因此可以使用類名進行訪問,如果嘗試使用類對象訪問該方法,則也不會收到錯誤。

  • We need to remember one thing if we pass smaller values for the given argument so the final calculated result of log1p(d) is nearer to the exact result of ln(1+d) than the double floating-point calculation of log(1.0+d).

    如果為給定參數傳遞較小的值,則需要記住一件事,即與log(1.0+)的雙浮點計算相比, log1p(d)的最終計算結果更接近ln(1 + d)的精確結果。 d)。

  • log1p() method does not throw any exception.

    log1p()方法不會引發任何異常。

Syntax:

句法:

    public static double log1p(double d);

Parameter(s):

參數:

  • double d – represents the double type argument.

    double d –表示double類型的參數。

Return value:

返回值:

The return type of this method is double – it returns the logarithm (1+d) of the given argument.

此方法的返回類型為double-返回給定參數的對數(1 + d)。

Note:

注意:

  • If we pass NaN, method returns NaN.

    如果傳遞NaN,則方法返回NaN。

  • If we a value which is less than -1, method returns NaN.

    如果我們的值小于-1,則方法返回NaN。

  • If we pass a positive infinity, method returns the same (i.e. positive infinity).

    如果我們傳遞一個正無窮大,則方法將返回相同的值(即正無窮大)。

  • If we pass a negative infinity, method returns NaN.

    如果我們傳遞一個負無窮大,則方法返回NaN。

  • If we pass 0 (negative or positive), method returns the same with the same sign.

    如果傳遞0(負數或正數),則方法將返回相同的符號。

Example:

例:

// Java program to demonstrate the example
// of log1p(double d) method of StrictMath class.
public class Log1p {
public static void main(String[] args) {
// variable declarations
double d1 = 7.0 / 0.0;
double d2 = -7.0 / 0.0;
double d3 = 0.0;
double d4 = -0.0;
double d5 = 6054.2;
// Display previous value of d1,d2,d3,d4 and d5
System.out.println("d1: " + d1);
System.out.println("d2: " + d2);
System.out.println("d3: " + d3);
System.out.println("d4: " + d4);
System.out.println("d5: " + d5);
// Here , we will get (Infinity) because we are 
// passing parameter whose value is (Infinity)
System.out.println("StrictMath.log1p(d1): " + StrictMath.log1p(d1));
// Here , we will get (NaN) because we are 
// passing parameter whose value is (-Infinity)
System.out.println("StrictMath.log1p(d2): " + StrictMath.log1p(d2));
// Here , we will get (0.0) because we are 
// passing parameter whose value is (0.0)
System.out.println("StrictMath.log1p(d3): " + StrictMath.log1p(d3));
// Here , we will get (-0.0) because we are 
// passing parameter whose value is (-0.0)
System.out.println("StrictMath.log1p(d4): " + StrictMath.log1p(d4));
// Here , we will get (log [1 + d5]) and we are 
// passing parameter whose value is (6054.2)
System.out.println("StrictMath.log1p(d5): " + StrictMath.log1p(d5));
}
}

Output

輸出量

d1: Infinity
d2: -Infinity
d3: 0.0
d4: -0.0
d5: 6054.2
StrictMath.log1p(d1): Infinity
StrictMath.log1p(d2): NaN
StrictMath.log1p(d3): 0.0
StrictMath.log1p(d4): -0.0
StrictMath.log1p(d5): 8.708672685994957

翻譯自: https://www.includehelp.com/java/strictmath-log1p-method-with-example.aspx

strictmath

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

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

相關文章

第六章 抽象

第六章 抽象 自定義函數 要判斷某個對象是否可調用,可使用內置函數callable import math x 1 y math.sqrt callable(x)#結果為:False callable(y)#結果為:True使用def(表示定義函數)語句,來定義函數 …

HTTP 狀態代碼

如果向您的服務器發出了某項請求要求顯示您網站上的某個網頁(例如,當用戶通過瀏覽器訪問您的網頁或在 Googlebot 抓取該網頁時),那么,您的服務器會返回 HTTP 狀態代碼以響應該請求。 此狀態代碼提供了有關請求狀態的信…

TensorFlow的可訓練變量和自動求導機制

文章目錄一些概念、函數、用法TensorFlow實現一元線性回歸TensorFlow實現多元線性回歸一些概念、函數、用法 對象Variable 創建對象Variable: tf.Variable(initial_value,dtype)利用這個方法,默認整數為int32,浮點數為float32,…

linux samba安裝失敗,用aptitude安裝samba失敗

版本:You are using Ubuntu 10.04 LTS- the Lucid Lynx - released in April 2010 and supported until April 2013.root下執行aptitude install sambaReading package lists... DoneBuilding dependency treeReading state information... DoneReading extended st…

django第二個項目--使用模板做一個站點訪問計數器

上一節講述了django和第一個項目HelloWorld,這節我們講述如何使用模板,并做一個簡單的站點訪問計數器。 1、建立模板 在myblog模塊文件夾(即包含__init__.py的文件夾)下面新建一個文件夾templates,用于存放HTML模板,在…

strictmath_Java StrictMath log10()方法與示例

strictmathStrictMath類log10()方法 (StrictMath Class log10() method) log10() method is available in java.lang package. log10()方法在java.lang包中可用。 log10() method is used to return the logarithm of the given (base 10) of the given argument in the method…

30、深入理解計算機系統筆記,并發編程(concurrent)(2)

1、共享變量 1)線程存儲模型 線程由內核自動調度,每個線程都有它自己的線程上下文(thread context),包括一個惟一的整數線程ID(Thread ID,TID),棧,棧指針,程序…

PostgreSQL在何處處理 sql查詢之十三

繼續: /*--------------------* grouping_planner* Perform planning steps related to grouping, aggregation, etc.* This primarily means adding top-level processing to the basic* query plan produced by query_planner.** tuple_fraction i…

【視覺項目】基于梯度的NCC模板匹配代碼以及效果

文章目錄流程分析工程代碼【1】NCC代碼【Ⅰ】sttPxGrdnt結構體【Ⅱ】sttTemplateModel模板結構體【Ⅲ】calcAccNCC計算ncc系數函數【Ⅳ】searchNcc NCC模板匹配函數【Ⅴ】searchSecondNcc 二級搜索:在某一特定點周圍再以步進為1搜索【2】測試圖轉外輪廓【Ⅰ】孔洞填…

第七章 再談抽象

第七章 再談抽象 對象魔法 多態:可對不同類型的對象執行相同的操作,而這些操作就像“被施了魔法”一樣能夠正常運行。(即:無需知道對象的內部細節就可使用它)(無需知道對象所屬的類(對象的類型)就能調用其…

c語言math乘法,JavaScript用Math.imul()方法進行整數相乘

1. 基本概念Math.imul()方法用于計算兩個32位整數的乘積,它的結果也是32位的整數。JavaScript的Number類型同時包含了整數和浮點數,它沒有專門的整型和浮點型。因此,Math.imul()方法能提供類似C語言的整數相乘的功能。我們將Math.imul()方法的…

java scanner_Java Scanner nextLong()方法與示例

java scanner掃描器類的nextLong()方法 (Scanner Class nextLong() method) Syntax: 句法: public long nextLong();public long nextLong(int rad);nextLong() method is available in java.util package. nextLong()方法在java.util包中可用。 nextLong() method…

技術總監和CTO的區別 淺談CTO的作用----軟件公司如何開源節流(一)

我一直在思考軟件公司如何開源節流。當然,老板也在思考開源節流。當然,老板思考的開源節流在公司運營層面上,而我作為CTO,我考慮的則是在產品運營角度上來思考這個問題。否則,一個軟件公司,它的生存與發展就…

梯度下降法預測波士頓房價以及簡單的模型評估

目錄原理代碼關于歸一化的思考原理 觀察數據可知屬性之間差距很大,為了平衡所有的屬性對模型參數的影響,首先進行歸一化處理。 每一行是一個記錄,每一列是個屬性,所以對每一列進行歸一化。 二維數組歸一化:1、循環方式…

Windows Phone 內容滑動切換實現

在新聞類的APP中,有一個經常使用的場景:左右滑動屏幕來切換上一條或下一條新聞。 那么通常我們該使用哪種方式去實現呢?可以參考一下Demo的實現步驟。 1,添加Windows Phone用戶自定義控件。例如: 這里我為了演示的方便…

c語言interrupt函數,中斷處理函數數組interrupt[]初始化

在系統初始化期間,trap_init()函數將對中斷描述符表IDT進行第二次初始化(第一次只是建一張IDT表,讓其指向ignore_intr函數),而在這次初始化期間,系統的0~19號中斷(用于分NMI和異常的中斷向量)均被設置好。與此同時,用于…

bytevalue_Java Number byteValue()方法與示例

bytevalueNumber類byteValue()方法 (Number Class byteValue() method) byteValue() method is available in java.lang package. byteValue()方法在java.lang包中可用。 byteValue() method is used to return the value denoted by this Number object converted to type byt…

第二章 染色熱力學理論單元測驗

1,()測定是染色熱力學性能研究的基礎 吸附等溫線。 2,吸附是放熱反應,溫度升高,親和力() 減小 3,染色系統中包括() 染料。 染深色介質。 染色助劑。 纖維。 4,下列對狀態函數特點敘述正確的為() 狀態函數只有在平衡狀態的系統中才有確定值。 在非平衡狀態的系統…

使用鳶尾花數據集實現一元邏輯回歸、多分類問題

目錄鳶尾花數據集邏輯回歸原理【1】從線性回歸到廣義線性回歸【2】邏輯回歸【3】損失函數【4】總結TensorFlow實現一元邏輯回歸多分類問題原理獨熱編碼多分類的模型參數損失函數CCETensorFlow實現多分類問題獨熱編碼計算準確率計算交叉熵損失函數使用花瓣長度、花瓣寬度將三種鳶…

開源HTML5應用開發框架 - iio Engine

隨著HTML5的發展,越來越多的基于HTML5技術的網頁開發框架出現,在今天的這篇文章中,我們將介紹iio Engine,它是一款開源的創建HTML5應用的web框架。整個框架非常的輕量級,只有45kb大小,并且整合了debug系統&…