Skip to main content

module  pixeltable.functions.math

Pixeltable UDFs for mathematical operations. Example:

udf  abs()

Signature
Return the absolute value of the given number. Equivalent to Python builtins.abs().

udf  acos()

Signature
Return the arc cosine of the given number, in radians. The result is in the range [0, pi]. Equivalent to Python math.acos(). Raises an error if the input is outside the range [-1, 1].

udf  asin()

Signature
Return the arc sine of the given number, in radians. The result is in the range [-pi/2, pi/2]. Equivalent to Python math.asin(). Raises an error if the input is outside the range [-1, 1].

udf  atan()

Signature
Return the arc tangent of the given number, in radians. The result is in the range (-pi/2, pi/2). Equivalent to Python math.atan().

udf  bitwise_and()

Signature
Bitwise AND of two integers. Equivalent to Python self & other.

udf  bitwise_or()

Signature
Bitwise OR of two integers. Equivalent to Python self | other.

udf  bitwise_xor()

Signature
Bitwise XOR of two integers. Equivalent to Python self ^ other.

udf  ceil()

Signature
Return the ceiling of the given number. Equivalent to Python float(math.ceil(self)) if self is finite, or self itself if self is infinite. (This is slightly different from the default behavior of math.ceil(self), which always returns an int and raises an error if self is infinite. The behavior in Pixeltable generalizes the Python operator and is chosen to align with the SQL standard.)

udf  cos()

Signature
Return the cosine of self, an angle in radians. Equivalent to Python math.cos(). Raises an error for infinity. For an angle in degrees, apply radians() first, as in t.x.radians().cos().

udf  degrees()

Signature
Convert an angle from radians to degrees. The inverse of radians(). Equivalent to Python math.degrees().

udf  exp()

Signature
Return e raised to the power of the given number. Equivalent to Python math.exp().

udf  floor()

Signature
Return the floor of the given number. Equivalent to Python float(math.floor(self)) if self is finite, or self itself if self is infinite. (This is slightly different from the default behavior of math.floor(self), which always returns an int and raises an error if self is infinite. The behavior of Pixeltable generalizes the Python operator and is chosen to align with the SQL standard.)

udf  log()

Signature
Return the natural logarithm of the given number. Equivalent to Python math.log().

udf  log10()

Signature
Return the base-10 logarithm of the given number. Equivalent to Python math.log10().

udf  pow()

Signature
Raise self to the power of other. Equivalent to Python builtins.pow().

udf  radians()

Signature
Convert an angle from degrees to radians. The inverse of degrees(). Equivalent to Python math.radians().

udf  round()

Signature
Round a number to a given precision in decimal digits. Equivalent to Python builtins.round(self, digits or 0). Note that if digits is not specified, the behavior matches builtins.round(self, 0) rather than builtins.round(self); this ensures that the return type is always float (as in SQL) rather than int.

udf  sign()

Signature
Return the sign of the given number: -1.0 if it is negative, 1.0 if it is positive, and 0.0 if it is zero. Equivalent to numpy.sign(). NaN is returned unchanged.

udf  sin()

Signature
Return the sine of self, an angle in radians. Equivalent to Python math.sin(). Raises an error for infinity. For an angle in degrees, apply radians() first, as in t.x.radians().sin().

udf  sqrt()

Signature
Return the square root of the given number. Equivalent to Python math.sqrt().

udf  tan()

Signature
Return the tangent of self, an angle in radians. Equivalent to Python math.tan(). Raises an error for infinity. For an angle in degrees, apply radians() first, as in t.x.radians().tan().

udf  to_float()

Signature
Convert an integer to a float. Equivalent to Python float(self).

udf  to_int()

Signature
Convert a float to an integer by truncating toward zero. Equivalent to Python int(self). Raises an error for infinity, NaN, and values outside the range of Int. To round down, up or to the nearest integer instead, apply floor(), ceil() or round() first, as in t.x.floor().to_int().
Last modified on December 4, 2026