Keil Logo


#include <math.h>

double fmod (
  double x,    /* value to calculate modulo for */
  double y);   /* integer portion of modulo */

The fmod function returns a value f such that f has the same sign as x, the absolute value of f is less than the absolute value of y, and there exists an integer k such that:

k * y + f = x

If the quotient x / y cannot be represented, the result is undefined.

Return Value

The fmod function returns the floating-point remainder of x / y.

#include <math.h>
#include <stdio.h> /* for printf */

void tst_fmod (void) {
  float f;

  f = fmod (15.0, 4.0);
  printf ("fmod (15.0, 4.0) = %f\n", f);
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.