summaryrefslogtreecommitdiff
path: root/src/math/nearbyintf.c
blob: e4bdb26c5c9be6aa5754944be2ec5546f9c4070d (plain)
1
2
3
4
5
6
7
8
9
10
11
#include <fenv.h>
#include "libm.h"

float nearbyintf(float x) {
	fenv_t e;

	fegetenv(&e);
	x = rintf(x);
	fesetenv(&e);
	return x;
}