fmod - C math.h

C examples for math.h:fmod

Type

function

From

<cmath>
<ctgmath>
<math.h>

Description

Returns the floating-point remainder of numer/denom (rounded towards zero)

Prototype

long double fmodl (long double numer, long double denom);
long double fmod (long double numer, long double denom);
long double fmod (long double numer, long double denom);
     double fmod (double numer, double denom);
      float fmodf (float numer      , float denom);
     double fmod (Type1 numer      , Type2 denom);       

Parameters

Parameter Description
numer Value of the quotient numerator.
denom Value of the quotient denominator.

Return Value

The remainder of dividing the arguments. If denom is zero, the function may either return zero or cause a domain error.

Example

Demo Code


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

int main ()//from   www.ja  va  2  s. c  o  m
{
  printf ( "%f\n", fmod (5.3,2) );
  printf ( "%f\n", fmod (0,2) );
  printf ( "%f\n", fmod (1.5,4.2) );
  return 0;
}

Related Tutorials