Skip to content

eps

Floating point relative accuracy

eps

  • It returns the distance from 1.0 to the next larger double-precision number.

Example 1: eps gives a constant value of 2^-52.

eps == 2^-52
ans =
1

eps(A)

  • It returns the distance from each element of abs(A) to the next larger double-precisoin number.
  • A should be either real or complex array. Logical and character arrays are not allowed.
  • The output has the same size as A.
  • eps(inf) and eps(nan) return nan.

Example 2: Floating point relative accuracy of a matrix consisting of positive and negative real numbers.

a = rand(2,3)-0.5
eps(a)
a = 1e-1 ×
-0.577  -4.369  -1.600
 0.894  -0.660  -0.880

ans = 1e-17 ×
 0.694   5.551   2.776
 1.388   1.388   1.388