Is a double value an infinite large value, or it is not a number.
isInfinite( ) returns true if the value being tested is infinitely large or small in magnitude. isNaN( ) returns true if the value being tested is not a number.
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.
public class Main {
public static void main(String[] args) {
Double double1 = new Double(1/0.0);
System.out.println(double1.isInfinite());
}
}
The output:
true
public class Main {
public static void main(String[] args) {
Double double1 = new Double(0.0/0.0);
System.out.println(Double.isNaN(double1));
System.out.println(double1.isNaN());
}
}
The output:
true
true
Home
Java Book
Essential Classes
Java Book
Essential Classes
Double:
- Double class
- Constants in Double class
- Double class Constructor
- Return double value as byte, double, float, int, long, short
- Compare two double values
- Is a double value an infinite large value, or it is not a number.
- Convert string value to double
- Convert double value from string
- Get the hexadecimal string representation
- Bit oriented calculation for double type