fmodf


Remainder function

[Classification]

Mathematical library

[Syntax]

#include <mathf.h>

float fmodf(float x, float y);

[Return value]

Returns a floating-point value that is the remainder resulting from dividing x by y.

If y is +∞, fmodf returns x.

If x is +∞ or y is zero, fmodf returns a NaN and sets macro EDOM to global variable errno.

[Description]

This function calculates a floating-point value that is the remainder resulting from dividing x by y. In other words, it calculates the value "x - i * y" for the maximum integer i that has a sign the same as x and is less than y, if y is not zero.

[Example]

#include    <mathf.h>
void func(void) {
        float   ret, x, y;
        ret = fmodf(x, y);  /*Returns remainder resulting from dividing x by y to ret.*/
          :
}