java.lang
Class Double

java.lang.Object
  extended by java.lang.Number
      extended by java.lang.Double

public final class Double
extends Number

Minimal Double implementation.

Author:
bb, Sven Köhler

Field Summary
static int MAX_EXPONENT
           
static double MAX_VALUE
           
static int MIN_EXPONENT
           
static double MIN_NORMAL
           
static double MIN_VALUE
           
static double NaN
           
static double NEGATIVE_INFINITY
           
static double POSITIVE_INFINITY
           
static int SIZE
           
static Class<?> TYPE
           
 
Constructor Summary
Double(double val)
           
Double(String val)
           
 
Method Summary
 byte byteValue()
          Return the byte value of this Number.
static long doubleToLongBits(double value)
          Returns the bit representation of a double-float value.
static long doubleToRawLongBits(double d)
          Returns the bit representation of a double-float value.
 double doubleValue()
          Return the double value of this Number.
 boolean equals(Object o)
           
 float floatValue()
          Return the float value of this Number.
 int hashCode()
           
 int intValue()
          Return the int value of this Number.
 boolean isInfinite()
           
static boolean isInfinite(double v)
           
 boolean isNaN()
           
static boolean isNaN(double val)
           
static double longBitsToDouble(long l)
          Returns the double-float corresponding to a given bit representation.
 long longValue()
          Return the long value of this Number.
static double parseDouble(String s)
          Converts a String value into a double.
 short shortValue()
          Return the short value of this Number.
 String toString()
           
static String toString(double d)
          Convert a double to a String
static Double valueOf(double d)
           
static Double valueOf(String s)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

POSITIVE_INFINITY

public static final double POSITIVE_INFINITY
See Also:
Constant Field Values

NEGATIVE_INFINITY

public static final double NEGATIVE_INFINITY
See Also:
Constant Field Values

NaN

public static final double NaN
See Also:
Constant Field Values

MAX_EXPONENT

public static final int MAX_EXPONENT
See Also:
Constant Field Values

MAX_VALUE

public static final double MAX_VALUE
See Also:
Constant Field Values

MIN_EXPONENT

public static final int MIN_EXPONENT
See Also:
Constant Field Values

MIN_NORMAL

public static final double MIN_NORMAL
See Also:
Constant Field Values

MIN_VALUE

public static final double MIN_VALUE
See Also:
Constant Field Values

SIZE

public static final int SIZE
See Also:
Constant Field Values

TYPE

public static final Class<?> TYPE
Constructor Detail

Double

public Double(double val)

Double

public Double(String val)
Method Detail

byteValue

public byte byteValue()
Description copied from class: Number
Return the byte value of this Number.

Overrides:
byteValue in class Number
Returns:
the byte value

doubleValue

public double doubleValue()
Description copied from class: Number
Return the double value of this Number.

Specified by:
doubleValue in class Number
Returns:
the double value

equals

public boolean equals(Object o)
Overrides:
equals in class Object

floatValue

public float floatValue()
Description copied from class: Number
Return the float value of this Number.

Specified by:
floatValue in class Number
Returns:
the float value

hashCode

public int hashCode()
Overrides:
hashCode in class Object

intValue

public int intValue()
Description copied from class: Number
Return the int value of this Number.

Specified by:
intValue in class Number
Returns:
the int value

isInfinite

public boolean isInfinite()

isInfinite

public static boolean isInfinite(double v)

isNaN

public boolean isNaN()

isNaN

public static boolean isNaN(double val)

longValue

public long longValue()
Description copied from class: Number
Return the long value of this Number.

Specified by:
longValue in class Number
Returns:
the long value

parseDouble

public static double parseDouble(String s)
                          throws NumberFormatException
Converts a String value into a double. Must only contain numbers and an optional decimal, and optional - sign at front.

Parameters:
s - String representation of the floating point number
Returns:
double precision floating point number
Throws:
NumberFormatException

shortValue

public short shortValue()
Description copied from class: Number
Return the short value of this Number.

Overrides:
shortValue in class Number
Returns:
the short value

toString

public String toString()
Overrides:
toString in class Object

toString

public static String toString(double d)
Convert a double to a String

Parameters:
d - the double to be converted
Returns:
the String representation of the float

valueOf

public static Double valueOf(double d)

valueOf

public static Double valueOf(String s)

doubleToRawLongBits

public static long doubleToRawLongBits(double d)
Returns the bit representation of a double-float value. The result is a representation of the floating-point argument according to the IEEE 754 floating-point "double precision" bit layout. In all cases, the result is an integer that, when given to the longBitsToDouble(long) method, will produce a floating-point value equal to the argument to doubleToRawLongBits.

Parameters:
d - a floating-point number.
Returns:
the bits that represent the floating-point number.

doubleToLongBits

public static long doubleToLongBits(double value)
Returns the bit representation of a double-float value. The result is a representation of the floating-point argument according to the IEEE 754 floating-point "double precision" bit layout. Unlike doubleToRawLongBits this method does collapse all NaN values into a standard single value. This value is 0x7ff8000000000000.

Parameters:
value - a floating-point number.
Returns:
the bits that represent the floating-point number.

longBitsToDouble

public static double longBitsToDouble(long l)
Returns the double-float corresponding to a given bit representation. The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point "double precision" bit layout.

If the argument is 0x7ff0000000000000, the result is positive infinity.

If the argument is 0xfff0000000000000, the result is negative infinity.

If the argument is any value in the range 0x7ff0000000000001L through 0x7fffffffffffffffL or in the range 0xfff0000000000001L through 0xffffffffffffffffL, the result is a NaN. All IEEE 754 NaN values of type float are, in effect, lumped together by the Java programming language into a single double value called NaN. Distinct values of NaN are only accessible by use of the Double.doubleToRawLongBits method.

Parameters:
l - a long.
Returns:
the double-format floating-point value with the same bit pattern.