diff --git a/src/lol/math/polynomial.h b/src/lol/math/polynomial.h index d5a306b5..73ffc690 100644 --- a/src/lol/math/polynomial.h +++ b/src/lol/math/polynomial.h @@ -231,7 +231,7 @@ struct polynomial // if root of the derivative is also root of the current polynomial, we have a double root. for (auto root : polynomial{c, T(2)*b, T(3)*a}.roots()) if (eval(root) == T(0)) - return array { solutions[0] - k, + return array { (solutions[0] + solutions[2]) / T(2) - k, solutions[1] - k }; // we have 3 or 1 root depending on delta sign diff --git a/src/t/math/polynomial.cpp b/src/t/math/polynomial.cpp index 86892cf6..3ec3d661 100644 --- a/src/t/math/polynomial.cpp +++ b/src/t/math/polynomial.cpp @@ -288,7 +288,7 @@ lolunit_declare_fixture(polynomial_test) // Should have 2 solutions only, but precision leads to 3 solutions lolunit_assert_equal(roots1.count(), 2); - lolunit_assert_doubles_equal(roots1[0], -1, 1e-3); + lolunit_assert_doubles_equal(roots1[0], -1, 1e-6); lolunit_assert_doubles_equal(roots1[1], -2, 1e-6); }