Javatpoint Logo
Javatpoint Logo

Java Double doubleToRawLongBits() Method

The doubleToRawLongBits() method of Double class returns a floating-point value according to the IEEE 754 floating-point "double format" bit layout, preserving Not-a-Number(NaN) values.



Value is the double parameter passed which is a double precision floating-point number.

Return value

The doubleToLongBits(double value) method returns the bits that represent the floating-point number.

  • If the argument is positive infinity, the result returned is 0x7ff0000000000000L.
  • If the argument is negative infinity, the result returned is 0xfff0000000000000L.
  • If the argument is NaN, the result returned is the long integer representing the actual NaN value. The doubleToRawLongBits() method does not collapse with the bit patterns encoding a NaN to a single " cannonical" NaN value.

Example 1

Test it Now


5.5 value in  Raw long bits = 4617878467915022336
NaN value in Raw long bits =9221120237041090560
Infinity value in Raw long bits =9218868437227405312
-Infinity value in Raw long bits=-4503599627370496

Example 2

Test it Now


Error:(13, 21) java: cannot find symbol
  symbol:   method doubleToLongBits(double)
  location: variable obj of type com.interf.Double_doubleToRawLongBitsMethod_Example2

Double is a primitive data type. Its object cannot be used to call the Double class method. If you do so, it will give the error like above.

Example 3

Test it Now


-6.58768566756756E7value in Raw long bits = -4499261384967075684
7658659.78678 value in Raw long bits = 7658659.78678

Next TopicJava Double

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA