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