Java Reference
In-Depth Information
Chapter 21
Fixed-Precision Numeric Data
Java Numeric Data Types
Java numeric data types can be classified into two groups: the language's
fixed-precision primitive data types, and the arbitrary- or variable-preci-
sion numeric types implemented in the java.math library. Variable-preci-
sion numeric types are the subject of Chapter 22.
Primitive Data Types
In Chapter 4 you saw the standard numeric data types supported by Java.
These include four integer types (int, short, long, and byte) and two float-
ing-pointtypes(floatanddouble). Table21-1 showstheformattingof
Java's primitive numeric data types.
Table 21-1
Java Fixed-precision Numeric Types
TYPE
BITS
MAXIMUM
MINIMUM
DESCRIPTION
Int
32
2,147,483,648
-2,147,483,648
Signed integer
Short
16
32,767
-32,768
Signed integer
Long
64
9.2233...E17
-9.2233...E17
Signed integer
Byte
8
128
-127
Signed integer
Float
32
3.40282...E38
1.40129...E-45
IEEE single
Double
64
1.79769...E308
4.94065...E-324
IEEE double
Java primitive numeric data types correspond to IEEE 754 Standard
for Binary Floating-Point Arithmetic. Understanding computer arithmetic
in general, and Java arithmetic in particular, requires some knowledge of
the Standard.
 
Search WWH ::




Custom Search