Man Linux: Main Page and Category List

fmod, fmodf, fmodl - floating-point remainder function

#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(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE; orcc-std=c99

Thefmod() function computes the floating-point remainder of dividingxbyy. The return value isx-n*y, wherenis the quotient ofx/y, rounded towards zero to an integer.

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.

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

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

remainder(3)

This page is part of release 3.24 of the Linuxman-pagesproject. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. 2008-08-05