#### The Floating-Point Types

Floating-point numbers are represented by the float and double data types.

Floating-point numbers conform to the IEEE 754-1985 binary floating-point standard. Table 2.14 shows the range of values for positive floating-point numbers, but these apply equally to negative floating-point numbers with the minus sign (-) as a prefix. Zero can be either 0.0 or -0.0. The range of values represented by the double data type is wider than that of the float data type.

Table 2.14 Range of Floating-Point Values

Since the size for representation is a finite number of bits, certain floating-point numbers can be represented only as approximations. For example, the value of the expression (1.0/3.0) is represented as an approximation due to the finite number of bits used to represent floating-point numbers.

#### The boolean Type

The data type boolean represents the two logical values denoted by the literals true and false (Table 2.15).

Table 2.15 Boolean Values

Data type | Width | True value literal | False value literal |

boolean | Not applicable | true | false |

Boolean values are results of all relational (p. 74), conditional (p. 80), and boolean (p. 78) logical operators.

Table 2.16 summarizes the pertinent facts about the primitive data types: their width or size, which indicates the number of bits required to store a primitive value; their range of legal values, which is specified by the minimum and maximum values permissible; and the name of the corresponding wrapper class (§8.3, p. 429).

Table 2.16 Summary of Primitive Data Types

Data type | Width (bits) | Minimum value, maximum value | Wrapper class |

boolean | Not applicable | true, false | Boolean |

byte | 8 | –27, 27 – 1 | Byte |

short | 16 | –215, 215 – 1 | Short |

char | 16 | 0x0, 0xffff | Character |

int | 32 | –231, 231 – 1 | Integer |

long | 64 | –263, 263 – 1 | Long |

float | 32 | ±1.40129846432481707e-45f, ±3.402823476638528860e+38f | Float |

double | 64 | ±4.94065645841246544e-324, ±1.79769313486231570e+308 | Double |