The functions in this section compute the remainder on division of two floating-point numbers. Each is a little different; pick the one that suits your problem.

— Function: double **fmod** (`double numerator, double denominator`)

— Function: floatfmodf(float numerator, float denominator)

— Function: long doublefmodl(long double numerator, long double denominator)

Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.

These functions compute the remainder from the division of

numeratorbydenominator. Specifically, the return value isnumerator`-`

n`*`

denominator`, where`

nis the quotient ofnumeratordivided bydenominator, rounded towards zero to an integer. Thus,`fmod (6.5, 2.3)`

returns`1.9`

, which is`6.5`

minus`4.6`

.The result has the same sign as the

numeratorand has magnitude less than the magnitude of thedenominator.If

denominatoris zero,`fmod`

signals a domain error.

— Function: double **drem** (`double numerator, double denominator`)

— Function: floatdremf(float numerator, float denominator)

— Function: long doubledreml(long double numerator, long double denominator)

Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.

These functions are like

`fmod`

except that they round the internal quotientnto the nearest integer instead of towards zero to an integer. For example,`drem (6.5, 2.3)`

returns`-0.4`

, which is`6.5`

minus`6.9`

.The absolute value of the result is less than or equal to half the absolute value of the

denominator. The difference between`fmod (`

numerator`,`

denominator`)`

and`drem (`

numerator`,`

denominator`)`

is always eitherdenominator, minusdenominator, or zero.If

denominatoris zero,`drem`

signals a domain error.

— Function: double **remainder** (`double numerator, double denominator`)

— Function: floatremainderf(float numerator, float denominator)

— Function: long doubleremainderl(long double numerator, long double denominator)

Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.

This function is another name for

`drem`

.