> For the complete documentation index, see [llms.txt](https://developers.neowit.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.neowit.io/starlark/modules/math-module.md).

# math module

The original source for this documentation can be found here: <https://github.com/google/starlark-go/blob/master/lib/math/math.go>

Module math is a Starlark module of math-related functions and constants. All functions accept both int and float values as arguments. The module defines the following constants and functions.

## e

The base of natural logarithms, approximately 2.71828.

## pi

The ratio of a circle's circumference to its diameter, approximately 3.14159.

## def ceil(x):

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

## def copysign(x, y):

Returns a value with the magnitude of x and the sign of y.

## def fabs(x):

Returns the absolute value of x as float.

## def floor(x):

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

## def mod(x, y):

Returns the floating-point remainder of x/y. The magnitude of the result is less than y and its sign agrees with that of x.

## def pow(x, y):

Returns x\*\*y, the base-x exponential of y.

## def remainder(x, y):

Returns the IEEE 754 floating-point remainder of x/y.

## def round(x):

Returns the nearest integer, rounding half away from zero.

## def exp(x):

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

## def sqrt(x):

Returns the square root of x.

#### def cos(x):

Returns the arc cosine of x, in radians.

## def asin(x):

Returns the arc sine of x, in radians.

## def atan(x):

Returns the arc tangent of x, in radians.

## def atan2(y, x):

Returns 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 -3p&#x69;*/*&#x34;.

## def cos(x):

Returns the cosine of x, in radians.

## def hypot(x, y):

Returns the Euclidean norm, sqrt(*x*x + y\*y). This is the length of the vector from the origin to point (x, y).

## def sin(x):

Returns the sine of x, in radians.

## def tan(x):

Returns the tangent of x, in radians.

## def degrees(x):

Converts angle x from radians to degrees.

## def radians(x):

Converts angle x from degrees to radians.

## def acosh(x):

Returns the inverse hyperbolic cosine of x.

## def asinh(x)

Returns the inverse hyperbolic sine of x.

## def atanh(x):

Returns the inverse hyperbolic tangent of x.

## def cosh(x):

Returns the hyperbolic cosine of x.

## def sinh(x):

Returns the hyperbolic sine of x.

## def tanh(x):

Returns the hyperbolic tangent of x.

## def log(x, base):

Returns the logarithm of x in the given base, or natural logarithm by default.

## def gamma(x):

Returns the Gamma function of x.
