cosmopolitan/libc/tinymath/emodl.h
Justine Tunney fa20edc44d
Reduce header complexity
- Remove most __ASSEMBLER__ __LINKER__ ifdefs
- Rename libc/intrin/bits.h to libc/serialize.h
- Block pthread cancelation in fchmodat() polyfill
- Remove `clang-format off` statements in third_party
2023-11-28 14:39:42 -08:00

19 lines
546 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef COSMOPOLITAN_LIBC_TINYMATH_EMODL_H_
#define COSMOPOLITAN_LIBC_TINYMATH_EMODL_H_
#include "libc/math.h"
/**
* Returns Euclidean floating-point division remainder.
*
* @return (𝑥 mod 𝑦) ∈ [0.,𝑦)
* @see fmodl()
*/
#define emodl(x, y) \
({ \
long double __x = x; \
long double __y = y; \
__x - fabsl(__y) * floorl(__x / fabsl(__y)); \
})
#endif /* COSMOPOLITAN_LIBC_TINYMATH_EMODL_H_ */