# Floating point

computer format for representing real numbers

Real numbers in binary have to be stored in a special way in a computer. Computers represent numbers as binary integers (whole numbers that are powers of two), so there is no direct way for them to represent non-integer numbers like decimals as there is no radix point. One way computers bypass this problem is floating-point representation, with "floating" referring to how the radix point can move higher or lower when multiplied by an exponent (power).

## Overview

In mathematics and science, very large and very small numbers are often made simpler and multiplied to a power of ten to make them easier to understand. For example, it can be much easier to read 1.2 trillion as ${\displaystyle 1.2\times 10^{12}}$  than 1,200,000,000,000. This can also be used with negative powers of ten to make small numbers, meaning you can represent ${\displaystyle 0.000001}$  as ${\displaystyle 1\times 10^{-6}}$ . This process is called scientific notation.

Since computers are limited to integers and binary, this means they cannot easily represent fractional decimal numbers. In order to represent fractional numbers, computers use floating point numbers to split a number into two parts with scientific notation: the significand, which is an integer (whole) version of the number, and the exponent, which is the power you multiply the base by.

### Significand

The significand is found by taking the real number and removing the radix point, making it into an integer. For example: ${\displaystyle 1101.0111}$  would become ${\displaystyle 11010111}$ . This is akin to making ${\displaystyle 1.45}$  into ${\displaystyle 145}$  in decimal, which are very different in meaning but the same digits without a radix point. Similarly to how scientific notation makes the significand as basic as possible, the aim in floating point numbers is to make it an integer so it can be represented in bytes and used in calculations.

### Exponent

The exponent is the number of digits the radix point has moved past: if it moves left then the exponent is positive, but if it moves right then it is negative. In the example above, the binary point moved 4 places to the left, so the exponent is ${\displaystyle 00000100}$  (representing 4 in ${\displaystyle 2^{4}}$ ). If the point was to move to the right, such as to represent a fractional number, then the exponent would be negative (e.g. moving right one digit would be ${\displaystyle 2^{-1}}$  or ${\displaystyle 11111111}$ ; see negative binary numbers)

## Result

The result is found by putting the significand and exponent together. Using some of the examples from above:

Binary Point Significand Exponent Result
1101 . 0111) 1101 0111 0000 0100 1101 0111 0000 0100
0000.0111 0000 0111 1111 1111 0000 0111 1111 1111