Command:

REMAINDER(3) Linux Programmer's Manual REMAINDER(3)NAMEdrem, dremf, dreml, remainder, remainderf, remainderl - floating-point remainder functionSYNOPSIS#include<math.h>/* The C99 versions */doubleremainder(doublex,doubley);floatremainderf(floatx,floaty);longdoubleremainderl(longdoublex,longdoubley);/* Obsolete synonyms */doubledrem(doublex,doubley);floatdremf(floatx,floaty);longdoubledreml(longdoublex,longdoubley);Link with-lm. Feature Test Macro Requirements for glibc (see feature_test_macros(7)):remainder(): _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE; orcc-std=c99remainderf(),remainderl(): _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE; orcc-std=c99drem(),dremf(),dreml(): _SVID_SOURCE || _BSD_SOURCEDESCRIPTIONTheremainder() function computes the remainder of dividingxbyy. The return value isx-n*y, wherenis the valuex/y, rounded to the nearest integer. If the absolute value ofx-n*yis 0.5,nis chosen to be even. These functions are unaffected by the current rounding mode (see fenv(3)). Thedrem() function does precisely the same thing.RETURNVALUEOn success, these functions return the floating-point remainder,x-n*y. If the return value is 0, it has the sign ofx. Ifxoryis a NaN, a NaN is returned. Ifxis an infinity, andyis not a NaN, a domain error occurs, and a NaN is returned. Ifyis zero, andxis not a NaN, a domain error occurs, and a NaN is returned.ERRORSSee math_error(7) for information on how to determine whether an error has occurred when calling these func- tions. The following errors can occur: Domain error:xis an infinity andyis not a NaN An invalid floating-point exception (FE_INVALID) is raised. These functions do not seterrnofor this case. Domain error:yis zeroerrnois set toEDOM. An invalid floating-point exception (FE_INVALID) is raised.CONFORMINGTOThe functionsremainder(),remainderf(), andremainderl() are specified in C99 and POSIX.1-2001. The functiondrem() is from 4.3BSD. Thefloatandlongdoublevariantsdremf() anddreml() exist on some sys- tems, such as Tru64 and glibc2. Avoid the use of these functions in favor ofremainder() etc.BUGSThe call remainder(nan(""), 0); returns a NaN, as expected, but wrongly causes a domain error; it should yield a silent NaN.EXAMPLEThe call "remainder(29.0, 3.0)" returns -1.SEEALSOdiv(3), fmod(3), remquo(3)COLOPHONThis page is part of release 3.22 of the Linuxman-pagesproject. A description of the project, and informa- tion about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. 2009-02-04 REMAINDER(3)