Skip to content

Commit

Permalink
optimize utils.droots
Browse files Browse the repository at this point in the history
  • Loading branch information
F-star authored Aug 4, 2024
1 parent 4e76729 commit b5f81bb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,11 @@ const utils = {
c = p[2],
d = a - 2 * b + c;
if (d !== 0) {
const m1 = -sqrt(b * b - a * c),
const m1Pow2 = b * b - a * c
if (m1Pow2 < 0) {
return []
}
const m1 = -sqrt(m1Pow2),
m2 = -a + b,
v1 = -(m1 + m2) / d,
v2 = -(-m1 + m2) / d;
Expand Down

0 comments on commit b5f81bb

Please sign in to comment.