Skip to main content

Math Operations

abs

Description: Takes a parameter and returns its absolute value.

In the example, res will have the value 12, res1 will have the value 12, res2 will have the value 12, and res3 will have the value null.

Example #1
... | eval res=abs(-12), res1=abs(12), res2=abs("12"), res3=abs("text")

ceil

Description: Takes a parameter and returns the value rounded up.

In the example, res will have the value 2, res1 will have the value 3, res2 will have the value 2, res3 will have the value 2, and res4 will have the value null.

Example #1
... | eval res=ceil(1.2), res1=ceil(2.2), res2=ceil(2), res3=ceil("2"), res4=ceil("text")

exact

Description: Takes a parameter and returns a high-precision value.

In the example, res will have the value 3.7699115.

Example #1
... | eval res=exact(1.2 * pi())

exp

Description: Takes a parameter and returns the value of ( e ) raised to that power (with high precision).

In the example, res will have the value 20.085536923187668.

Example #1
... | eval res=exp(3)

floor

Description: Takes a parameter and returns the value rounded down.

In the example, res will have the value 1, and res1 will have the value 3.

Example #1
... | eval res=floor(1.9), res1=floor(pi())

ln

Description: Takes a parameter and returns its natural logarithm (with high precision).

In the example, res will have the value 1.0986122886681098.

Example #1
... | eval res=ln(3)

log

Description: Takes a parameter and a base, returning the logarithmic value (with high precision).

In the example, res will have the value 1.5849625007211563.

Example #1
... | eval res=log(3,2)

pi

Description: Returns the value of pi (with high precision).

In the example, res will have the value 3.141592653589793.

Example #1
... | eval res=pi()

pow

Description: Takes a parameter and an exponent, returning the raised value (with high precision).

In the example, res will have the value 9.0, and res1 will have the value 9.869604401089358.

Example #1
... | eval res=pow(3,2), res1=pow(pi(),2)

round

Description: Takes a parameter and a number of decimal places to round to, returning the rounded value. By default, rounds to the nearest whole number.

In the example, res will have the value 4, and res1 will have the value 2.56.

Example #1
... | eval res=round(3.5), res1=round(2.555, 2)

sigfig

Description: Takes a parameter and rounds it to the specified number of significant digits.

In the example, res will have the value 4, and res1 will have the value 3.

Example #1
... | eval res=sigfig(3.5), res1=sigfig(2.555)

sqrt

Description: Takes a parameter and returns its square root (with high precision).

In the example, res will have the value 2.0, and res1 will have the value 2.23606797749979.

Example #1
... | eval res=sqrt(4), res1=sqrt(5)