Skip to main content

module

math

Defines math utilities.

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

from math import floor

Functions

  • floor: Get the floor value of the given object.
  • ceil: Get the ceiling value of the given object.
  • ceildiv: Return the rounded-up result of dividing x by y.
  • trunc: Get the truncated value of the given object.
  • sqrt: Performs square root on an integer.
  • rsqrt: Performs elementwise reciprocal square root on the elements of a SIMD vector.
  • exp2: Computes elementwise 2 raised to the power of n, where n is an element of the input SIMD vector.
  • ldexp: Computes elementwise ldexp function.
  • exp: Calculates elementwise exponential of the input vector.
  • frexp: Breaks floating point values into a fractional part and an exponent part.
  • log: Performs elementwise natural log (base E) of a SIMD vector.
  • log2: Performs elementwise log (base 2) of a SIMD vector.
  • copysign: Returns a value with the magnitude of the first operand and the sign of the second operand.
  • erf: Performs the elementwise Erf on a SIMD vector.
  • tanh: Performs elementwise evaluation of the tanh function.
  • isclose: Checks if the two input values are numerically within a tolerance.
  • iota: Creates a SIMD vector containing an increasing sequence, starting from 0.
  • fma: Performs fma (fused multiply-add) on 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.
  • acos: Computes the acos of the inputs.
  • asin: Computes the asin of the inputs.
  • atan: Computes the atan of the inputs.
  • atan2: Computes the atan2 of the inputs.
  • cos: Computes the cos of the inputs.
  • sin: Computes the sin of the inputs.
  • tan: Computes the tan of the inputs.
  • acosh: Computes the acosh of the inputs.
  • asinh: Computes the asinh of the inputs.
  • atanh: Computes the atanh of the inputs.
  • cosh: Computes the cosh of the inputs.
  • sinh: Computes the sinh of the inputs.
  • expm1: Computes the expm1 of the inputs.
  • log10: Computes the log10 of the inputs.
  • log1p: Computes the log1p of the inputs.
  • logb: Computes the logb of the inputs.
  • cbrt: Computes the cbrt of the inputs.
  • hypot: Computes the hypot of the inputs.
  • erfc: Computes the erfc of the inputs.
  • lgamma: Computes the lgamma of the inputs.
  • gamma: Computes the Gamma of the input.
  • remainder: Computes the remainder of the inputs.
  • 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.
  • 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.
  • scalb: Computes the scalb of the inputs.
  • gcd: Compute the greatest common divisor of two integers.
  • lcm: Computes the least common multiple of two integers.
  • factorial: Computes the factorial of the integer.