La rappresentazione interna è in virgola mobile IEEE 754.
Wikipedia: Virgola mobile, IEEE 754.
Classe | #byte | #bit | #cifre | MIN_VALUE | MAX_VALUE | |
---|---|---|---|---|---|---|
float | Float | 4 | 32 | 6..7 | 1.40E-45f 2-149 0x1 |
3.4028235E38f (2-2-23)·2127 0x7f7fffff |
double | Double | 8 | 64 | 14..15 | 4.9E-324d 2-1074 0x1L |
1.7976931348623157E308d (2-2-52)·21023 0x7fefffffffffffffL |
Le classi corrispondenti definiscono delle costanti
NEGATIVE_INFINITY | POSITIVE_INFINITY | NaN | |
---|---|---|---|
float | -1f/0f 0xff800000 |
1f/0f 0x7f800000 |
0f/0f 0x7fc00000 |
double | -1d/0d 0xfff0000000000000L |
1d/0d 0x7ff0000000000000L |
0d/0d 0x7ff8000000000000L |
java.lang.Double
public final class Double extends Number implements Comparable
Costruttori
Double(double) Double(String)
Attributi
SIZE MIN_VALUE MAX_VALUE NEGATIVE_INFINITY POSITIVE_INFINITY NaN
Metodi
boolean |
isInfinite() isInfinite(double) isNaN() isNaN(double) |
byte |
byteValue() |
short |
shortValue() |
int |
intValue() compare(double, double) |
long |
longValue() doubleToLongBits(double) |
float |
floatValue(double) |
double |
doubleValue() parseDouble(String) longBitsToDouble(long) |
Double |
valueOf(String) |
String |
toString(double) |
java.lang.Float
public final class Float extends Number implements Comparable
Costruttori
Float(float) Float(double) Float(String)
Attributi
SIZE MIN_VALUE MAX_VALUE NEGATIVE_INFINITY POSITIVE_INFINITY NaN
Metodi
boolean |
isInfinite(), isInfinite(float) isNaN(float), isNaN(float) |
byte |
byteValue() |
short |
shortValue() |
int |
intValue() compare(float, float) floatToIntBits(float) |
long |
longValue() |
float |
parseFloat(String), floatValue() intBitsToFloats(int) |
Float |
floatValue() |
double |
doubleValue() |
String |
toString(), toString(float) |