Skip to main content

hyperreal/
lib.rs

1//! Exact rational, symbolic real, and computable real arithmetic.
2//!
3//! `hyperreal` represents values as a mix of exact rationals, recognized
4//! symbolic forms such as `pi`, `e`, logarithms, and trigonometric special
5//! forms, and lazily evaluated computable expressions. The public structural
6//! query APIs expose cheap conservative facts for callers that need to avoid
7//! forcing high-precision evaluation. The lazy approximation layer follows the
8//! exact-real arithmetic model described by Boehm et al.,
9//! <https://doi.org/10.1145/319838.319860>.
10//!
11//! Exactness here is a certified-data contract, not a promise that every value
12//! is eagerly reduced to one canonical scalar form. Following Yap's exact
13//! geometric computation model, `Real` preserves rational, symbolic,
14//! structural, and refinement facts so higher layers can make exact decisions
15//! or return explicit uncertainty without hiding primitive-float fallbacks.
16//! See Yap, "Towards Exact Geometric Computation," *Computational Geometry*,
17//! 1997, pp. 3-23.
18
19mod rational;
20pub use crate::rational::Rational;
21
22mod structural;
23pub use crate::structural::{
24    CertifiedRealEquality, CertifiedRealOrdering, CertifiedRealSign, DomainFacts, DomainStatus,
25    ExpressionDegree, IdentityFacts, MagnitudeBits, OrderingFacts, PrimitiveFacts,
26    PrimitiveFloatStatus, RationalFacts, RationalStorageClass, RealDetailedFacts,
27    RealEqualityCertificate, RealOrderingCertificate, RealSign, RealSignCertificate,
28    RealStructuralFacts, StructuralComparison, StructuralKind, SymbolicDependencyMask,
29    SymbolicFacts, ZeroKnowledge, ZeroOneMinusOneStatus, ZeroOneStatus,
30};
31
32mod trace;
33pub(crate) use trace::trace_dispatch;
34
35#[cfg(feature = "dispatch-trace")]
36pub mod dispatch_trace;
37
38mod computable;
39pub use crate::computable::Computable;
40
41mod real;
42pub use crate::real::{
43    Real, RealExactSetDenominatorKind, RealExactSetDyadicExponentClass, RealExactSetFacts,
44    RealExactSetSignPattern,
45};
46
47#[cfg(feature = "simple")]
48mod simple;
49#[cfg(feature = "simple")]
50pub use crate::simple::Simple;
51
52mod problem;
53pub use crate::problem::Problem;
54
55#[cfg(feature = "serde")]
56mod serde;