Skip to content

Commit f1cf748

Browse files
Merge pull request #5 from hamarb123/master
Fix `sign_changes_at`
2 parents 196e899 + 5a7f593 commit f1cf748

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/algebraic_numbers.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,11 @@ fn sign_changes_at(
200200
ValueOrInfinity::Zero => Sign::new(&polynomial.coefficient(0)),
201201
ValueOrInfinity::NegativeInfinity => {
202202
let degree = polynomial.degree().unwrap_or(0);
203-
if degree == 0 || degree.is_odd() {
204-
Sign::new(&polynomial.highest_power_coefficient())
203+
let s = Sign::new(&polynomial.highest_power_coefficient());
204+
if degree.is_odd() {
205+
s.map(|| -s)
205206
} else {
206-
Some(Sign::Positive)
207+
s
207208
}
208209
}
209210
};

0 commit comments

Comments
 (0)