1
/* origin: FreeBSD /usr/src/lib/msun/src/s_truncf.c */
3
* ====================================================
4
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6
* Developed at SunPro, a Sun Microsystems, Inc. business.
7
* Permission to use, copy, modify, and distribute this
8
* software is freely granted, provided that this notice
10
* ====================================================
14
* Return x rounded toward 0 to integral value
18
* Inexact flag raised if x not equal to truncf(x).
23
static const float huge = 1.0e30f;
30
GET_FLOAT_WORD(i0, x);
31
j0 = ((i0>>23)&0xff) - 0x7f;
33
if (j0 < 0) { /* |x|<1, return 0*sign(x) */
34
/* raise inexact if x != 0 */
40
return x; /* x is integral */
47
return x + x; /* inf or NaN */
48
return x; /* x is integral */
50
SET_FLOAT_WORD(x, i0);