Debian Codegraph @

modules/fdlibm/patches/14_do_not_use_hexadecimal_floating_point_number.patch

raw
1 diff --git a/e_exp.cpp b/e_exp.cpp
2 --- a/e_exp.cpp
3 +++ b/e_exp.cpp
4 @@ -146,14 +146,17 @@ __ieee754_exp(double x) /* default IEEE double exp */
5 if(k >= -1021)
6 INSERT_WORDS(twopk,((u_int32_t)(0x3ff+k))<<20, 0);
7 else
8 INSERT_WORDS(twopk,((u_int32_t)(0x3ff+(k+1000)))<<20, 0);
9 c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))));
10 if(k==0) return one-((x*c)/(c-2.0)-x);
11 else y = one-((lo-(x*c)/(2.0-c))-hi);
12 if(k >= -1021) {
13 - if (k==1024) return y*2.0*0x1p1023;
14 + if (k==1024) {
15 + double const_0x1p1023 = pow(2, 1023);
16 + return y*2.0*const_0x1p1023;
17 + }
18 return y*twopk;
19 } else {
20 return y*twopk*twom1000;
21 }
22 }
23 diff --git a/s_expm1.cpp b/s_expm1.cpp
24 --- a/s_expm1.cpp
25 +++ b/s_expm1.cpp
26 @@ -192,17 +192,20 @@ expm1(double x)
27 e -= hxs;
28 if(k== -1) return 0.5*(x-e)-0.5;
29 if(k==1) {
30 if(x < -0.25) return -2.0*(e-(x+0.5));
31 else return one+2.0*(x-e);
32 }
33 if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */
34 y = one-(e-x);
35 - if (k == 1024) y = y*2.0*0x1p1023;
36 + if (k == 1024) {
37 + double const_0x1p1023 = pow(2, 1023);
38 + y = y*2.0*const_0x1p1023;
39 + }
40 else y = y*twopk;
41 return y-one;
42 }
43 t = one;
44 if(k<20) {
45 SET_HIGH_WORD(t,0x3ff00000 - (0x200000>>k)); /* t=1-2^-k */
46 y = t-(e-x);
47 y = y*twopk;
48 --- a/s_exp2.cpp 2022-12-11 21:26:36.045643147 -0500
49 +++ b/s_exp2.cpp_new 2022-12-11 21:28:42.058769925 -0500
50 @@ -381,14 +381,16 @@
51 INSERT_WORDS(twopk, 0x3ff00000 + k, 0);
52 else
53 INSERT_WORDS(twopkp1000, 0x3ff00000 + k + (1000 << 20), 0);
54 r = t + t * z * (P1 + z * (P2 + z * (P3 + z * (P4 + z * P5))));
55
56 /* Scale by 2**(k>>20). */
57 if(k >= -(1021 << 20)) {
58 - if (k == 1024 << 20)
59 - return (r * 2.0 * 0x1p1023);
60 + if (k == 1024 << 20) {
61 + double const_0x1p1023 = pow(2, 1023);
62 + return (r * 2.0 * const_0x1p1023);
63 + }
64 return (r * twopk);
65 } else {
66 return (r * twopkp1000 * twom1000);
67 }
68 }