Java Double doubleToRawLongBits() Method10 Nov 2024 | 2 min read 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. SyntaxParametersValue is the double parameter passed which is a double precision floating-point number. Return valueThe doubleToLongBits(double value) method returns the bits that represent the floating-point number.
Example 1Output: 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 2Output: 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 3Output: -6.58768566756756E7value in Raw long bits = -4499261384967075684 7658659.78678 value in Raw long bits = 7658659.78678 Next TopicJava-double-doublevalue-method |
The byteValue() method of Java Double class returns the value of this double as a byte after a narrowing primitive conversion. The byteValue () method of class Double overrides the byteValue () method of class Number. Syntax public byte byteValue() Return value This method returns the double value represented by...
3 min read
The hashCode() method of Java Double class returns the hash code for this Double. The result is obtained by performing exclusive OR operation on two halves of the long integer bit representation which is same as produced by the doubleToLongBits() method. Overrides The hashCode() method of class...
3 min read
The compare() method of Java Double class compares two specified double values. Syntax public static int compare(double d1, double d2) Parameters Two parameters- d1- The first double to be compared. d2- The second double to be compared. Return value This method will return value - zero, if d1 is numerically equal to...
3 min read
The isNaN() method of Java Double class returns true: If the value of this Object is Not-a-Number (NaN). If the argument passed is Not-a-Number (NaN). Otherwise, the method returns false. Syntax 1.public boolean isNaN() 2.public static boolean isNaN(double v) Parameters 1.NA 2.' v ' is the double value to be tested. Return value The isNaN() method returns...
3 min read
The isInfinite() method of Java Double class will return true if the magnitude of the argument specified is infinitely large, else it will return false. Syntax 1.public boolean isInfinite() 2.public static boolean isInfinite(double v) Parameters 1.NA 2.v- This is the double value which is tested. Return value The isInfnite() method returns true if the...
3 min read
The equals() method of Java Double class compares this Double object against the specified Double object. The method returns true, if the argument is not null. Assuming d1 and d2 are the two instances of class Double, the value of d1.equals(d2) will be true if d1.doubleValue() == d2.doubleValue...
3 min read
The min() method of Java Double class returns the double having minor value amongst two double values. The result returned is same as by invoking Math.min () method. Syntax public static double min(double a, double b) Parameters Here, a & b are the two operands to be compared. Return...
6 min read
The floatValue() method of Double class returns a float value of this double object. Syntax public float floatValue() Parameters NA Return value The floatValue() method returns the double value converted to type float . Example 1 public class Double_floatValueMethodExample1 { public static void main(String[] args) { ...
2 min read
The sum() method of Double class returns the sum of two double arguments same as the operation performed by '+' operator. Syntax: public static double sum(double a, double b) Parameters: a- the first argument passed b- the second argument passed Return Value: The sum() method returns the sum of a and b. Example 1 import...
2 min read
The Double class generally wraps the primitive type double into an object. An object of Double class contains a field with the type Double. Methods: This class is useful in providing various methods like a method which can be used to convert a double to a String and...
3 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India