Deleted Added
full compact
s_rint.c (153043) s_rint.c (175309)
1/* @(#)s_rint.c 5.1 93/09/24 */
2/*
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5 *
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
9 * is preserved.
10 * ====================================================
11 */
12
13#ifndef lint
1/* @(#)s_rint.c 5.1 93/09/24 */
2/*
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5 *
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
9 * is preserved.
10 * ====================================================
11 */
12
13#ifndef lint
14static char rcsid[] = "$FreeBSD: head/lib/msun/src/s_rint.c 153043 2005-12-03 07:38:35Z bde $";
14static char rcsid[] = "$FreeBSD: head/lib/msun/src/s_rint.c 175309 2008-01-14 02:12:07Z das $";
15#endif
16
17/*
18 * rint(x)
19 * Return x rounded to integral value according to the prevailing
20 * rounding mode.
21 * Method:
22 * Using floating addition.
23 * Exception:
24 * Inexact flag raised if x not equal to rint(x).
25 */
26
15#endif
16
17/*
18 * rint(x)
19 * Return x rounded to integral value according to the prevailing
20 * rounding mode.
21 * Method:
22 * Using floating addition.
23 * Exception:
24 * Inexact flag raised if x not equal to rint(x).
25 */
26
27#include <float.h>
28
27#include "math.h"
28#include "math_private.h"
29
30static const double
31TWO52[2]={
32 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
33 -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
34};

--- 45 unchanged lines hidden (view full) ---

80 if((i1&i)==0) return x; /* x is integral */
81 i>>=1;
82 if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-20));
83 }
84 INSERT_WORDS(x,i0,i1);
85 *(volatile double *)&w = TWO52[sx]+x; /* clip any extra precision */
86 return w-TWO52[sx];
87}
29#include "math.h"
30#include "math_private.h"
31
32static const double
33TWO52[2]={
34 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
35 -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
36};

--- 45 unchanged lines hidden (view full) ---

82 if((i1&i)==0) return x; /* x is integral */
83 i>>=1;
84 if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-20));
85 }
86 INSERT_WORDS(x,i0,i1);
87 *(volatile double *)&w = TWO52[sx]+x; /* clip any extra precision */
88 return w-TWO52[sx];
89}
90
91#if (LDBL_MANT_DIG == 53)
92__weak_reference(rint, rintl);
93#endif