Skip to content

Commit b5e297b

Browse files
lucascolleysteppi
authored andcommitted
STY: run clang-format
1 parent 6c713a6 commit b5e297b

File tree

211 files changed

+16556
-14058
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+16556
-14058
lines changed

include/xsf/airy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ inline void airyb(double x, double *ai, double *bi, double *ad, double *bd) {
212212
*ad = c1 * df - c2 * dg;
213213
*bd = sr3 * (c1 * df + c2 * dg);
214214
} else {
215-
km = (int) (24.5 - xa);
215+
km = (int)(24.5 - xa);
216216
if (xa < 6.0)
217217
km = 14;
218218
if (xa > 15.0)

include/xsf/amos/amos.h

Lines changed: 6155 additions & 5806 deletions
Large diffs are not rendered by default.

include/xsf/binom.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ XSF_HOST_DEVICE inline double binom(double n, double k) {
8282
return 1 / (n + 1) / cephes::beta(1 + n - k, 1 + k);
8383
}
8484

85-
XSF_HOST_DEVICE inline float binom(float n, float k) {
86-
return binom(static_cast<double>(n), static_cast<double>(k));
87-
}
85+
XSF_HOST_DEVICE inline float binom(float n, float k) { return binom(static_cast<double>(n), static_cast<double>(k)); }
8886

8987
} // namespace xsf

