Provided by: manpages-dev_5.05-1_all

**NAME**

fmod, fmodf, fmodl - floating-point remainder function

**SYNOPSIS**

#include<math.h>doublefmod(doublex,doubley);floatfmodf(floatx,floaty);longdoublefmodl(longdoublex,longdoubley);Link with-lm. Feature Test Macro Requirements for glibc (seefeature_test_macros(7)):fmodf(),fmodl(): _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || /* Since glibc 2.19: */ _DEFAULT_SOURCE || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE

**DESCRIPTION**

These functions compute the floating-point remainder of dividingxbyy. The return value isx-n*y, wherenis the quotient ofx/y, rounded toward zero to an integer.

**RETURN** **VALUE**

On success, these functions return the valuex-n*y, for some integern, such that the returned value has the same sign asxand a magnitude less than the magnitude ofy. Ifxoryis a NaN, a NaN is returned. Ifxis an infinity, a domain error occurs, and a NaN is returned. Ifyis zero, a domain error occurs, and a NaN is returned. Ifxis +0 (-0), andyis not zero, +0 (-0) 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 infinityerrnois set toEDOM(but see BUGS). An invalid floating-point exception (FE_INVALID) is raised. Domain error:yis zeroerrnois set toEDOM. An invalid floating-point exception (FE_INVALID) is raised.

**ATTRIBUTES**

For an explanation of the terms used in this section, seeattributes(7). ┌─────────────────────────┬───────────────┬─────────┐ │Interface│Attribute│Value│ ├─────────────────────────┼───────────────┼─────────┤ │fmod(),fmodf(),fmodl() │ Thread safety │ MT-Safe │ └─────────────────────────┴───────────────┴─────────┘

**CONFORMING** **TO**

C99, POSIX.1-2001, POSIX.1-2008. The variant returningdoublealso conforms to SVr4, 4.3BSD, C89.

**BUGS**

Before version 2.10, the glibc implementation did not seterrnotoEDOMwhen a domain error occurred for an infinitex.

**SEE** **ALSO**

remainder(3)

**COLOPHON**

This page is part of release 5.05 of the Linuxman-pagesproject. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. 2017-09-15 FMOD(3)