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!
π What went wrong?