1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! Fixed-point mathematical functions: accurate, deterministic, and guaranteed not to panic.
//!
//! `no_std` compatible with no floating-point operations.
//!
//! # Quick Start
//!
//! ```rust
//! use fixed::types::I16F16;
//! use fixed_analytics::{sin, cos, sqrt, ln};
//!
//! let angle = I16F16::from_num(0.5);
//! let (s, c) = (sin(angle), cos(angle));
//!
//! let root = sqrt(I16F16::from_num(2.0)).unwrap();
//! assert!((root.to_num::<f32>() - 1.414).abs() < 0.001);
//!
//! let log = ln(I16F16::E).unwrap();
//! assert!((log.to_num::<f32>() - 1.0).abs() < 0.01);
//! ```
//!
//! # Available Functions
//!
//! **Total functions** return `T` directly, saturating on overflow.
//! **Fallible functions** return [`Result<T, Error>`] on domain violations.
//!
//! | Category | Total | Fallible |
//! |--------------|-------|----------|
//! | Trigonometric | [`sin`], [`cos`], [`tan`], [`sin_cos`], [`atan`], [`atan2`] | [`asin`], [`acos`] |
//! | Hyperbolic | [`sinh`], [`cosh`], [`tanh`], [`sinh_cosh`], [`asinh`] | [`acosh`], [`atanh`], [`acoth`], [`coth`] |
//! | Exponential | [`exp`], [`pow2`] | [`ln`], [`log2`], [`log10`] |
//! | Algebraic | — | [`sqrt`] |
//!
//! Functions use polynomial evaluation, CORDIC, and Newton-Raphson techniques.
//! Complete absence of panic is verified at the linker level via the
//! [`no-panic`](https://github.com/dtolnay/no-panic) crate.
//!
//! # Accuracy
//!
//! | Type | Typical Accuracy |
//! |------|------------------|
//! | `I16F16` | ~4 decimal digits |
//! | `I32F32` | ~8 decimal digits |
//!
//! All functions are benchmarked against MPFR reference implementations.
//! Accuracy regressions are not permitted across releases.
//!
//! # Features
//!
//! - **`std`** (default): Enables `std::error::Error` impl on [`Error`]
//!
//! See the [`kernel`] module for algorithm details.
// Re-export the fixed crate for convenience
pub use fixed;
// Re-export main types
pub use ;
pub use CordicNumber;
// Re-export all mathematical functions at crate root for convenience
pub use sqrt;
pub use ;
pub use ;
pub use ;