java.lang.Double doubleToRawLongBits(double value)


public static long doubleToRawLongBits(double value)

Java Code Example :

This java example source code demonstrates the use of doubleToRawLongBits(double value)) method of Double class.

Some takeaways on the doubleToRawLongBits(double value)  method:

  • Returns a representation of the specified floating-point value according to the IEEE 754 floating-point “double format” bit layout, preserving Not-a-Number (NaN) values.
  • If the argument is positive infinity, the result is 0x7ff0000000000000L.
  • If the argument is negative infinity, the result is 0xfff0000000000000L.
  • If the argument is NaN, the result is the long integer representing the actual NaN value. Unlike the doubleToLongBits method, doubleToRawLongBits does not collapse all the bit patterns encoding a NaN to a single “canonical” NaN value.

Sample Output :

Running the above example source code will give the following output

Suggested Reading List :

References :