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

Table of contents


NAME

remainderf, remainder, remainderl, remainderw, remainderq, remainderll, remainderdf, remainderd, remainderdl, remainderdll - remainder function

SYNOPSIS

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

#include <mathcw.h>

extern float remainderf (float x, float y);

extern double remainder (double x, double y);

extern long double remainderl (long double x, long double y);

extern __float80 remainderw (__float80 x, __float80 y);

extern __float128 remainderq (__float128 x, __float128 y);

extern long_long_double remainderll (long_long_double x, long_long_double y);

extern decimal_float remainderdf (decimal_float x, decimal_float y);

extern decimal_double remainderd (decimal_double x, decimal_double y);

extern decimal_long_double remainderdl (decimal_long_double x, decimal_long_double y);

extern decimal_long_long_double remainderdll (decimal_long_long_double x, decimal_long_long_double y);

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


DESCRIPTION

Compute the value x - n*y, for some integer n that is the nearest to the exact value of x / y. In addition, whenever |n - x/y| = 1/2 exactly, then n is chosen to be even. This operation is always exact, and if the result is zero, it has the sign of x. The result always lies in [-|y|/2, +|y|/2].

Unlike fmod(x,y), the sign of remainder(x,y) may differ from that of x.

Caution: When the quotient x / y is of large magnitude, the computation can take a relatively long time (many thousands of floating-point instructions).


RETURN VALUES

Return the value of x - n*y.

ERRORS

If either of the first two arguments is a NaN, or if both are NaNs, or if the first argument is +Infinity or -Infinity, or if the second argument is zero, set errno to EDOM, and return a NaN.

SEE ALSO

fmod(3CW), remquo(3CW).