projects
/
oweals
/
musl.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
slightly cleaner strlen, also seems to compile to better code
[oweals/musl.git]
/
src
/
math
/
nearbyint.c
1
#include <fenv.h>
2
#include <math.h>
3
4
/* nearbyint is the same as rint, but it must not raise the inexact exception */
5
6
double nearbyint(double x)
7
{
8
#ifdef FE_INEXACT
9
int e;
10
11
e = fetestexcept(FE_INEXACT);
12
#endif
13
x = rint(x);
14
#ifdef FE_INEXACT
15
if (!e)
16
feclearexcept(FE_INEXACT);
17
#endif
18
return x;
19
}