Skip to content

Commit e36d335

Browse files
committed
Use epsilon() instead of hard coded limits.
1 parent f3e1e79 commit e36d335

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/pfasst-quadrature.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <algorithm>
66
#include <cmath>
77
#include <complex>
8+
#include <limits>
89
#include <vector>
910

1011
using namespace std;
@@ -105,15 +106,15 @@ namespace pfasst {
105106
coeffT acc = 0.0;
106107
for (int j=0; j<n; j++)
107108
acc += abs(z0[j] - z1[j]);
108-
if (acc < 1e-24)
109+
if (acc < 2*numeric_limits<coeffT>::epsilon())
109110
break;
110111

111112
z1 = z0;
112113
}
113114

114115
vector<coeffT> roots(n);
115116
for (int j=0; j<n; j++)
116-
roots[j] = abs(z0[j]) < 1e-12 ? 0.0 : real(z0[j]);
117+
roots[j] = abs(z0[j]) < 4*numeric_limits<coeffT>::epsilon() ? 0.0 : real(z0[j]);
117118

118119
sort(roots.begin(), roots.end());
119120
return roots;

0 commit comments

Comments
 (0)