Fix error in quadratic solver

This commit is contained in:
Nikita Lisitsa 2020-11-04 10:30:37 +03:00
parent 1bb5f6977f
commit e8219b7139

View file

@ -40,7 +40,7 @@ namespace psemek::geom
auto const D = b * b - 4 * a * c;
if (D < 0) return std::nullopt;
auto t = - (b + (b > 0 ? 1 : -1) * std::sqrt(D));
auto t = - (b + (b > 0 ? 1 : -1) * std::sqrt(D)) / 2;
auto x1 = t / a;
auto x2 = c / t;