1 /* origin: FreeBSD /usr/src/lib/msun/src/s_floorf.c */
3 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
6 * ====================================================
7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
9 * Developed at SunPro, a Sun Microsystems, Inc. business.
10 * Permission to use, copy, modify, and distribute this
11 * software is freely granted, provided that this notice
13 * ====================================================
17 * Return x rounded toward -inf to integral value
21 * Inexact flag raised if x not equal to floorf(x).
26 static const float huge = 1.0e30;
33 GET_FLOAT_WORD(i0, x);
34 // FIXME: signed shift
35 j0 = ((i0>>23)&0xff) - 0x7f;
37 if (j0 < 0) { /* |x| < 1 */
38 /* raise inexact if x != 0 */
40 if (i0 >= 0) /* x >= 0 */
42 else if ((i0&0x7fffffff) != 0)
48 return x; /* x is integral */
49 /* raise inexact flag */
57 if (j0 == 0x80) /* inf or NaN */
60 return x; /* x is integral */
62 SET_FLOAT_WORD(x, i0);