Mojo module
math
Defines math utilities.
You can import these APIs from the math
package. For example:
from math import floor
Functions
-
acos
: Computes theacos
of the inputs. -
acosh
: Computes theacosh
of the inputs. -
align_down
: Returns the closest multiple of alignment that is less than or equal to value. -
align_up
: Returns the closest multiple of alignment that is greater than or equal to value. -
asin
: Computes theasin
of the inputs. -
asinh
: Computes theasinh
of the inputs. -
atan
: Computes theatan
of the inputs. -
atan2
: Computes theatan2
of the inputs. -
atanh
: Computes theatanh
of the inputs. -
cbrt
: Computes thecbrt
of the inputs. -
ceil
: Get the ceiling value of the given object. -
ceildiv
: Return the rounded-up result of dividing x by y. -
clamp
: Clamps the integer value vector to be in a certain range. -
copysign
: Returns a value with the magnitude of the first operand and the sign of the second operand. -
cos
: Computes thecos
of the inputs. -
cosh
: Computes thecosh
of the inputs. -
erf
: Performs the elementwise Erf on a SIMD vector. -
erfc
: Computes theerfc
of the inputs. -
exp
: Calculates elementwise exponential of the input vector. -
exp2
: Computes elementwise 2 raised to the power of n, where n is an element of the input SIMD vector. -
expm1
: Computes theexpm1
of the inputs. -
factorial
: Computes the factorial of the integer. -
floor
: Get the floor value of the given object. -
fma
: Performsfma
(fused multiply-add) on the inputs. -
frexp
: Breaks floating point values into a fractional part and an exponent part. -
gamma
: Computes the Gamma of the input. -
gcd
: Compute the greatest common divisor of two integers. -
hypot
: Computes thehypot
of the inputs. -
iota
: Creates a SIMD vector containing an increasing sequence, starting from offset. -
isclose
: Checks if the two input values are numerically within a tolerance. -
isqrt
: Performs elementwise reciprocal square root on a SIMD vector. -
j0
: Computes the Bessel function of the first kind of order 0 for each input value. -
j1
: Computes the Bessel function of the first kind of order 1 for each input value. -
lcm
: Computes the least common multiple of two integers. -
ldexp
: Computes elementwise ldexp function. -
lgamma
: Computes thelgamma
of the inputs. -
log
: Performs elementwise natural log (base E) of a SIMD vector. -
log10
: Computes thelog10
of the inputs. -
log1p
: Computes thelog1p
of the inputs. -
log2
: Performs elementwise log (base 2) of a SIMD vector. -
logb
: Computes thelogb
of the inputs. -
modf
: Computes the integral and fractional part of the value. -
recip
: Performs elementwise reciprocal on a SIMD vector. -
remainder
: Computes theremainder
of the inputs. -
scalb
: Computes thescalb
of the inputs. -
sin
: Computes thesin
of the inputs. -
sinh
: Computes thesinh
of the inputs. -
sqrt
: Performs square root on an integer. -
tan
: Computes thetan
of the inputs. -
tanh
: Performs elementwise evaluation of the tanh function. -
trunc
: Get the truncated value of the given object. -
ulp
: Computes the ULP (units of last place) or (units of least precision) of the number. -
y0
: Computes the Bessel function of the second kind of order 0 for each input value. -
y1
: Computes the Bessel function of the second kind of order 1 for each input value.
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?