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

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > java >内容正文

java

strictmath_Java StrictMath log1p()方法与示例

發(fā)布時(shí)間:2023/12/1 java 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 strictmath_Java StrictMath log1p()方法与示例 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

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()方法用于返回(給定參數(shù)和1之和的對(duì)數(shù),如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()方法是靜態(tài)方法,因此可以使用類名進(jìn)行訪問,如果嘗試使用類對(duì)象訪問該方法,則也不會(huì)收到錯(cuò)誤。

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

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

  • log1p() method does not throw any exception.

    log1p()方法不會(huì)引發(fā)任何異常。

Syntax:

句法:

public static double log1p(double d);

Parameter(s):

參數(shù):

  • double d – represents the double type argument.

    double d –表示double類型的參數(shù)。

Return value:

返回值:

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

此方法的返回類型為double-返回給定參數(shù)的對(duì)數(shù)(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).

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

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

    如果我們傳遞一個(gè)負(fù)無(wú)窮大,則方法返回NaN。

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

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

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 declarationsdouble 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 d5System.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

總結(jié)

以上是生活随笔為你收集整理的strictmath_Java StrictMath log1p()方法与示例的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。