1 /* @(#)s_rint.c 5.1 93/09/24 */
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 * ====================================================
15 * Return x rounded to integral value according to the prevailing
18 * Using floating addition.
20 * Inexact flag raised if x not equal to rint(x).
24 #include <math_private.h>
28 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
29 -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
37 GET_HIGH_WORD (i0
, x
);
39 j0
= ((i0
>> 20) & 0x7ff) - 0x3ff;
46 GET_HIGH_WORD (i0
, t
);
47 SET_HIGH_WORD (t
, (i0
& 0x7fffffff) | (sx
<< 31));
54 return x
+ x
; /* inf or NaN */
56 return x
; /* x is integral */
62 weak_alias (__rint
, rint
)
63 # ifdef NO_LONG_DOUBLE
64 strong_alias (__rint
, __rintl
)
65 weak_alias (__rint
, rintl
)