Skip to main content

Crate g_math

Crate g_math 

Source
Expand description

§gMath: Multi-Domain Fixed-Point Arithmetic Library

Zero-float, pure-Rust, consensus-safe fixed-point arithmetic with 18 transcendental functions computed at tier N+1 for full storage-tier precision.

Upgrading from 0.4.x: 0.5.0 is more accurate, and as a side effect some results end in a different final digit. This matters only if you store, hash, or compare results across versions. See CHANGELOG.md.

§Canonical API (FASC Pipeline)

use g_math::canonical::{gmath, evaluate};

let result = evaluate(&(gmath("1.5") + gmath("2.5")));
let exp_result = evaluate(&gmath("1.0").exp());

§Profiles

Default is embedded. Set GMATH_PROFILE for higher precision:

  • embedded (default): Q64.64, 19 decimals
  • balanced: Q128.128, 38 decimals
  • scientific: Q256.256, 77 decimals

Re-exports§

pub use fixed_point::canonical;

Modules§

fixed_point
Fixed-Point Arithmetic Module: Canonical FASC+UGOD Pipeline

Constants§

VERSION
Version information