Mathematical Functions

Estimated reading time: 2 min

Set of built-in mathematical functions to perform common arithmetic, logarithmic, and trigonometric operations. These functions support floating-point calculations and are useful for data analysis, financial computations, and scientific applications.

All functions available in Wiresk can be used with any subscription plan without any usage limitations.
Refer to Core Functions documentation to see how to use Functions in Wiresk
 
For more details, see SQLite Built-In Mathematical SQL Functions

Set of basic arithmetic and rounding functions for performing numerical operations. These functions are useful for calculations, rounding values, and handling precision.

Returns the absolute value of X.

Example:

abs(-15);

Output: 15

Rounds X to Y decimal places (default is 0).

Example:

round(5.6789, 2);

Output: 5.68

Returns the smallest integer greater than or equal to X.

Example:

ceil(4.3), ceiling(-4.3);

Output: 5, -4

Returns the largest integer less than or equal to X.

Example:

floor(4.9), floor(-4.9);

Output: 4, -5

Returns the integer part of X, rounding toward zero.

Example:

trunc(5.9), trunc(-5.9);

Output: 5, -5


For handling exponents and roots in mathematical calculations.

Calculates X to the power of Y.

Example:

pow(2, 3);

Output: 8

Returns the square root of X (NULL if X is negative).

Example:

sqrt(16);

Output: 4


Functions to perform logarithmic and exponential operations, which are commonly used in mathematical, scientific, and financial calculations.

Calculates e^X, where e is approximately 2.718.

Example:

exp(2);

Output: 7.38905609893

Returns the natural logarithm (ln, base e) of X.

Example:

ln(10);

Output: 2.30258509299

Returns the base-10 logarithm of X.

Example:

log10(100);

Output: 2

Returns the logarithm of X to base B.

Example:

log(2, 8);

Output: 3

Returns the base-2 logarithm of X.

Example:

log2(32);

Output: 5


Functions that work with angles in radians.

Calculates the sine, cosine, or tangent of X (X is in radians).

Example:

sin(3.14159), cos(3.14159), tan(3.14159);

Output: 0.00000265359, -1, -0.00000265359

Returns the inverse sine, cosine, or tangent of X, in radians.

Example:

asin(0.5), acos(0.5), atan(1);

Output: 0.523598, 1.047198, 0.785398

Calculates the arctangent of Y/X in radians, considering the quadrant.

Example:

atan2(1, 1);

Output: 0.785398 (π/4)

Converts X from radians into degrees.

Example:

degrees(3.14159);

Output: 179.99984796 (~180°)

Converts X from degrees into radians.

Example:

radians(180);

Output: 3.14159 (~π)


Functions which are analogs of the trigonometric functions but for hyperbolic geometry. These functions are commonly used in areas like complex analysis, calculus, and physics.

Calculates the hyperbolic sine, cosine, or tangent of X.

Example:

sinh(1), cosh(1), tanh(1);

Output: 1.1752, 1.54308, 0.76159

Calculates the inverse hyperbolic sine, cosine, or tangent of X.

Example:

asinh(1), acosh(2), atanh(0.5);

Output: 0.88137, 1.31696, 0.54931


Functions for a variety of tasks, such as mathematical transformations, string manipulations, and system-related operations. These functions don’t fall under specific categories like trigonometric or arithmetic functions but are still commonly used for various purposes.

Returns an approximation for π.

Example:

pi();

Output: 3.14159265359

Returns the remainder after dividing X by Y.

Example:

mod(10, 3);

Output: 1


See more about functions in Wiresk. 
Explore our User Guide
For a complete tutorial on how to create a Flow, see “How to create a Flow in Wiresk”