Floating Point Types

This lesson digs into the types of floating points and their properties.

Earlier in this chapter, we have seen that, despite their ease of use, arithmetic operations on integers are prone to programming errors due to overflow and truncation. We have also seen that integer type variables cannot have values with fractional parts, as in 1.25.

Floating point types #

Floating point types are designed to support fractional parts. The “point” in their name comes from the radix point, which separates the integer part from the fractional part, and “floating” refers to the detail in how these types are implemented. The decimal point floats left and right as the number of digits is not fixed before and after the decimal point.

Get hands-on with 1400+ tech skills courses.