IEEE Floating-Point Accuracy Utility

Floating-Point Error Calculator

Compare an expected numerical value with an actual floating-point value and calculate signed error, absolute error, relative error, percentage error, Float32 or Float64 representation error, local ULP size and approximate error measured in ULPs.

✓ Absolute Error ✓ Relative Error ✓ Percentage Error ✓ ULP Error ✓ Float32 / Float64
ERR
Floating-Point Error Analysis
● Ready
Reference value used as the denominator for relative and percentage error.
Measured, calculated or floating-point result to compare with the reference.
The actual input is rounded to the selected IEEE 754 representation before representation-specific values are reported.
Choose whether primary error metrics compare against the entered value or its selected Float32 / Float64 representation.
Error convention: signed error is calculated as Actual − Expected. Absolute error is its magnitude. Relative error is |Actual − Expected| / |Expected|. When the expected value is exactly zero, conventional relative and percentage error are undefined unless the actual error is also zero.
Floating-Point Error Result Calculated
Absolute Error
Expected Value
Compared Actual
Signed Error
Absolute Error
Relative Error
Percentage Error
Stored Float Value
Representation Error
Local Upward ULP
Error in ULPs
IEEE Hex
Format
Stored IEEE 754 Binary
Calculation Breakdown

What Is a Floating-Point Error Calculator?

A Floating-Point Error Calculator measures the difference between an expected reference value and a numerical result. It can express the difference as an absolute amount, a signed error, a relative ratio, a percentage and an approximate number of floating-point ULPs.

The calculator can also round the entered value to IEEE 754 Binary32 or Binary64 and show how much additional error is introduced by that representation.

Signed Error Formula

Signed Error = Actual - Expected

A positive result means the actual value is above the expected value. A negative result means it is below the expected value.

Absolute Error Formula

Absolute error ignores the direction of the difference and measures only its magnitude.

Absolute Error = |Actual - Expected|

If the expected value is 100 and the actual value is 99.9:

|99.9 - 100| = 0.1

Relative Error Formula

Relative error compares the absolute error with the magnitude of the expected reference value.

Relative Error = |Actual - Expected| ------------------- |Expected|

Relative error is dimensionless and makes it easier to compare errors across values with very different magnitudes.

Percentage Error Formula

Percentage Error = Relative Error × 100%

For example:

Expected = 100 Actual = 99.9 Absolute Error = 0.1 Relative Error = 0.1 / 100 = 0.001 Percentage Error = 0.1%

What Happens When the Expected Value Is Zero?

Relative error divides by the magnitude of the expected value. Therefore a nonzero error relative to an expected value of zero does not have a finite conventional relative error.

Expected = 0 Actual = 0.001 Relative Error: undefined / infinite comparison because denominator = 0

The calculator reports this case explicitly rather than silently dividing by zero.

Floating-Point Representation Error

A decimal number entered by a user may not be exactly representable in the selected binary floating-point format. Representation error measures the difference between the rounded stored floating-point value and the entered numeric value.

Representation Error = Stored Float - Entered Actual

This is different from application error between an expected answer and an actual computed answer.

Example: Decimal 0.1 as Float32

The decimal fraction 0.1 cannot be represented exactly by a finite binary fraction. In Binary32 it is stored approximately as:

0.10000000149011612

The difference from mathematical decimal 0.1 is approximately:

1.4901161193847657 × 10^-9

This small difference is a normal consequence of binary floating-point representation.

Error Measured in ULPs

ULP means unit in the last place. Measuring an error in ULPs relates the difference to the spacing between nearby representable numbers.

Approximate ULP Error = Absolute Error / Local ULP

An error of approximately one ULP means the numerical difference is about one floating-point step at that magnitude.

Float32 and Float64 Precision

Format Total Bits Fraction Bits Significand Precision
Float32 / Binary32 32 23 24 binary digits
Float64 / Binary64 64 52 53 binary digits

Binary64 normally represents numbers much more precisely than Binary32 because it has more than twice as many fraction bits.

Rounding Error vs Measurement Error

Floating-point error is not always caused by floating-point representation. The difference between expected and actual values can come from measurement noise, numerical algorithms, approximation formulas, truncation or accumulated rounding.

The representation-error result isolates only the rounding performed when the actual input is converted to the selected Float32 or Float64 representation.

Absolute Error vs Relative Error

Absolute error is easiest to interpret when the unit and numerical scale are already meaningful. Relative error is often more useful when comparing the quality of results with different magnitudes.

Error of 1: Expected 10 → relative error 10% Expected 1,000,000 → relative error 0.0001%

The same absolute difference can therefore have very different significance.

Why Floating-Point Values Are Often Approximate

Binary floating-point can exactly represent numbers whose fractional part can be expressed using a finite number of powers of two. Many familiar decimal fractions, including 0.1 and 0.2, require an infinite repeating representation in binary.

The stored value must therefore be rounded to the nearest available floating-point number.

Accumulated Floating-Point Error

A single representation error may be tiny, but repeated arithmetic can cause errors to accumulate or interact with cancellation, rounding and changing numerical scale.

A small one-step error does not automatically prove that a complete numerical algorithm is accurate. Numerical stability depends on the sequence of operations as well as the floating-point format.

Catastrophic Cancellation

When two nearly equal floating-point values are subtracted, significant leading digits can cancel and leave a result containing relatively few accurate bits. This is known as catastrophic cancellation.

a ≈ b result = a - b Small absolute rounding differences in a and b can become large relative differences in result.

Floating-Point Error Calculator FAQs

What is floating-point error?
It is the numerical difference between a reference value and a value produced or stored using floating-point arithmetic.
What is absolute error?
Absolute error is the magnitude of Actual minus Expected.
What is signed error?
Signed error is Actual minus Expected. Its sign shows whether the actual value is above or below the reference.
What is relative error?
Relative error is absolute error divided by the magnitude of the expected reference value.
How is percentage error calculated?
Multiply relative error by 100.
Can relative error be calculated when expected value is zero?
A conventional finite relative error cannot be calculated for a nonzero difference when the expected reference is exactly zero.
What is representation error?
It is the difference introduced when a number is rounded to the selected floating-point representation.
What does error in ULPs mean?
It expresses the error relative to the spacing between representable floating-point values near the selected reference magnitude.
Is one ULP always the same size?
No. Floating-point spacing changes with exponent and therefore with numerical magnitude.
Why is 0.1 not exact in binary floating point?
Its binary fractional representation repeats indefinitely, so a finite Float32 or Float64 value must approximate it.
Which is more precise: Float32 or Float64?
Float64 has substantially more significand precision and typically produces smaller representation error.
Does a zero absolute error mean the numbers are represented identically?
For the values being compared numerically, yes. However, positive zero and negative zero can have different IEEE 754 bit patterns while comparing equal.
Is percentage error always a good floating-point accuracy measure?
No. Near zero, percentage and relative error can become very large or undefined. Absolute and ULP-based measures may be more informative in those situations.

Measure Floating-Point Numerical Error

Compare expected and actual values using absolute, relative, percentage and ULP-based error while also inspecting how Float32 or Float64 storage changes the supplied number.

Scroll to Top