Representation of Floating-Point Numbers

We learned how to represent integers (unsigned and signed) and characters in a computer. However, besides these data types, a computer must also work with fractions (also called floating-point numbers or floats.) Well, how does a computer represent floating-point numbers?

Every decimal number, whether it is an integer or a fraction, can be represented in scientific notation, e.g., $3400 = 3.4 \times 10^3$ and $-0.00012 = -1.2 \times 10^{-4}$. The $3.4$ and $-1.2$ parts are called the significand.

In other words, in scientific notation, numbers are written as a product of a coefficient (between 1 and 10) and a power of 10. The exponent indicates how many places the decimal point has moved: a positive exponent for large numbers and a negative exponent for small ones.

Computers use a similar notation idea: we can represent floating-point numbers using a sign bit, an exponent, and a significand.