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