Rounding and Machine Epsilon
Rounding and Machine Epsilon
The floating-point number line is a discrete set of points. Any real number that does not fall exactly on one of those points must be rounded to the nearest one. This section formalises that process and introduces machine epsilon which represents the worst-case relative rounding error.
The Floating-Point Representation
Given a real number , its floating-point representation is the nearest number in the system :
Because the floating-point number line is discrete, values that fall between representable numbers are rounded to the closest available point. For example, a number closer to the left bound will round down, while a number closer to the right bound will round up.

As shown above:
- is closer to than to . It rounds down to , which we define as truncation or rounding down.
- is closer to than to . It rounds up to , which we define as rounding up.
Tie-Breaking Rule
When falls exactly halfway between two adjacent floating-point numbers, standard proximity rounding can’t decide. To prevent statistical bias from always rounding up or always rounding down, IEEE 754 uses the round-to-nearest-even (or banker’s rounding) rule.
The number is rounded to the adjacent floating-point value whose last digit is even (which means it ends in 0 in binary).

As shown above:
- is the exact midpoint between and . It rounds down to because it ends in
0(even). - is the exact midpoint between and . It rounds up to because it ends in
0(even).
Quick Tricks for Binary Rounding
When rounding a binary fraction to mantissa bits, inspect the bits immediately following the -th position:
-
Round Down (Truncate)
If the immediate next bit (the -th bit) is0. The value is closer to the lower representable number, regardless of any bits that follow. -
Round Up
If the immediate next bit is1AND there are additional non-zero bits after it. This means the value is strictly greater than the halfway point. -
Round to Nearest Even (Tie-Breaker)
If the immediate next bit is1AND it is the only remaining bit (or all subsequent bits are0). The value sits exactly at the midpoint, so you round up or down to ensure the final -th bit is0(even).
Scale-Invariant (Relative) Error
Rearranging:
This compact form says: is multiplied by a factor that deviates from 1 by at most .
Machine Epsilon
Machine epsilon is the maximum possible relative rounding error in a floating-point system:
To find the worst-case (maximum) relative error, our goal is to maximize the numerator (the absolute rounding error) and minimize the denominator (the true value ).
The absolute rounding error is maximized when a number falls exactly halfway between two adjacent representable numbers. The minimum value depends on the floating-point convention being used.
Deriving : Standard Form
In the Standard Form representation, the mantissa is written as where . Let’s assume and .
- Minimize Denominator: The smallest normalized magnitude is .
- Maximize Numerator: The maximum absolute error is half the distance between and .

Dividing the maximum error by the minimum value gives:
Deriving : Normalized Form
In this Normalized Form, let’s look at an setup where the mantissa is padded (e.g., ).
- Minimize Denominator: The smallest magnitude is .
- Maximize Numerator: The maximum error is half the distance between and .

Dividing the two yields:
Deriving : De-normalized Form
In the De-normalized (or implicit leading bit) form, numbers are represented as . Let’s again use .
- Minimize Denominator: The smallest magnitude is .
- Maximize Numerator: The maximum error is half the distance between and .

Dividing them provides:
Comparison Summary
| Convention | |||
|---|---|---|---|
| Standard Form | |||
| Normalized Form | |||
| De-normalized Form |
Notice how both the Normalized and De-normalized forms achieve a tighter (smaller) machine epsilon, granting higher precision by effectively utilizing the available bits.
Key Property
For any representable number :
That is, every individual rounding satisfies the machine epsilon bound.
Quick Example
, , , , Convention 1.
Between and :
- Gap
- Midpoint
- A real value of would round to the nearest even-last-digit number.
- ends in
0(even), ends in1(odd) → rounds to
- ends in
- Relative error
- ✓