Floating-Point Data Types: memory and length : Float Point Data Type « Data Type « Java Tutorial






Type float and type double are two primitive floating-point types in Java.

Data TypeDescriptionMemory
float-3.4E38 to +3.4E384 bytes in memory
double-1.7E308 to +1.7E3088 bytes in memory


Examples of float literals include the following:

2elf
8.f
.5f
0f
3.14f
9.0001e+12f

Here are examples of double literals.

2el
8.
.5
0.0D
3.14
9e-9d
7e123D








2.10.Float Point Data Type
2.10.1.Floating-Point Data Types: memory and length
2.10.2.Write Floating-Point Literals with an exponent
2.10.3.Floating-Point Calculations
2.10.4.Using ++ and -- with floating-point variables
2.10.5.Applying the modulus operator, %, to floating-point values