Skip to main content
Log in

Mojo module

numerics

Defines utilities to work with numeric types.

You can import these APIs from the utils package. For example:

from utils.numerics import FPUtils
from utils.numerics import FPUtils

Structs

  • FlushDenormals: Flushes and denormals are set to zero within the context and the state is restored to the prior value on exit.
  • FPUtils: Collection of utility functions for working with FP values.

Functions

  • get_accum_type: Returns the recommended type for accumulation operations.
  • inf: Gets a +inf value for the given dtype.
  • isfinite: Checks if the value is not infinite.
  • isinf: Checks if the value is infinite.
  • isnan: Checks if the value is Not a Number (NaN).
  • max_finite: Returns the maximum finite value of type.
  • max_or_inf: Returns the maximum (potentially infinite) value of type.
  • min_finite: Returns the minimum (lowest) finite value of type.
  • min_or_neg_inf: Returns the minimum (potentially negative infinite) value of type.
  • nan: Gets a NaN value for the given dtype.
  • neg_inf: Gets a -inf value for the given dtype.
  • nextafter: Computes next representable value of arg0 in the direction of arg1.
  • ulp: Computes the ULP (units of last place) or (units of least precision) of the number.