diff options
Diffstat (limited to 'lib/msun/src/s_rintf.c')
-rw-r--r-- | lib/msun/src/s_rintf.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/msun/src/s_rintf.c b/lib/msun/src/s_rintf.c index 32697fb..ce8b786 100644 --- a/lib/msun/src/s_rintf.c +++ b/lib/msun/src/s_rintf.c @@ -17,7 +17,9 @@ static char rcsid[] = "$FreeBSD$"; #endif -#include <sys/types.h> +#include <float.h> +#include <stdint.h> + #include "math.h" #include "math_private.h" @@ -31,20 +33,20 @@ float rintf(float x) { int32_t i0,j0,sx; - volatile float w,t; /* volatile works around gcc bug */ + float w,t; GET_FLOAT_WORD(i0,x); sx = (i0>>31)&1; j0 = ((i0>>23)&0xff)-0x7f; if(j0<23) { if(j0<0) { if((i0&0x7fffffff)==0) return x; - w = TWO23[sx]+x; + STRICT_ASSIGN(float,w,TWO23[sx]+x); t = w-TWO23[sx]; GET_FLOAT_WORD(i0,t); SET_FLOAT_WORD(t,(i0&0x7fffffff)|(sx<<31)); return t; } - w = TWO23[sx]+x; + STRICT_ASSIGN(float,w,TWO23[sx]+x); return w-TWO23[sx]; } if(j0==0x80) return x+x; /* inf or NaN */ |