GeezerVison is showing docs.oracle.com — Double (Java SE 11 & JDK 11 )
-
-
Field Summary
Fields
| Modifier and Type |
Field |
Description |
static int |
BYTES |
The number of bytes used to represent a double value.
|
static int |
MAX_EXPONENT |
Maximum exponent a finite double variable may have.
|
static double |
MAX_VALUE |
A constant holding the largest positive finite value of type
double,
(2-2-52)·21023.
|
static int |
MIN_EXPONENT |
Minimum exponent a normalized double variable may
have.
|
static double |
MIN_NORMAL |
A constant holding the smallest positive normal value of type
double, 2-1022.
|
static double |
MIN_VALUE |
A constant holding the smallest positive nonzero value of type
double, 2-1074.
|
static double |
NaN |
A constant holding a Not-a-Number (NaN) value of type
double.
|
static double |
NEGATIVE_INFINITY |
A constant holding the negative infinity of type
double.
|
static double |
POSITIVE_INFINITY |
A constant holding the positive infinity of type
double.
|
static int |
SIZE |
The number of bits used to represent a double value.
|
static Class<Double> |
TYPE |
The Class instance representing the primitive type
double.
|
-
Constructor Summary
Constructors
| Constructor |
Description |
Double(double value) |
Deprecated.
It is rarely appropriate to use this constructor.
|
Double(String s) |
Deprecated.
It is rarely appropriate to use this constructor.
|
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods
| Modifier and Type |
Method |
Description |
byte |
byteValue() |
Returns the value of this Double as a byte
after a narrowing primitive conversion.
|
static int |
compare(double d1,
double d2) |
Compares the two specified double values.
|
int |
compareTo(Double anotherDouble) |
Compares two Double objects numerically.
|
static long |
doubleToLongBits(double value) |
Returns a representation of the specified floating-point value
according to the IEEE 754 floating-point "double
format" bit layout.
|
static long |
doubleToRawLongBits(double value) |
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.
|
double |
doubleValue() |
Returns the double value of this Double object.
|
boolean |
equals(Object obj) |
Compares this object against the specified object.
|
float |
floatValue() |
Returns the value of this Double as a float
after a narrowing primitive conversion.
|
int |
hashCode() |
Returns a hash code for this Double object.
|
static int |
hashCode(double value) |
Returns a hash code for a double value; compatible with
Double.hashCode().
|
int |
intValue() |
Returns the value of this Double as an int
after a narrowing primitive conversion.
|
static boolean |
isFinite(double d) |
Returns true if the argument is a finite floating-point
value; returns false otherwise (for NaN and infinity
arguments).
|
boolean |
isInfinite() |
Returns true if this Double value is
infinitely large in magnitude, false otherwise.
|
static boolean |
isInfinite(double v) |
Returns true if the specified number is infinitely
large in magnitude, false otherwise.
|
boolean |
isNaN() |
Returns true if this Double value is
a Not-a-Number (NaN), false otherwise.
|
static boolean |
isNaN(double v) |
Returns true if the specified number is a
Not-a-Number (NaN) value, false otherwise.
|
static double |
longBitsToDouble(long bits) |
Returns the double value corresponding to a given
bit representation.
|
long |
longValue() |
Returns the value of this Double as a long
after a narrowing primitive conversion.
|
static double |
max(double a,
double b) |
Returns the greater of two double values
as if by calling Math.max.
|
static double |
min(double a,
double b) |
Returns the smaller of two double values
as if by calling Math.min.
|
static double |
parseDouble(String s) |
Returns a new double initialized to the value
represented by the specified String, as performed
by the valueOf method of class
Double.
|
short |
shortValue() |
Returns the value of this Double as a short
after a narrowing primitive conversion.
|
static double |
sum(double a,
double b) |
Adds two double values together as per the + operator.
|
static String |
toHexString(double d) |
Returns a hexadecimal string representation of the
double argument.
|
String |
toString() |
Returns a string representation of this Double object.
|
static String |
toString(double d) |
Returns a string representation of the double
argument.
|
static Double |
valueOf(double d) |
Returns a Double instance representing the specified
double value.
|
static Double |
valueOf(String s) |
Returns a Double object holding the
double value represented by the argument string
s.
|
-
-
Field Detail
-
MAX_VALUE
public static final double MAX_VALUE
A constant holding the largest positive finite value of type
double,
(2-2-52)·21023. It is equal to
the hexadecimal floating-point literal
0x1.fffffffffffffP+1023 and also equal to
Double.longBitsToDouble(0x7fefffffffffffffL).
- See Also:
- Constant Field Values
-
MIN_NORMAL
public static final double MIN_NORMAL
A constant holding the smallest positive normal value of type
double, 2-1022. It is equal to the
hexadecimal floating-point literal 0x1.0p-1022 and also
equal to Double.longBitsToDouble(0x0010000000000000L).
- Since:
- 1.6
- See Also:
- Constant Field Values
-
MIN_VALUE
public static final double MIN_VALUE
A constant holding the smallest positive nonzero value of type
double, 2-1074. It is equal to the
hexadecimal floating-point literal
0x0.0000000000001P-1022 and also equal to
Double.longBitsToDouble(0x1L).
- See Also:
- Constant Field Values
-
Constructor Detail
-
Double
@Deprecated(since="9")
public Double(String s)
throws NumberFormatException
Deprecated.
It is rarely appropriate to use this constructor.
Use parseDouble(String) to convert a string to a
double primitive, or use valueOf(String)
to convert a string to a Double object.
Constructs a newly allocated Double object that
represents the floating-point value of type double
represented by the string. The string is converted to a
double value as if by the valueOf method.
- Parameters:
s - a string to be converted to a Double.
- Throws:
NumberFormatException - if the string does not contain a
parsable number.
-
Method Detail
-
parseDouble
public static double parseDouble(String s)
throws NumberFormatException
Returns a new double initialized to the value
represented by the specified String, as performed
by the valueOf method of class
Double.
- Parameters:
s - the string to be parsed.
- Returns:
- the
double value represented by the string
argument.
- Throws:
NullPointerException - if the string is null
NumberFormatException - if the string does not contain
a parsable double.
- Since:
- 1.2
- See Also:
valueOf(String)
-
isNaN
public static boolean isNaN(double v)
Returns true if the specified number is a
Not-a-Number (NaN) value, false otherwise.
- Parameters:
v - the value to be tested.
- Returns:
true if the value of the argument is NaN;
false otherwise.
-
isInfinite
public static boolean isInfinite(double v)
Returns true if the specified number is infinitely
large in magnitude, false otherwise.
- Parameters:
v - the value to be tested.
- Returns:
true if the value of the argument is positive
infinity or negative infinity; false otherwise.
-
isInfinite
public boolean isInfinite()
Returns true if this Double value is
infinitely large in magnitude, false otherwise.
- Returns:
true if the value represented by this object is
positive infinity or negative infinity;
false otherwise.
-
hashCode
public int hashCode()
Returns a hash code for this Double object. The
result is the exclusive OR of the two halves of the
long integer bit representation, exactly as
produced by the method doubleToLongBits(double), of
the primitive double value represented by this
Double object. That is, the hash code is the value
of the expression:
(int)(v^(v>>>32))
where v is defined by:
long v = Double.doubleToLongBits(this.doubleValue());
- Overrides:
hashCode in class Object
- Returns:
- a
hash code value for this object.
- See Also:
Object.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)
|