Magellan Linux

Contents of /trunk/glibc/patches/glibc-2.15-nearbyintf-rounding.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1806 - (show annotations) (download)
Tue Jun 12 12:33:27 2012 UTC (11 years, 10 months ago) by niro
File size: 2574 byte(s)
-added patches for 2.15-r1
1 diff --git a/math/libm-test.inc b/math/libm-test.inc
2 index c8186c8..1016753 100644
3 --- a/math/libm-test.inc
4 +++ b/math/libm-test.inc
5 @@ -4632,6 +4632,29 @@ nearbyint_test (void)
6 TEST_f_f (nearbyint, 524286.75, 524287.0);
7 TEST_f_f (nearbyint, 524288.75, 524289.0);
8
9 + TEST_f_f (nearbyint, 1048576.75, 1048577.0);
10 + TEST_f_f (nearbyint, 2097152.75, 2097153.0);
11 + TEST_f_f (nearbyint, 2492472.75, 2492473.0);
12 + TEST_f_f (nearbyint, 2886220.75, 2886221.0);
13 + TEST_f_f (nearbyint, 3058792.75, 3058793.0);
14 + TEST_f_f (nearbyint, -1048576.75, -1048577.0);
15 + TEST_f_f (nearbyint, -2097152.75, -2097153.0);
16 + TEST_f_f (nearbyint, -2492472.75, -2492473.0);
17 + TEST_f_f (nearbyint, -2886220.75, -2886221.0);
18 + TEST_f_f (nearbyint, -3058792.75, -3058793.0);
19 +#ifndef TEST_FLOAT
20 + TEST_f_f (nearbyint, 70368744177664.75, 70368744177665.0);
21 + TEST_f_f (nearbyint, 140737488355328.75, 140737488355329.0);
22 + TEST_f_f (nearbyint, 281474976710656.75, 281474976710657.0);
23 + TEST_f_f (nearbyint, 562949953421312.75, 562949953421313.0);
24 + TEST_f_f (nearbyint, 1125899906842624.75, 1125899906842625.0);
25 + TEST_f_f (nearbyint, -70368744177664.75, -70368744177665.0);
26 + TEST_f_f (nearbyint, -140737488355328.75, -140737488355329.0);
27 + TEST_f_f (nearbyint, -281474976710656.75, -281474976710657.0);
28 + TEST_f_f (nearbyint, -562949953421312.75, -562949953421313.0);
29 + TEST_f_f (nearbyint, -1125899906842624.75, -1125899906842625.0);
30 +#endif
31 +
32 END (nearbyint);
33 }
34
35 diff --git a/sysdeps/ieee754/flt-32/s_nearbyintf.c b/sysdeps/ieee754/flt-32/s_nearbyintf.c
36 index 04ef9ab..a6d602b 100644
37 --- a/sysdeps/ieee754/flt-32/s_nearbyintf.c
38 +++ b/sysdeps/ieee754/flt-32/s_nearbyintf.c
39 @@ -30,18 +30,12 @@ __nearbyintf(float x)
40 {
41 fenv_t env;
42 int32_t i0,j0,sx;
43 - u_int32_t i,i1;
44 float w,t;
45 GET_FLOAT_WORD(i0,x);
46 sx = (i0>>31)&1;
47 j0 = ((i0>>23)&0xff)-0x7f;
48 if(j0<23) {
49 if(j0<0) {
50 - if((i0&0x7fffffff)==0) return x;
51 - i1 = (i0&0x07fffff);
52 - i0 &= 0xfff00000;
53 - i0 |= ((i1|-i1)>>9)&0x400000;
54 - SET_FLOAT_WORD(x,i0);
55 libc_feholdexceptf (&env);
56 w = TWO23[sx]+x;
57 t = w-TWO23[sx];
58 @@ -49,17 +43,11 @@ __nearbyintf(float x)
59 GET_FLOAT_WORD(i0,t);
60 SET_FLOAT_WORD(t,(i0&0x7fffffff)|(sx<<31));
61 return t;
62 - } else {
63 - i = (0x007fffff)>>j0;
64 - if((i0&i)==0) return x; /* x is integral */
65 - i>>=1;
66 - if((i0&i)!=0) i0 = (i0&(~i))|((0x100000)>>j0);
67 }
68 } else {
69 if(__builtin_expect(j0==0x80, 0)) return x+x; /* inf or NaN */
70 else return x; /* x is integral */
71 }
72 - SET_FLOAT_WORD(x,i0);
73 libc_feholdexceptf (&env);
74 w = TWO23[sx]+x;
75 t = w-TWO23[sx];