From b9f38eb4a99efdf7140d34b1a47ac077f99ec3a3 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 22 Jan 2015 14:57:16 +1100 Subject: [PATCH] polynomial: use correct degree in template param --- polynomial.cpp | 4 ++-- polynomial.hpp | 4 ++-- test/polynomial.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/polynomial.cpp b/polynomial.cpp index 600e97e5..5e83d6a0 100644 --- a/polynomial.cpp +++ b/polynomial.cpp @@ -52,7 +52,7 @@ namespace util { namespace polynomial { const float c = coeff[2]; if (almost_zero (a)) { - auto s = solve<2> ({b, c}); + auto s = solve<1> ({b, c}); return { s[0], std::numeric_limits::quiet_NaN () }; } @@ -76,7 +76,7 @@ namespace util { namespace polynomial { const float _d = coeffs[3]; if (almost_zero (_a)) { - auto s = solve<3> ({_b, _c, _d}); + auto s = solve<2> ({_b, _c, _d}); return {s[0], s[1], std::numeric_limits::quiet_NaN () }; } diff --git a/polynomial.hpp b/polynomial.hpp index 3144e2f9..29f61cdc 100644 --- a/polynomial.hpp +++ b/polynomial.hpp @@ -26,8 +26,8 @@ namespace util { namespace polynomial { template - std::array - solve (std::array); + std::array + solve (std::array); template float diff --git a/test/polynomial.cpp b/test/polynomial.cpp index f9f191d5..86902b68 100644 --- a/test/polynomial.cpp +++ b/test/polynomial.cpp @@ -28,7 +28,7 @@ main (int, char**) }; for (auto &i: CUBICS) { - auto s = util::polynomial::solve (i.coeffs); + std::array s = util::polynomial::solve<3> (i.coeffs); std::sort (s.begin (), s.end ());