Returns the minimum positive real value such that 1.0 + eps != 1.0.
EPS(val, "prec")
val |
- |
Optional. A scalar, series or string. |
|||||||||
"prec" |
- |
Optional. A string specifying the precision of the relative accuracy:
|
A real such that 1.0 + eps != 1.0.
EPS(val) where val is a scalar or series returns the positive distance from
EPS("double") returns the double precision relative accuracy (same as EPS).
EPS("single") or EPS("float") returns the single precision relative accuracy
1.0 + eps == 1.0
returns 0.0
1.0 + eps/2 == 1.0
returns 1.0
Consider the following one line statement:
j=0; eps1=1; while(eps1+1>1, eps1/=2; j++); eps1*=2;
After the calculation:
j == 53
eps1 == eps == 2.2204E-016
a = 1000;
b = eps(a)
c = a + b
c == a
returns 0 indicating that c and a differ to double precision accuracy.
a = 1000;
b = eps(a)/2
c = a + b
c == a
returns 1 indicating that c and a are the same to double precision accuracy.
EPS == EPS("double") == 2^(-52)
EPS("single") == 2^(-23)
The configuration parameter DEFAULT_MATH_VALUE determines the result of expressions such as 1/0.
EPS is often used as a tolerance value for math and matrix calculations.
Expressions such as
can be replaced with
.