]>
git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/ieee754/flt-32/s_floorf.c
1 /* s_floorf.c -- float version of s_floor.c.
5 * ====================================================
6 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8 * Developed at SunPro, a Sun Microsystems, Inc. business.
9 * Permission to use, copy, modify, and distribute this
10 * software is freely granted, provided that this notice
12 * ====================================================
17 * Return x rounded toward -inf to integral value
22 #define NO_MATH_REDIRECT
24 #include <math_private.h>
25 #include <libm-alias-float.h>
26 #include <math-use-builtins.h>
31 #if USE_FLOORF_BUILTIN
32 return __builtin_floorf (x
);
34 /* Use generic implementation. */
37 GET_FLOAT_WORD (i0
, x
);
38 j0
= ((i0
>> 23) & 0xff) - 0x7f;
43 /* return 0 * sign (x) if |x| < 1 */
46 else if ((i0
& 0x7fffffff) != 0)
51 i
= (0x007fffff) >> j0
;
53 return x
; /* x is integral */
55 i0
+= (0x00800000) >> j0
;
61 if (__glibc_unlikely (j0
== 0x80))
62 return x
+ x
; /* inf or NaN */
64 return x
; /* x is integral */
66 SET_FLOAT_WORD (x
, i0
);
68 #endif /* ! USE_FLOORF_BUILTIN */
71 libm_alias_float (__floor
, floor
)