1mod cubic;
2mod poly;
3mod quadratic;
4
5#[cfg(any(test, feature = "arbitrary"))]
6pub mod arbitrary;
7
8pub use cubic::Cubic;
9pub use poly::Poly;
10pub use quadratic::Quadratic;
11
12trait TerminationCondition {
13 fn stop(&self, last_step: f64, value: f64) -> bool;
14}
15
16struct InputError(f64);
17
18impl TerminationCondition for InputError {
19 fn stop(&self, last_step: f64, _value: f64) -> bool {
20 last_step.abs() <= self.0
21 }
22}
23
24struct ValueError(f64);
25
26impl TerminationCondition for ValueError {
27 fn stop(&self, _last_step: f64, value: f64) -> bool {
28 value.abs() <= self.0
29 }
30}
31
32fn different_signs(x: f64, y: f64) -> bool {
33 (x < 0.0) != (y < 0.0)
34}