Name
fmod, fmodf, fmodl
- floating-point remainder function
Library
libm.lib
Synopsis
|
double
fmod (double x, double y);
|
|
float
fmodf (float x, float y);
|
|
long double
fmodl (long double x, long double y);
|
Return values
The
fmod,
fmodf,
and
fmodl
functions return the value
x - i * y,
for some integer
i
such that, if
y
is non-zero, the result has the same sign as
x
and magnitude less than the magnitude of
y.
If
y
is zero, whether a domain error occurs or the
fmod
and
fmodf
function returns zero is implementation-defined.
Detailed description
The
fmod,
fmodf,
and
fmodl
functions compute the floating-point remainder of
x / y.
fmodl
is an alias to the function
fmod.
Examples
#include <math.h>
int main()
{
double x1 = 6.5, x2 = 2.25, y;
y = fmod( x1, x2 );
printf( "fmod(%f , %f) = %f\n", x1, x2, y );
y = fmodf( x1, x2 );
printf( "fmodf(%f , %f) = %f\n", x1, x2, y );
y = fmodl( x1, x2 );
printf( "fmodl(%f , %f) = %f\n", x1, x2, y );
}
Output
fmod ( 6.4, 2 ) = 2.0
fmodf( 6.4, 2 ) = 2.0
fmodl( 6.4, 2 ) = 2.0
See also
math
Feedback
For additional information or queries on this page send feedback
© 2005-2007 Nokia
|
|