Mojo module
math
Defines basic math functions for use in the open source parts of the standard library since the math
package is currently closed source and cannot be depended on in the open source parts of the standard library.
These are Mojo built-ins, so you don't need to import them.
Traits
-
Absable
: TheAbsable
trait describes a type that defines an absolute value operation. -
Powable
: ThePowable
trait describes a type that defines a power operation (i.e. exponentiation) with the same base and exponent types. -
Roundable
: TheRoundable
trait describes a type that defines a rounding operation.
Functions
-
abs
: Get the absolute value of the given object. -
divmod
: Performs integer division and returns the quotient and the remainder. -
max
: Gets the maximum of two integers. -
min
: Gets the minimum of two integers. -
pow
: Computes thebase
raised to the power of theexp
. -
round
: Get the rounded value of the given object.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
If you'd like to share more information, please report an issue on GitHub
😔 What went wrong?