MirOS Manual: remainder(3), remainderf(3), remquo(3), remquof(3)

REMAINDER(3)               BSD Programmer's Manual                REMAINDER(3)


     remainder, remainderf, remquo, remquof - remainder functions




     #include <math.h>

     remainder(double x, double y);

     remainderf(float x, float y);

     remquo(double x, double y, int *quo);

     remquof(float x, float y, int *quo);


     Provided that y != 0 , the remainder() and remainderf() functions calcu-
     late the floating-point remainder r of

           r = x - ny,

     where n is the integral value nearest to the exact value of x / y. If

            n - x / y  = 1/2 ,

     the value n is chosen to be even. Consequently, the remainder is computed
     exactly and  r  <= | y | / 2 .

     Also the remquo() and remquof() functions calculate the remainder as
     described above. But these additionally use quo to store a value whose
     sign is the sign of x / y and whose magnitude is congruent modulo 2^k to
     the magnitude of the integral quotient of x / y, where k is an
     implementation-defined integer greater than or equal to 3.

     The rationale of the remquo() family of functions relates to situations
     where only few bits of the quotient are required. The exact representa-
     tion of the quotient may not be meaningful when x is large in magnitude
     compared to y.


     The functions return the remainder independent of the rounding mode. If y
     is zero , NaN is returned and a domain error occurs. A domain error oc-
     curs and a NaN is returned also when x is infinite but y is not a NaN. If
     either x or y is NaN, a NaN is always returned.


     div(3), fast_remainder32(3), fmod(3), math(3)


     The described functions conform to ISO/IEC 9899:1999 ("ISO C99").

MirOS BSD #10-current         September 18, 2011                             1

Generated on 2015-10-25 00:47:46 by $MirOS: src/scripts/roff2htm,v 1.81 2015/10/16 13:19:09 tg Exp $

These manual pages and other documentation are copyrighted by their respective writers; their source is available at our CVSweb, AnonCVS, and other mirrors. The rest is Copyright © 2002–2015 The MirOS Project, Germany.
This product includes material provided by mirabilos.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.