Skip to main content

Mojo package

math

Math functions and constants: trig, exponential, logarithmic, and special functions.

The math package provides mathematical functions and constants for numerical computation. It includes standard mathematical operations from trigonometry, exponential and logarithmic functions, special functions, and numerical utilities. This package implements both precise mathematical operations and fast approximations for performance-critical code, along with support for rounding, clamping, and IEEE 754 floating-point behavior.

Use this package for scientific computing, numerical algorithms, graphics and game development, statistical calculations, or any application requiring mathematical operations beyond basic arithmetic. The fast module provides optimized approximations when absolute precision can be traded for performance.

Modules

  • constants: Defines math utilities.
  • fast: Defines fast math approximation utilities.
  • math: Defines math utilities.
  • polynomial: Provides two implementations for evaluating polynomials.

Was this page helpful?