1 /*
2  * ====================================================
3  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
4  *
5  * Developed at SunPro, a Sun Microsystems, Inc. business.
6  * Permission to use, copy, modify, and distribute this
7  * software is freely granted, provided that this notice
8  * is preserved.
9  * ====================================================
10  */
11 
12 
13 #include <math.h>
14 #include "fdlibm.h"
15 
nearbyintf(float x)16 float nearbyintf(float x)
17 {
18     if (isnan(x)) return x + x;
19 #if defined(FE_INEXACT) && !defined(PICOLIBC_DOUBLE_NOEXECPT)
20     fenv_t env;
21     fegetenv(&env);
22 #endif
23     x = rintf(x);
24 #if defined(FE_INEXACT) && !defined(PICOLIBC_DOUBLE_NOEXECPT)
25     fesetenv(&env);
26 #endif
27     return x;
28 }
29 
30 _MATH_ALIAS_f_f(nearbyint)
31