fmod
double  fmod ( double x, doublr y );
math.h
  cplusplus.com  

Return remainder of floating point division.
  Performs division x/y and returns the remainder of the operation.

Parameters.

x and y
Floating point values

Return Value.
  Remainder of x/y.

Portability.
  Defined in ANSI-C.
  ANSI-C++ adds float and double overloaded versions of this function, with the same bahavior but being both, parameter and result, of one of these types.

Example.

/* fmod example */
#include <stdio.h>
#include <math.h>

main ()
{
  printf ("fmod of 5.3 / 2 is %lf\n", fmod (5.3,2) );
  printf ("fmod of 18.5 / 4.2 is %lf\n", fmod (18.5,4.2) );
  return 0;
}
Output:
fmod of 5.3 / 2 is 1.300000
fmod of 18.5 / 4.2 is 1.700000

See also.
  ceil, fabs, floor


© The C++ Resources Network, 2000