2 * ====================================================
3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
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
9 * ====================================================
14 * Return x rounded toward 0 to integral value
18 * Inexact flag raised if x not equal to truncf(x).
22 #include "math_private.h"
24 static const float huge = 1.0e30F;
32 j0 = ((i0>>23)&0xff)-0x7f;
34 if(j0<0) { /* raise inexact if x != 0 */
35 if(huge+x>0.0F) /* |x|<1, so return 0*sign(x) */
39 if((i0&i)==0) return x; /* x is integral */
40 if(huge+x>0.0F) /* raise inexact flag */
44 if(j0==0x80) return x+x; /* inf or NaN */
45 else return x; /* x is integral */