Skip to content

Commit

Permalink
Fixed zero division edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
gammelalf committed Sep 7, 2022
1 parent 75f9098 commit 550bff6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/npolynomial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ impl<T: Scalar, S: Storage<T, U1, U2>> Polynomial<T, U1, U2, S> {
let t = &self.0[(0, 0)];
let m = &self.0[(0, 1)];

vec![(-t.clone()) / m.clone()]
if m.is_zero() {
vec![]
} else {
vec![(-t.clone()) / m.clone()]
}
}
}
impl<T: Scalar, S: Storage<T, U1, U3>> Polynomial<T, U1, U3, S> {
Expand Down

0 comments on commit 550bff6

Please sign in to comment.