Skip to content

Commit 3f700be

Browse files
committed
Neated-up
1 parent 376df8a commit 3f700be

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Modules/mathmodule.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2844,20 +2844,20 @@ based on:
28442844

28452845
typedef struct{ double hi; double lo; } DoubleLength;
28462846

2847-
static inline DoubleLength
2848-
twosum(double a, double b)
2847+
static DoubleLength
2848+
dl_sum(double a, double b)
28492849
{
2850-
// Rump Algorithm 3.1 Error-free transformation of the sum
2850+
// Algorithm 3.1 Error-free transformation of the sum
28512851
double x = a + b;
28522852
double z = x - a;
28532853
double y = (a - (x - z)) + (b - z);
28542854
return (DoubleLength) {x, y};
28552855
}
28562856

2857-
static inline DoubleLength
2857+
static DoubleLength
28582858
dl_mul(double x, double y)
28592859
{
2860-
// Rump Algorithm 3.5. Error-free transformation of a product
2860+
// Algorithm 3.5. Error-free transformation of a product
28612861
double z = x * y;
28622862
double zz = fma(x, y, -z);
28632863
return (DoubleLength) {z, zz};
@@ -2867,21 +2867,21 @@ typedef struct { double hi; double lo; double tiny; } TripleLength;
28672867

28682868
static const TripleLength tl_zero = {0.0, 0.0, 0.0};
28692869

2870-
static inline TripleLength
2870+
static TripleLength
28712871
tl_fma(TripleLength total, double x, double y)
28722872
{
2873-
// Rump Algorithm 5.10 with K=3 and using SumKVert
2873+
// Algorithm 5.10 with SumKVert for K=3
28742874
DoubleLength pr = dl_mul(x, y);
2875-
DoubleLength sm = twosum(total.hi, pr.hi);
2876-
DoubleLength r1 = twosum(total.lo, pr.lo);
2877-
DoubleLength r2 = twosum(r1.hi, sm.lo);
2875+
DoubleLength sm = dl_sum(total.hi, pr.hi);
2876+
DoubleLength r1 = dl_sum(total.lo, pr.lo);
2877+
DoubleLength r2 = dl_sum(r1.hi, sm.lo);
28782878
return (TripleLength) {sm.hi, r2.hi, total.tiny + r1.lo + r2.lo};
28792879
}
28802880

2881-
static inline double
2881+
static double
28822882
tl_to_d(TripleLength total)
28832883
{
2884-
DoubleLength last = twosum(total.lo, total.hi);
2884+
DoubleLength last = dl_sum(total.lo, total.hi);
28852885
return total.tiny + last.lo + last.hi;
28862886
}
28872887

0 commit comments

Comments
 (0)