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

Table of contents


NAME

remquof, remquo, remquol, remquow, remquoq, remquoll, remquodf, remquod, remquodl, remquodll - remainder-and-quotient function

SYNOPSIS

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

#include <mathcw.h>

extern float remquof (float x, float y, /*@out@*/ int *quo);

extern double remquo (double x, double y, /*@out@*/ int *quo);

extern long double remquol (long double x, long double y, /*@out@*/ int *quo);

extern __float80 remquow (__float80 x, __float80 y, /*@out@*/ int *quo);

extern __float128 remquoq (__float128 x, __float128 y, /*@out@*/ int *quo);

extern long_long_double remquoll (long_long_double x, long_long_double y, /*@out@*/ int *quo);

extern decimal_float remquodf (decimal_float x, decimal_float y, /*@out@*/ int *quo);

extern decimal_double remquod (decimal_double x, decimal_double y, /*@out@*/ int *quo);

extern decimal_long_double remquodl (decimal_long_double x, decimal_long_double y, /*@out@*/ int *quo);

extern decimal_long_long_double remquodll (decimal_long_long_double x, decimal_long_long_double y, /*@out@*/ int *quo);

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 remquo(x,y,&quo) may differ from that of x.

If the third argument is not NULL, store in the object to which it points a value whose sign of is that of x / y and whose magnitude is congruent modulo 2**k, where k is an implementation-defined integer greater than or equal to three. That value corresponds to the low-order bits of n, which can be a value much too large to represent as a value of integer type. For example, in trigonometric argument reduction, knowing the three low-order bits of n allows determination of the octant in which the angle lies.

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


RETURN VALUES

Return the value of x - n*y, which is identical to that from remainder(x,y), and if the third argument is non-NULL, set quo as well.

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), remainder(3CW).