cosmopolitan/libc/tinymath/emodl.h

18 lines
483 B
C
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#ifndef COSMOPOLITAN_LIBC_TINYMATH_EMODL_H_
#define COSMOPOLITAN_LIBC_TINYMATH_EMODL_H_
#include "libc/math.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
/**
* Returns Euclidean floating-point division remainder.
*
* @return (𝑥 mod 𝑦) ∈ [0.,𝑦)
* @see fmodl()
*/
static inline long double emodl(long double x, long double y) {
return x - fabsl(y) * floorl(x / fabsl(y));
}
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_TINYMATH_EMODL_H_ */