REMAINDER(3) NetBSD Library Functions Manual REMAINDER(3)NAME

remainder,remainderf,remquo,remquof-- remainder functionsLIBRARY

Math Library (libm, -lm)SYNOPSIS

#include <math.h>doubleremainder(double x,double y);floatremainderf(float x,float y);doubleremquo(double x,double y,int *quo);floatremquof(float x,float y,int *quo);DESCRIPTION

Provided thaty!= 0 , theremainder() andremainderf() functions calcu- late the floating-point remainderrofr=x - ny, wherenis the integral value nearest to the exact value ofx/y. If |n-x / y| = 1/2 , the valuenis chosen to be even. Consequently, the remainder is com- puted exactly and |r| <= |y| / 2 . Also theremquo() andremquof() functions calculate the remainder as described above. But these additionally usequoto store a value whose sign is the sign ofx / yand whose magnitude is congruent modulo2^kto the magnitude of the integral quotient ofx / y, wherekis an implemen- tation-defined integer greater than or equal to 3. The rationale of theremquo() 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 whenxis large in magnitude compared toy.RETURN VALUES

The functions return the remainder independent of the rounding mode. Ifyis zero ,NaNis returned and a domain error occurs. A domain error occurs and aNaNis returned also whenxis infinite butyis not aNaN. If eitherxoryisNaN, aNaNis always returned.SEE ALSO

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

The described functions conform to ISO/IEC 9899:1999 (``ISO C99''). NetBSD 10.0 September 18, 2011 NetBSD 10.0

Powered by man-cgi (2024-08-26). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.