math

Source code: math.seq

math.e
math.pi
math.tau
math.inf
math.nan
math.factorial(x: int)
math.isnan(x: float)

isnan(float) -> bool

Return True if float arg is a NaN, else False.

math.isinf(x: float)

isinf(float) -> bool:

Return True if float arg is an INF, else False.

math.isfinite(x: float)

isfinite(float) -> bool

Return True if x is neither an infinity nor a NaN, and False otherwise.

math.ceil(x: float)

ceil(float) -> float

Return the ceiling of x as an Integral. This is the smallest integer >= x.

math.floor(x: float)

floor(float) -> float

Return the floor of x as an Integral. This is the largest integer <= x.

math.fabs(x: float)

fabs(float) -> float

Returns the absolute value of a floating point number.

math.fmod(x: float, y: float)

fmod(float, float) -> float

Returns the remainder of x divided by y.

math.exp(x: float)

exp(float) -> float

Returns the value of e raised to the xth power.

math.expm1(x: float)

expm1(float) -> float

Return e raised to the power x, minus 1. expm1 provides a way to compute this quantity to full precision.

math.ldexp(x: float, i: int)

ldexp(float, int) -> float

Returns x multiplied by 2 raised to the power of exponent.

math.log(x: float)

log(float) -> float

Returns the natural logarithm (base-e logarithm) of x.

math.log2(x: float)

log2(float) -> float

Return the base-2 logarithm of x.

math.log10(x: float)

log10(float) -> float

Returns the common logarithm (base-10 logarithm) of x.

math.degrees(x: float)

degrees(float) -> float

Convert angle x from radians to degrees.

math.radians(x: float)

radians(float) -> float

Convert angle x from degrees to radians.

math.sqrt(x: float)

sqrt(float) -> float

Returns the square root of x.

math.pow(x: float, y: float)

pow(float, float) -> float

Returns x raised to the power of y.

math.acos(x: float)

acos(float) -> float

Returns the arc cosine of x in radians.

math.asin(x: float)

asin(float) -> float

Returns the arc sine of x in radians.

math.atan(x: float)

atan(float) -> float

Returns the arc tangent of x in radians.

math.atan2(y: float, x: float)

atan2(float, float) -> float

Returns the arc tangent in radians of y/x based on the signs of both values to determine the correct quadrant.

math.cos(x: float)

cos(float) -> float

Returns the cosine of a radian angle x.

math.sin(x: float)

sin(float) -> float

Returns the sine of a radian angle x.

math.hypot(x: float, y: float)

hypot(float, float) -> float

Return the Euclidean norm. This is the length of the vector from the origin to point (x, y).

math.tan(x: float)

tan(float) -> float

Return the tangent of a radian angle x.

math.cosh(x: float)

cosh(float) -> float

Returns the hyperbolic cosine of x.

math.sinh(x: float)

sinh(float) -> float

Returns the hyperbolic sine of x.

math.tanh(x: float)

tanh(float) -> float

Returns the hyperbolic tangent of x.

math.acosh(x: float)

acosh(float) -> float

Return the inverse hyperbolic cosine of x.

math.asinh(x: float)

asinh(float) -> float

Return the inverse hyperbolic sine of x.

math.atanh(x: float)

atanh(float) -> float

Return the inverse hyperbolic tangent of x.

math.copysign(x: float, y: float)

copysign(float, float) -> float

Return a float with the magnitude (absolute value) of x but the sign of y.

math.log1p(x: float)

log1p(float) -> float

Return the natural logarithm of 1+x (base e).

math.trunc(x: float)

trunc(float) -> float

Return the Real value x truncated to an Integral (usually an integer).

math.erf(x: float)

erf(float) -> float

Return the error function at x.

math.erfc(x: float)

erfc(float) -> float

Return the complementary error function at x.

math.gamma(x: float)

gamma(float) -> float

Return the Gamma function at x.

math.lgamma(x: float)

lgamma(float) -> float

Return the natural logarithm of the absolute value of the Gamma function at x.

math.remainder(x: float, y: float)

remainder(float, float) -> float

Return the IEEE 754-style remainder of x with respect to y. For finite x and finite nonzero y, this is the difference x - n*y, where n is the closest integer to the exact value of the quotient x / y. If x / y is exactly halfway between two consecutive integers, the nearest even integer is used for n.

math.gcd(a: float, b: float)

gcd(float, float) -> float

returns greatest common divisor of x and y.

math.frexp(x: float)

frexp(float) -> tuple[float, int]

The returned value is the mantissa and the integer pointed to by exponent is the exponent. The resultant value is x = mantissa * 2 ^ exponent.

math.modf(x: float)

modf(float) -> tuple[float, float]

The returned value is the fraction component (part after the decimal), and sets integer to the integer component.

math.isclose(a: float, b: float)

isclose(float, float) -> bool

Return True if a is close in value to b, and False otherwise. For the values to be considered close, the difference between them must be smaller than at least one of the tolerances.

Unlike python, rel_tol and abs_tol are set to default for now.