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

float nearbyintf(float x) {
	fenv_t e;

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