Provided by: manpages-dev_3.35-0.1ubuntu1_all

**NAME**

drem, dremf, dreml, remainder, remainderf, remainderl - floating-point remainder function

**SYNOPSIS**

#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 (seefeature_test_macros(7)):remainder(): _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L; orcc-std=c99remainderf(),remainderl(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L; orcc-std=c99drem(),dremf(),dreml(): _SVID_SOURCE || _BSD_SOURCE

**DESCRIPTION**

Theremainder() 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 (seefenv(3)). Thedrem() function does precisely the same thing.

**RETURN** **VALUE**

On 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.

**ERRORS**

Seemath_error(7) for information on how to determine whether an error has occurred when calling these functions. 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.

**CONFORMING** **TO**

The functionsremainder(),remainderf(), andremainderl() are specified in C99 and POSIX.1-2001. The functiondrem() is from 4.3BSD. Thefloatandlongdoublevariantsdremf() anddreml() exist on some systems, such as Tru64 and glibc2. Avoid the use of these functions in favor ofremainder() etc.

**BUGS**

The call remainder(nan(""), 0); returns a NaN, as expected, but wrongly causes a domain error; it should yield a silent NaN.

**EXAMPLE**

The call "remainder(29.0, 3.0)" returns -1.

**SEE** **ALSO**

div(3),fmod(3),remquo(3)

**COLOPHON**

This page is part of release 3.35 of the Linuxman-pagesproject. A description of the project, and information about reporting bugs, can be found at http://man7.org/linux/man- pages/. 2010-09-20 REMAINDER(3)