Double doubleToRawLongBits() method in Java with examples Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The doubleToRawLongBits() method of Java Double class is a built-in function in java that 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. Syntax: public static long doubleToRawLongBits(double val) Parameter: The method accepts only one parameter val which specifies a double precision floating-point number. Return Values: The function returns the bits that represent the floating-point number. Below are the special cases: If the argument is positive infinity, the result is 7ff0000000000000L.If the argument is negative infinity, the result is 0xfff0000000000000L.If the argument is NaN, the result is 0x7ff8000000000000L. Below programs illustrates the use of Double.doubleToRawLongBits() method: Program 1: Java // Java program to demonstrate // Double.doubleToRawLongBits() method import java.lang.*; class Gfg1 { public static void main(String args[]) { double val = 1.5d; // function call long answer = Double.doubleToRawLongBits(val); // print System.out.println(val + " in raw long bits: " + answer); } } Output: 1.5 in raw long bits: 4609434218613702656 Program 2: Java // Java program to demonstrate // Double.doubleToRawLongBits() method import java.lang.*; class Gfg1 { public static void main(String args[]) { double val = Double.POSITIVE_INFINITY; double val1 = Double.NEGATIVE_INFINITY; double val2 = Double.NaN; // function call long answer = Double.doubleToRawLongBits(val); // print System.out.println(val + " in raw long bits: " + answer); // function call answer = Double.doubleToRawLongBits(val1); // print System.out.println(val1 + " in raw long bits: " + answer); // function call answer = Double.doubleToRawLongBits(val2); // print System.out.println(val2 + " in raw long bits: " + answer); } } Output: Infinity in raw long bits: 9218868437227405312 -Infinity in raw long bits: -4503599627370496 NaN in raw long bits: 9221120237041090560 Reference: https://docs.oracle.com/javase/7/docs/api/java/lang/Double.html#doubleToRawLongBits(double) Create Quiz Comment G gopaldave Follow 0 Improve G gopaldave Follow 0 Improve Article Tags : Java java-basics Java-lang package Java-Functions Java-Double +1 More Explore Java BasicsIntroduction to Java3 min readJava Programming Basics9 min readJava Methods6 min readAccess Modifiers in Java4 min readArrays in Java7 min readJava Strings7 min readRegular Expressions in Java3 min readOOP & InterfacesClasses and Objects in Java5 min readAccess Modifiers in Java4 min readJava Constructors4 min readJava OOP(Object Oriented Programming) Concepts10 min readJava Packages7 min readJava Interface7 min readCollectionsCollections in Java12 min readCollections Class in Java13 min readCollection Interface in Java4 min readIterator in Java4 min readJava Comparator Interface4 min readException HandlingJava Exception Handling6 min readJava Try Catch Block4 min readJava final, finally and finalize4 min readChained Exceptions in Java3 min readNull Pointer Exception in Java5 min readException Handling with Method Overriding in Java4 min readJava AdvancedJava Multithreading Tutorial3 min readSynchronization in Java7 min readFile Handling in Java4 min readJava Method References9 min readJava 8 Stream Tutorial7 min readJava Networking6 min readJDBC Tutorial5 min readJava Memory Management4 min readGarbage Collection in Java6 min readMemory Leaks in Java3 min readPractice JavaJava Interview Questions and Answers15+ min readJava Programs - Java Programming Examples7 min readJava Exercises - Basic to Advanced Java Practice Programs with Solutions5 min readJava Quiz1 min readJava Project Ideas For Beginners and Advanced15+ min read Like