c/numeric/math/fmod

@1-3@ Computes the floating-point remainder of the division operation. @4@ Type-generic macro: If any argument has type, is called. Otherwise, if any argument has integer type or has type, is called. Otherwise, is called.

The floating-point remainder of the division operation calculated by this function is exactly the value, where  is  with its fractional part truncated.

The returned value has the same sign as and is less or equal to  in magnitude.

Return value
If successful, returns the floating-point remainder of the division as defined above.

If a domain error occurs, an implementation-defined value is returned (NaN where supported).

If a range error occurs due to underflow, the correct result (after rounding) is returned.

Error handling
Errors are reported as specified in math_errhandling.

Domain error may occur if is zero.

If the implementation supports IEEE floating-point arithmetic (IEC 60559),
 * If is ±0 and  is not zero, ±0 is returned
 * If is ±∞ and  is not NaN, NaN is returned and fe_invalid is raised
 * If is ±0 and  is not NaN, NaN is returned  and fe_invalid is raised
 * If is ±∞ and  is finite,  is returned.
 * If either argument is NaN, NaN is returned