include/xsf/cdflib.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ XSF_HOST_DEVICE inline double gdtrib(double a, double p, double x) {
4343
}
4444
double q = 1.0 - p;
4545
auto func = [a, p, q, x](double b) {
46-
if (p <= q) {
47-
return cephes::igam(b, a * x) - p;
48-
}
49-
return q - cephes::igamc(b, a * x);
46+
if (p <= q) {
47+
return cephes::igam(b, a * x) - p;
48+
}
49+
return q - cephes::igamc(b, a * x);
5050
};
5151
double lower_bound = std::numeric_limits<double>::min();
5252
double upper_bound = std::numeric_limits<double>::max();
@@ -71,9 +71,8 @@ XSF_HOST_DEVICE inline double gdtrib(double a, double p, double x) {
7171
* number of iterations needed in this bracket search to check all normalized
7272
* floating point values.
7373
*/
74-
auto [xl, xr, f_xl, f_xr, bracket_status] = detail::bracket_root_for_cdf_inversion(
75-
func, 1.0, lower_bound, upper_bound, -0.875, 7.0, 0.125, 8, false, 342
76-
);
74+
auto [xl, xr, f_xl, f_xr, bracket_status] =
75+
detail::bracket_root_for_cdf_inversion(func, 1.0, lower_bound, upper_bound, -0.875, 7.0, 0.125, 8, false, 342);
7776
if (bracket_status == 1) {
7877
set_error("gdtrib", SF_ERROR_UNDERFLOW, NULL);
7978
return 0.0;
@@ -86,9 +85,8 @@ XSF_HOST_DEVICE inline double gdtrib(double a, double p, double x) {
8685
set_error("gdtrib", SF_ERROR_OTHER, "Computational Error");
8786
return std::numeric_limits<double>::quiet_NaN();
8887
}
89-
auto [result, root_status] = detail::find_root_chandrupatla(
90-
func, xl, xr, f_xl, f_xr, std::numeric_limits<double>::epsilon(), 1e-100, 100
91-
);
88+
auto [result, root_status] =
89+
detail::find_root_chandrupatla(func, xl, xr, f_xl, f_xr, std::numeric_limits<double>::epsilon(), 1e-100, 100);
9290
if (root_status) {
9391
/* The root finding return should only fail if there's a bug in our code. */
9492
set_error("gdtrib", SF_ERROR_OTHER, "Computational Error, (%.17g, %.17g, %.17g)", a, p, x);

include/xsf/cephes/beta.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ namespace cephes {
161161
b = Gamma(b);
162162
if (std::isinf(y)) {
163163
goto overflow;
164-
}
164+
}
165165

166-
if (std::abs(std::abs(a*y) - 1.0) > std::abs(std::abs(b*y) - 1.0)) {
166+
if (std::abs(std::abs(a * y) - 1.0) > std::abs(std::abs(b * y) - 1.0)) {
167167
y = b * y;
168168
y *= a;
169169
} else {
@@ -239,7 +239,7 @@ namespace cephes {
239239
return (sign * std::numeric_limits<double>::infinity());
240240
}
241241

242-
if (std::abs(std::abs(a*y) - 1.0) > std::abs(std::abs(b*y) - 1.0)) {
242+
if (std::abs(std::abs(a * y) - 1.0) > std::abs(std::abs(b * y) - 1.0)) {
243243
y = b * y;
244244
y *= a;
245245
} else {

include/xsf/cephes/cbrt.h

Lines changed: 66 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -57,75 +57,74 @@ namespace cephes {
5757
inline constexpr double CBRT2I = 0.79370052598409973737585;
5858
inline constexpr double CBRT4I = 0.62996052494743658238361;
5959

60-
}
60+
} // namespace detail
6161

6262
XSF_HOST_DEVICE inline double cbrt(double x) {
63-
int e, rem, sign;
64-
double z;
65-
66-
if (!std::isfinite(x)) {
67-
return x;
68-
}
69-
if (x == 0) {
70-
return (x);
71-
}
72-
if (x > 0) {
73-
sign = 1;
74-
} else {
75-
sign = -1;
76-
x = -x;
77-
}
78-
79-
z = x;
80-
/* extract power of 2, leaving
81-
* mantissa between 0.5 and 1
82-
*/
83-
x = std::frexp(x, &e);
84-
85-
/* Approximate cube root of number between .5 and 1,
86-
* peak relative error = 9.2e-6
87-
*/
88-
x = (((-1.3466110473359520655053e-1 * x + 5.4664601366395524503440e-1) * x - 9.5438224771509446525043e-1) *
89-
x +
90-
1.1399983354717293273738e0) *
91-
x +
92-
4.0238979564544752126924e-1;
93-
94-
/* exponent divided by 3 */
95-
if (e >= 0) {
96-
rem = e;
97-
e /= 3;
98-
rem -= 3 * e;
99-
if (rem == 1) {
100-
x *= detail::CBRT2;
101-
} else if (rem == 2) {
102-
x *= detail::CBRT4;
103-
}
104-
}
105-
/* argument less than 1 */
106-
else {
107-
e = -e;
108-
rem = e;
109-
e /= 3;
110-
rem -= 3 * e;
111-
if (rem == 1) {
112-
x *= detail::CBRT2I;
113-
} else if (rem == 2) {
114-
x *= detail::CBRT4I;
115-
}
116-
e = -e;
117-
}
118-
119-
/* multiply by power of 2 */
120-
x = std::ldexp(x, e);
121-
122-
/* Newton iteration */
123-
x -= (x - (z / (x * x))) * 0.33333333333333333333;
124-
x -= (x - (z / (x * x))) * 0.33333333333333333333;
125-
126-
if (sign < 0)
127-
x = -x;
128-
return (x);
63+
int e, rem, sign;
64+
double z;
65+
66+
if (!std::isfinite(x)) {
67+
return x;
68+
}
69+
if (x == 0) {
70+
return (x);
71+
}
72+
if (x > 0) {
73+
sign = 1;
74+
} else {
75+
sign = -1;
76+
x = -x;
77+
}
78+
79+
z = x;
80+
/* extract power of 2, leaving
81+
* mantissa between 0.5 and 1
82+
*/
83+
x = std::frexp(x, &e);
84+
85+
/* Approximate cube root of number between .5 and 1,
86+
* peak relative error = 9.2e-6
87+
*/
88+
x = (((-1.3466110473359520655053e-1 * x + 5.4664601366395524503440e-1) * x - 9.5438224771509446525043e-1) * x +
89+
1.1399983354717293273738e0) *
90+
x +
91+
4.0238979564544752126924e-1;
92+
93+
/* exponent divided by 3 */
94+
if (e >= 0) {
95+
rem = e;
96+
e /= 3;
97+
rem -= 3 * e;
98+
if (rem == 1) {
99+
x *= detail::CBRT2;
100+
} else if (rem == 2) {
101+
x *= detail::CBRT4;
102+
}
103+
}
104+
/* argument less than 1 */
105+
else {
106+
e = -e;
107+
rem = e;
108+
e /= 3;
109+
rem -= 3 * e;
110+
if (rem == 1) {
111+
x *= detail::CBRT2I;
112+
} else if (rem == 2) {
113+
x *= detail::CBRT4I;
114+
}
115+
e = -e;
116+
}
117+
118+
/* multiply by power of 2 */
119+
x = std::ldexp(x, e);
120+
121+
/* Newton iteration */
122+
x -= (x - (z / (x * x))) * 0.33333333333333333333;
123+
x -= (x - (z / (x * x))) * 0.33333333333333333333;
124+
125+
if (sign < 0)
126+
x = -x;
127+
return (x);
129128
}
130129

131130
} // namespace cephes

include/xsf/cephes/chdtr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ namespace cephes {
165165
if (x < 0.0) {
166166
set_error("chdtr", SF_ERROR_DOMAIN, NULL);
167167
return (std::numeric_limits<double>::quiet_NaN());
168-
}
168+
}
169169
return (igamc(df / 2.0, x / 2.0));
170170
}
171171

include/xsf/cephes/dd_real.h

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ namespace cephes {
121121

122122
// Arithmetic operations
123123

124-
XSF_HOST_DEVICE inline double_double operator-(const double_double &x) {
125-
return double_double(-x.hi, -x.lo);
126-
}
124+
XSF_HOST_DEVICE inline double_double operator-(const double_double &x) { return double_double(-x.hi, -x.lo); }
127125

128126
XSF_HOST_DEVICE inline double_double operator+(const double_double &lhs, const double_double &rhs) {
129127
/* This one satisfies IEEE style error bound,
@@ -382,15 +380,15 @@ namespace cephes {
382380
return lhs - rhs * n;
383381
}
384382

385-
XSF_HOST_DEVICE inline std::pair<double_double, double_double> divrem(const double_double &lhs,
386-
const double_double &rhs) {
383+
XSF_HOST_DEVICE inline std::pair<double_double, double_double>
384+
divrem(const double_double &lhs, const double_double &rhs) {
387385
double_double n = round(lhs / rhs);
388386
double_double remainder = lhs - n * rhs;
389387
return {n, remainder};
390388
}
391389

392-
XSF_HOST_DEVICE inline double_double fma(
393-
const double_double &a, const double_double &b, const double_double &c) {
390+
XSF_HOST_DEVICE inline double_double
391+
fma(const double_double &a, const double_double &b, const double_double &c) {
394392
// TODO: make an accurate fma
395393
return a * b + c;
396394
}
@@ -442,21 +440,23 @@ namespace cephes {
442440
return double_double(std::numeric_limits<double>::infinity(), std::numeric_limits<double>::infinity());
443441
}
444442

445-
const double_double inv_fact[] = {double_double(1.66666666666666657e-01, 9.25185853854297066e-18),
446-
double_double(4.16666666666666644e-02, 2.31296463463574266e-18),
447-
double_double(8.33333333333333322e-03, 1.15648231731787138e-19),
448-
double_double(1.38888888888888894e-03, -5.30054395437357706e-20),
449-
double_double(1.98412698412698413e-04, 1.72095582934207053e-22),
450-
double_double(2.48015873015873016e-05, 2.15119478667758816e-23),
451-
double_double(2.75573192239858925e-06, -1.85839327404647208e-22),
452-
double_double(2.75573192239858883e-07, 2.37677146222502973e-23),
453-
double_double(2.50521083854417202e-08, -1.44881407093591197e-24),
454-
double_double(2.08767569878681002e-09, -1.20734505911325997e-25),
455-
double_double(1.60590438368216133e-10, 1.25852945887520981e-26),
456-
double_double(1.14707455977297245e-11, 2.06555127528307454e-28),
457-
double_double(7.64716373181981641e-13, 7.03872877733453001e-30),
458-
double_double(4.77947733238738525e-14, 4.39920548583408126e-31),
459-
double_double(2.81145725434552060e-15, 1.65088427308614326e-31)};
443+
const double_double inv_fact[] = {
444+
double_double(1.66666666666666657e-01, 9.25185853854297066e-18),
445+
double_double(4.16666666666666644e-02, 2.31296463463574266e-18),
446+
double_double(8.33333333333333322e-03, 1.15648231731787138e-19),
447+
double_double(1.38888888888888894e-03, -5.30054395437357706e-20),
448+
double_double(1.98412698412698413e-04, 1.72095582934207053e-22),
449+
double_double(2.48015873015873016e-05, 2.15119478667758816e-23),
450+
double_double(2.75573192239858925e-06, -1.85839327404647208e-22),
451+
double_double(2.75573192239858883e-07, 2.37677146222502973e-23),
452+
double_double(2.50521083854417202e-08, -1.44881407093591197e-24),
453+
double_double(2.08767569878681002e-09, -1.20734505911325997e-25),
454+
double_double(1.60590438368216133e-10, 1.25852945887520981e-26),
455+
double_double(1.14707455977297245e-11, 2.06555127528307454e-28),
456+
double_double(7.64716373181981641e-13, 7.03872877733453001e-30),
457+
double_double(4.77947733238738525e-14, 4.39920548583408126e-31),
458+
double_double(2.81145725434552060e-15, 1.65088427308614326e-31)
459+
};
460460

461461
// Math constants
462462
const double_double E = double_double(2.718281828459045091e+00, 1.445646891729250158e-16);

include/xsf/cephes/ellik.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ namespace cephes {
177177
return (phi);
178178
a = 1.0 - m;
179179
if (a == 0.0) {
180-
if (std::abs(phi) >= (double) M_PI_2) {
180+
if (std::abs(phi) >= (double)M_PI_2) {
181181
set_error("ellik", SF_ERROR_SINGULAR, NULL);
182182
return (std::numeric_limits<double>::infinity());
183183
}

include/xsf/cephes/expn.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
#include "../config.h"
6666
#include "../error.h"
6767
#include "const.h"
68-
#include "rgamma.h"
6968
#include "polevl.h"
69+
#include "rgamma.h"
7070

7171
namespace xsf {
7272
namespace cephes {
@@ -78,10 +78,12 @@ namespace cephes {
7878
constexpr double expn_A1[] = {1.00000000000000000};
7979
constexpr double expn_A2[] = {-2.00000000000000000, 1.00000000000000000};
8080
constexpr double expn_A3[] = {6.00000000000000000, -8.00000000000000000, 1.00000000000000000};
81-
constexpr double expn_A4[] = {-24.0000000000000000, 58.0000000000000000, -22.0000000000000000,
82-
1.00000000000000000};
83-
constexpr double expn_A5[] = {120.000000000000000, -444.000000000000000, 328.000000000000000,
84-
-52.0000000000000000, 1.00000000000000000};
81+
constexpr double expn_A4[] = {
82+
-24.0000000000000000, 58.0000000000000000, -22.0000000000000000, 1.00000000000000000
83+
};
84+
constexpr double expn_A5[] = {
85+
120.000000000000000, -444.000000000000000, 328.000000000000000, -52.0000000000000000, 1.00000000000000000
86+
};
8587
constexpr double expn_A6[] = {-720.000000000000000, 3708.00000000000000, -4400.00000000000000,
8688
1452.00000000000000, -114.000000000000000, 1.00000000000000000};
8789
constexpr double expn_A7[] = {5040.00000000000000, -33984.0000000000000, 58140.0000000000000,

0 commit comments

Comments
 (0)