math

Index

Overview

math defines mathematical functions, it’s intended to be a drop-in subset of python’s math module for starlark: https://docs.python.org/3/library/math.html

Functions

def acos

acos(x)

Return the arc cosine of x, in radians.

def acosh

acosh(x)

Return the inverse hyperbolic cosine of x.

def asin

asin(x)

Return the arc sine of x, in radians.

def asinh

asinh(x)

Return the inverse hyperbolic sine of x.

def atan

atan(x)

Return the arc tangent of x, in radians.

def atan2

atan2(y, x)

Return atan(y / x), in radians. The result is between -pi and pi. The vector in the plane from the origin to point (x, y) makes this angle with the positive X axis. The point of atan2() is that the signs of both inputs are known to it, so it can compute the correct quadrant for the angle. For example, atan(1) and atan2(1, 1) are both pi/4, but atan2(-1, -1) is -3*pi/4.

def atanh

atanh(x)

Return the inverse hyperbolic tangent of x.

def ceil

ceil(x)

Return the ceiling of x, the smallest integer greater than or equal to x.

def cos

cos(x)

Return the cosine of x radians.

def cosh

cosh(x)

Return the hyperbolic cosine of x.

def degrees

degrees(x)

Convert angle x from radians to degrees.

def exp

exp(x)

Return e raised to the power x, where e = 2.718281… is the base of natural logarithms

def fabs

fabs(x)

Return the absolute value of x.

def floor

floor(x)

Return the floor of x, the largest integer less than or equal to x.

def hypot

hypot(x, y)

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

def radians

radians(x)

Convert angle x from degrees to radians.

def round

round(x)

Returns the nearest integer, rounding half away from zero.

def sin

sin(x)

Return the sine of x radians.

def sinh

sinh(x)

Return the hyperbolic sine of x.

def sqrt

sqrt(x)

Return the square root of x.

def tan

tan(x)

Return the tangent of x radians.

def tanh

tanh(x)

Return the hyperbolic tangent of x.