Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

f128

f128 - 64.64 Fixed-Point Arithmetic

High-precision fixed-point numbers using 128-bit representation.

Format

The f128 format uses 64 bits for the integer part and 64 bits for the fractional part, providing: - Range: approximately ±9.2 × 10¹⁸ - Precision: approximately 5 × 10⁻²⁰

Core Type

The Fixed struct represents a signed fixed-point number:

  • mag: The absolute magnitude scaled by 2⁶⁴
  • sign: true for negative, false for positive

Modules

  • types - Core types (Fixed, Vec2, Vec3, Vec4)
  • math - Mathematical operations
    • ops - Basic arithmetic, power, exponential, logarithms
    • trig - Trigonometric functions
    • hyp - Hyperbolic functions
    • comp - Comparison utilities
  • procgen - Procedural generation (noise, random)

Example

use cairo_fp::f128::types::fixed::FixedTrait;
use cairo_fp::f128::math::ops;

let x = FixedTrait::new_unscaled(2, false);  // 2.0
let result = ops::exp(x);  // e² ≈ 7.389

Fully qualified path: cairo_fp::f128

Modules

math
procgen
test
types