poly_cool/
lib.rs

1//! This is a crate for numerical polynomial root-finding.
2//!
3//! Currently, we implement a single solver: Yuksel's iterative algorithm
4//! for finding roots in a bounded interval. We aspire to have
5//! more, with thorough tests and benchmarks.
6
7#![cfg_attr(all(not(feature = "std"), not(test)), no_std)]
8
9mod cubic;
10#[cfg(feature = "libm")]
11mod libm_polyfill;
12mod poly;
13#[cfg(feature = "std")]
14mod poly_dyn;
15mod quadratic;
16mod yuksel;
17
18#[cfg(any(test, feature = "arbitrary"))]
19pub mod arbitrary;
20
21#[cfg(not(any(feature = "std", feature = "libm")))]
22compile_error!("kurbo requires either the `std` or `libm` feature");
23
24// Suppress the unused_crate_dependencies lint when both std and libm are specified.
25#[cfg(all(feature = "std", feature = "libm"))]
26use libm as _;
27
28pub use poly::{Cubic, Poly, Quadratic, Quartic, Quintic};
29#[cfg(feature = "std")]
30pub use poly_dyn::PolyDyn;
31
32fn different_signs(x: f64, y: f64) -> bool {
33    (x < 0.0) != (y < 0.0)
34}