IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: 1.0.0
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

numerics

Defines utilities to work with numeric types.

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

from std.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 dtype 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.