summaryrefslogtreecommitdiffstats
path: root/modules/fdlibm/patches/21_rem_pio_fixups.patch
blob: 8961db62c35b1ed4100409306ca92e6068ba620c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
diff --git a/e_rem_pio2.cpp b/e_rem_pio2.cpp
--- a/e_rem_pio2.cpp
+++ b/e_rem_pio2.cpp
@@ -43,17 +43,17 @@ invpio2 =  6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */
 pio2_1  =  1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */
 pio2_1t =  6.07710050650619224932e-11, /* 0x3DD0B461, 0x1A626331 */
 pio2_2  =  6.07710050630396597660e-11, /* 0x3DD0B461, 0x1A600000 */
 pio2_2t =  2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */
 pio2_3  =  2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */
 pio2_3t =  8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
 
 #ifdef INLINE_REM_PIO2
-static __inline __always_inline
+static inline
 #endif
 int
 __ieee754_rem_pio2(double x, double *y)
 {
 	double z,w,t,r,fn;
 	double tx[3],ty[2];
 	int32_t e0,i,j,nx,n,ix,hx;
 	u_int32_t low;
diff --git a/k_rem_pio2.cpp b/k_rem_pio2.cpp
--- a/k_rem_pio2.cpp
+++ b/k_rem_pio2.cpp
@@ -305,17 +305,18 @@ __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec)
 	q0 =  e0-24*(jv+1);
 
     /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */
 	j = jv-jx; m = jx+jk;
 	for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (double) ipio2[j];
 
     /* compute q[0],q[1],...q[jk] */
 	for (i=0;i<=jk;i++) {
-	    for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
+	    for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j];
+	    q[i] = fw;
 	}
 
 	jz = jk;
 recompute:
     /* distill q[] into iq[] reversingly */
 	for(i=0,j=jz,z=q[jz];j>0;i++,j--) {
 	    fw    =  (double)((int32_t)(twon24* z));
 	    iq[i] =  (int32_t)(z-two24*fw);
diff --git a/s_cos.cpp b/s_cos.cpp
--- a/s_cos.cpp
+++ b/s_cos.cpp
@@ -43,17 +43,17 @@
  * Accuracy:
  *	TRIG(x) returns trig(x) nearly rounded
  */
 
 #include <float.h>
 
 #define INLINE_REM_PIO2
 #include "math_private.h"
-#include "e_rem_pio2.c"
+#include "e_rem_pio2.cpp"
 
 double
 cos(double x)
 {
 	double y[2],z=0.0;
 	int32_t n, ix;
 
     /* High word of x. */
diff --git a/s_sin.cpp b/s_sin.cpp
--- a/s_sin.cpp
+++ b/s_sin.cpp
@@ -43,17 +43,17 @@
  * Accuracy:
  *	TRIG(x) returns trig(x) nearly rounded
  */
 
 #include <float.h>
 
 #define INLINE_REM_PIO2
 #include "math_private.h"
-#include "e_rem_pio2.c"
+#include "e_rem_pio2.cpp"
 
 double
 sin(double x)
 {
 	double y[2],z=0.0;
 	int32_t n, ix;
 
     /* High word of x. */
diff --git a/s_tan.cpp b/s_tan.cpp
--- a/s_tan.cpp
+++ b/s_tan.cpp
@@ -42,17 +42,17 @@
  * Accuracy:
  *	TRIG(x) returns trig(x) nearly rounded
  */
 
 #include <float.h>
 
 #define INLINE_REM_PIO2
 #include "math_private.h"
-#include "e_rem_pio2.c"
+#include "e_rem_pio2.cpp"
 
 double
 tan(double x)
 {
 	double y[2],z=0.0;
 	int32_t n, ix;
 
     /* High word of x. */
--- a/s_cosf.cpp	2022-12-11 21:26:36.041643110 -0500
+++ b/s_cosf.cpp	2022-12-11 21:34:08.197486828 -0500
@@ -18,19 +18,19 @@
 //__FBSDID("$FreeBSD$");
 
 #include <float.h>
 
 #define	INLINE_KERNEL_COSDF
 #define	INLINE_KERNEL_SINDF
 #define INLINE_REM_PIO2F
 #include "math_private.h"
-#include "e_rem_pio2f.c"
-#include "k_cosf.c"
-#include "k_sinf.c"
+#include "e_rem_pio2f.cpp"
+#include "k_cosf.cpp"
+#include "k_sinf.cpp"
 
 /* Small multiples of pi/2 rounded to double precision. */
 static const double
 c1pio2 = 1*M_PI_2,			/* 0x3FF921FB, 0x54442D18 */
 c2pio2 = 2*M_PI_2,			/* 0x400921FB, 0x54442D18 */
 c3pio2 = 3*M_PI_2,			/* 0x4012D97C, 0x7F3321D2 */
 c4pio2 = 4*M_PI_2;			/* 0x401921FB, 0x54442D18 */
 
--- a/s_sinf.cpp	2022-12-11 21:26:36.045643147 -0500
+++ b/s_sinf.cpp	2022-12-11 21:33:52.741362926 -0500
@@ -18,19 +18,19 @@
 //__FBSDID("$FreeBSD$");
 
 #include <float.h>
 
 #define	INLINE_KERNEL_COSDF
 #define	INLINE_KERNEL_SINDF
 #define INLINE_REM_PIO2F
 #include "math_private.h"
-#include "e_rem_pio2f.c"
-#include "k_cosf.c"
-#include "k_sinf.c"
+#include "e_rem_pio2f.cpp"
+#include "k_cosf.cpp"
+#include "k_sinf.cpp"
 
 /* Small multiples of pi/2 rounded to double precision. */
 static const double
 s1pio2 = 1*M_PI_2,			/* 0x3FF921FB, 0x54442D18 */
 s2pio2 = 2*M_PI_2,			/* 0x400921FB, 0x54442D18 */
 s3pio2 = 3*M_PI_2,			/* 0x4012D97C, 0x7F3321D2 */
 s4pio2 = 4*M_PI_2;			/* 0x401921FB, 0x54442D18 */
 
--- a/s_tanf.cpp	2022-12-11 21:26:36.045643147 -0500
+++ b/s_tanf.cpp	2022-12-11 21:33:45.269302886 -0500
@@ -17,18 +17,18 @@
 //#include <sys/cdefs.h>
 //__FBSDID("$FreeBSD$");
 
 #include <float.h>
 
 #define	INLINE_KERNEL_TANDF
 #define INLINE_REM_PIO2F
 #include "math_private.h"
-#include "e_rem_pio2f.c"
-#include "k_tanf.c"
+#include "e_rem_pio2f.cpp"
+#include "k_tanf.cpp"
 
 /* Small multiples of pi/2 rounded to double precision. */
 static const double
 t1pio2 = 1*M_PI_2,			/* 0x3FF921FB, 0x54442D18 */
 t2pio2 = 2*M_PI_2,			/* 0x400921FB, 0x54442D18 */
 t3pio2 = 3*M_PI_2,			/* 0x4012D97C, 0x7F3321D2 */
 t4pio2 = 4*M_PI_2;			/* 0x401921FB, 0x54442D18 */
 
--- a/e_rem_pio2f.cpp	2022-12-13 14:50:12.582776365 -0500
+++ b/e_rem_pio2f.cpp	2022-12-13 14:51:05.003200166 -0500
@@ -35,17 +35,17 @@
  */
 
 static const double
 invpio2 =  6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */
 pio2_1  =  1.57079631090164184570e+00, /* 0x3FF921FB, 0x50000000 */
 pio2_1t =  1.58932547735281966916e-08; /* 0x3E5110b4, 0x611A6263 */
 
 #ifdef INLINE_REM_PIO2F
-static __inline __always_inline
+static inline
 #endif
 int
 __ieee754_rem_pio2f(float x, double *y)
 {
 	double w,r,fn;
 	double tx[1],ty[1];
 	float z;
 	int32_t e0,n,ix,hx;
--- a/e_powf.cpp
+++ b/e_powf.cpp
@@ -11,16 +11,18 @@
  * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
 
 //#include <sys/cdefs.h>
 //__FBSDID("$FreeBSD$");
 
+#include "s_scalbnf.cpp"
+
 #include "math_private.h"
 
 static const float
 bp[] = {1.0, 1.5,},
 dp_h[] = { 0.0, 5.84960938e-01,}, /* 0x3f15c000 */
 dp_l[] = { 0.0, 1.56322085e-06,}, /* 0x35d1cfdc */
 zero    =  0.0,
 half    =  0.5,