Neowit developer docs
API referenceSupportKnowledge baseStatusApp
  • Overview
  • REST API
    • Introduction
    • Authentication
      • OAuth2
      • Basic Auth
    • Error codes
    • API reference
    • Coordinate systems
  • Service Accounts
    • Introduction
    • Creating service accounts
  • Integrations
    • Introduction
    • MQTT
      • Native Sparkplug
      • Custom Starlark
  • Starlark
    • Introduction
    • Modules
      • time module
      • json module
      • math module
      • devices module
      • series module
      • sensors module
  • Tutorials
    • Introduction
    • Create users using API
Powered by GitBook
On this page
  • e
  • pi
  • def ceil(x):
  • def copysign(x, y):
  • def fabs(x):
  • def floor(x):
  • def mod(x, y):
  • def pow(x, y):
  • def remainder(x, y):
  • def round(x):
  • def exp(x):
  • def sqrt(x):
  • def asin(x):
  • def atan(x):
  • def atan2(y, x):
  • def cos(x):
  • def hypot(x, y):
  • def sin(x):
  • def tan(x):
  • def degrees(x):
  • def radians(x):
  • def acosh(x):
  • def asinh(x)
  • def atanh(x):
  • def cosh(x):
  • def sinh(x):
  • def tanh(x):
  • def log(x, base):
  • def gamma(x):
  1. Starlark
  2. Modules

math module

Previousjson moduleNextdevices module

Last updated 10 months ago

The original source for this documentation can be found here:

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 -3pi/4.

def cos(x):

Returns the cosine of x, in radians.

def hypot(x, y):

Returns the Euclidean norm, sqrt(xx + 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.

https://github.com/google/starlark-go/blob/master/lib/math/math.go