Fix error in quadratic solver
This commit is contained in:
parent
1bb5f6977f
commit
e8219b7139
1 changed files with 1 additions and 1 deletions
|
|
@ -40,7 +40,7 @@ namespace psemek::geom
|
||||||
auto const D = b * b - 4 * a * c;
|
auto const D = b * b - 4 * a * c;
|
||||||
if (D < 0) return std::nullopt;
|
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 x1 = t / a;
|
||||||
auto x2 = c / t;
|
auto x2 = c / t;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue