Chapter Contents

Previous

Next
remquo

remquo



Compute the floating-point remainder and a partial quotient

Portability: C99


SYNOPSIS
DESCRIPTION
RETURN VALUE
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

   #include <math.h>

   double remquo(double x, double y, int *q);
   float remquof(float x, float y, int *q);
   long double remquol(long double x, long double y, int *q);


DESCRIPTION

remquo produces the remainder when the first argument, x, is divided by the second argument, y. Both arguments are assumed to be exact, and the division is performed exactly. The remainder is computed using a rounded integer quotient. If the fractional part of the quotient is 0.5, the quotient is rounded to an even value.

The initial bits of the rounded integer quotient are stored in the integer addressed by the argument, q. The sign of the value stored is the correct sign of the quotient, and at least the last three bits of the quotient are correct.

Note:   With SAS/C, all 31 quotient bits are correct, but the C99 specification only guarantees three bits.  [cautionend]

The function name remquof should be used for float arguments, and remquol for long double arguments. Alternately, if the header file tgmath.h is included, remquo may be used with any numeric argument type.


RETURN VALUE

remquo returns the remainder resulting from division of x by y, if it is defined and representable.


RELATED FUNCTIONS

fmod, remainder


SEE ALSO

"Mathematical Functions" in Chapter 2, "Function Categories"


Chapter Contents

Previous

Next

Top of Page

Copyright © 2004 by SAS Institute Inc., Cary, NC, USA. All rights reserved.