From 86f2bdfd5767ddb79d2404b1a13116d01690e1e6 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Sat, 20 Apr 2019 17:10:32 +0200 Subject: Fix blatant error in C++ code --- aberth/aberth.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'aberth') diff --git a/aberth/aberth.cpp b/aberth/aberth.cpp index c5b037d..42e3106 100644 --- a/aberth/aberth.cpp +++ b/aberth/aberth.cpp @@ -158,7 +158,7 @@ struct AberthState { Com derivval = eval(deriv, poly.size() - 1, approx[i]); Com quo = pval / derivval; Com sum = 0; - for (int j = 0; j < i; j++) sum += pairs[N * j + i]; + for (int j = 0; j < i; j++) sum -= pairs[N * j + i]; for (int j = i + 1; j < N; j++) sum += pairs[N * i + j]; offsets[i] = quo / (1.0 - quo * sum); -- cgit v1.2.3-70-g09d2