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

歡迎訪問(wèn) 生活随笔!

生活随笔

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

java

Java Double类doubleToLongBits()方法与示例

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

Double類doubleToLongBits()方法 (Double class doubleToLongBits() method)

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

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

  • doubleToLongBits() method follows IEEE 754 double floating-point standards and according to standards, it returns the bits that denote floating-point value.

    doubleToLongBits()方法遵循IEEE 754雙浮點(diǎn)標(biāo)準(zhǔn),并且根據(jù)這些標(biāo)準(zhǔn),它返回表示浮點(diǎn)值的位。

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

    doubleToLongBits()方法是一個(gè)靜態(tài)方法,也可以使用類名進(jìn)行訪問(wèn),如果我們嘗試使用類對(duì)象訪問(wèn)該方法,那么也不會(huì)收到錯(cuò)誤。

  • doubleToLongBits() method does not throw an exception at the time of representing bits.

    doubleToLongBits()方法在表示位時(shí)不會(huì)引發(fā)異常。

Syntax:

句法:

public static long doubleToLongBits(double value);

Parameter(s):

參數(shù):

  • double value – This parameter represents the double precision floating point value.

    double value –此參數(shù)表示雙精度浮點(diǎn)值。

Return value:

返回值:

The return type of this method is long, it returns the bits that represent the double precision floating-point value.

此方法的返回類型為long ,它返回表示雙精度浮點(diǎn)值的位。

Note:

注意:

  • If we pass positive infinity, it returns the value 0x7ff0000000000000L.

    如果我們傳遞正無(wú)窮大 ,它將返回值0x7ff0000000000000L 。

  • If we pass negative infinity, it returns the value 0xfff0000000000000L.

    如果我們傳遞負(fù)無(wú)窮大 ,它將返回值0xfff0000000000000L 。

  • If we pass NaN, it returns the value 0x7ff8000000000000L.

    如果我們通過(guò)NaN ,它將返回值0x7ff8000000000000L 。

Example:

例:

// Java program to demonstrate the example // of doubleToLongBits(double value) // method of Double classpublic class DoubleToLongBitsOfDoubleClass {public static void main(String[] args) {// Variables initializationdouble value1 = 18.20;double value2 = 19.20;// Display value1,value2 valuesSystem.out.println("value1: " + value1);System.out.println("value2: " + value2);// It returns the bits denoted by the double // floating-point argument by calling // Double.doubleToLongBits(value1)long result1 = Double.doubleToLongBits(value1);// It returns the bits denoted by the double // floating-point argument by calling // Double.doubleToLongBits(value2)long result2 = Double.doubleToLongBits(value2);// Display result1,result2 valuesSystem.out.println("Double.doubleToLongBits(value1): " + result1);System.out.println("Double.doubleToLongBits(value2): " + result2);} }

Output

輸出量

value1: 18.2 value2: 19.2 Double.doubleToLongBits(value1): 4625816062258262835 Double.doubleToLongBits(value2): 4626097537234973491

翻譯自: https://www.includehelp.com/java/double-class-doubletolongbits-method-with-example.aspx

總結(jié)

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

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