EPS

Purpose:

Returns the minimum positive real value such that 1.0 + eps != 1.0.

Syntax:

EPS(val, "prec")

val

-

Optional. A scalar, series or string.

"prec"

-

Optional. A string specifying the precision of the relative accuracy:

"double"

:

double precision (default)

"single"

:

single precision

"float"

:

same as "single"

Returns:

A real such that 1.0 + eps != 1.0.

EPS(val) where val is a scalar or series returns the positive distance from ABS(val) such that val + EPS(val) != val.

EPS("double") returns the double precision relative accuracy (same as EPS).

EPS("single") or EPS("float") returns the single precision relative accuracy

Example:

1.0 + eps == 1.0

 

returns 0.0

Example:

1.0 + eps/2 == 1.0

 

returns 1.0

Example:

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

Example:

a = 1000;

b = eps(a)

c = a + b

 

c == a

 

returns 0 indicating that c and a differ to double precision accuracy.

Example:

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.

Remarks:

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 x < eps * val can be replaced with x < eps(val).

See Also:

BITMAX

INF

REALMAX

REALMIN

SVDDIV