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: TheAbsabletrait describes a type that defines an absolute value operation.
- DivModable: TheDivModabletrait describes a type that defines division and modulo operations returning both quotient and remainder.
- Powable: ThePowabletrait describes a type that defines a power operation (i.e. exponentiation) with the same base and exponent types.
- Roundable: TheRoundabletrait describes a type that defines a rounding operation.
Functions
- abs: Get the absolute value of the given object.
- divmod: Performs division and returns the quotient and the remainder.
- max: Gets the maximum of two integers.
- min: Gets the minimum of two integers.
- pow: Computes thebaseraised 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!
