mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
fa20edc44d
- 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
21 lines
447 B
C
21 lines
447 B
C
#ifndef COSMOPOLITAN_DSP_CORE_ITUROUND_H_
|
|
#define COSMOPOLITAN_DSP_CORE_ITUROUND_H_
|
|
#include "libc/math.h"
|
|
|
|
/**
|
|
* An ITU recommended rounding function.
|
|
*
|
|
* 1. Negative numbers round toward zero
|
|
* 2. Positive numbers round toward infinity
|
|
*
|
|
* @see round(), rint()
|
|
*/
|
|
__funline long ituround(double x) {
|
|
return floor(x + .5);
|
|
}
|
|
|
|
__funline int ituroundf(float x) {
|
|
return floorf(x + .5f);
|
|
}
|
|
|
|
#endif /* COSMOPOLITAN_DSP_CORE_ITUROUND_H_ */
|