MCHEP 3CW "09 March 2006" "mathcw-1.00"

Table of contents


NAME

mchepf, mchep, mchepl, mchepw, mchepq, mchepll, mchepdf, mchepd, mchepdl, mchepdll - machine-epsilon function

SYNOPSIS

cc [ flags ] -I/usr/local/include file(s) -L/usr/local/lib -lmcw [ ... ]

#include <mathcw.h>

extern float mchepf (float x);

extern double mchep (double x);

extern long double mchepl (long double x);

extern __float80 mchepw (__float80 x);

extern __float128 mchepq (__float128 x);

extern long_long_double mchepll (long_long_double x);

extern decimal_float mchepdf (decimal_float x);

extern decimal_double mchepd (decimal_double x);

extern decimal_long_double mchepdl (decimal_long_double x);

extern decimal_long_long_double mchepdll (decimal_long_long_double x);

NB: Functions with prototypes containing underscores in type names may be available only with certain extended compilers.


DESCRIPTION

Compute the generalized machine epsilon of the argument, that is, the smallest positive value eps such that x + eps differs from x.

Because the floating-point representation has a logarithmic distribution, the relative spacing of three successive values changes abruptly when the middle one is an integral power of the base. In particular, this means that mchep(x) == FLT_RADIX * mchep(-x), since mchep(-x) is the smallest positive number that can be subtracted from x with the difference not equal to x. Some authors call mchep(x) the big epsilon, and mchep(-x) the small epsilon.

mchep(x) is also called an ulp (unit in the last place).

mchep(1.0) is exactly equal to the base to the power 1 - t when there are t digits in the significand. Thus, in type double, mchep(1.0) == ldexp(1.0, 1 - DBL_MANT_DIG) exactly.

mchep(0.0) is the smallest representable floating-point number. Depending on the host system, it may be a normal number, or a subnormal number.


RETURN VALUES

Return the machine epsilon of the argument.

ERRORS

If the argument is a NaN, return that NaN. If the argument is +Infinity or -Infinity, return +Infinity. errno is never set.

SEE ALSO

isnormal(3CW), issubnormal(3CW), ulpk(3CW), ulpmh(3CW).