The Search/Analytics feature of Log Service allows you to use mathematical calculation functions to analyze logs. By combining mathematical calculation functions with query statements, you can perform mathematical calculation on the log query results.

## Supported mathematical operators

You can use the following mathematical operators in the SELECT statement: plus sign (+), minus sign (-), multiplication sign (*), division sign (/), and percent sign (%).

Example:

``*|select avg(latency)/100 , sum(latency)/count(1)``

## Mathematical calculation functions

The following table describes the mathematical functions that Log Service supports.

Function Description
`abs(x)` Returns the absolute value of x.
`cbrt(x)` Returns the cube root of x.
`ceiling(x)` Returns x rounded up to the nearest integer.
`cosine_similarity(x,y)` Returns the cosine similarity between the sparse vectors x and y.
`degrees` Converts the angle in radians to degrees.
`e()` Returns Euler's number.
`exp(x)` Returns Euler's number raised to the power of x.
`floor(x)` Returns x rounded down to the nearest integer.
`from_base(string,radix)` Returns the value of string interpreted as a radix number.
`ln(x)` Returns the natural logarithm of x.
`log2(x)` Returns the logarithm of x to base 2.
`log10(x)` Returns the logarithm of x to base 10.
`log(x,b)` Returns the logarithm of x to base x.
`pi()` Returns the constant Pi.
`pow(x,b)` Returns x raised to the power of b.
`radians(x)` Converts angle x in degrees to radians.
`rand()` Returns a random number.
`random(0,n)` Returns a random number between 0 and n (exclusive).
`round(x)` Returns x rounded to the nearest integer.
`round(x, y)` Returns x rounded to y decimal places. Example: round(1.012345,2) = 1.01.
`sqrt(x)` Returns the square root of x.
`to_base(x, radix)` Returns the radix representation of x.
`truncate(x)` Returns x rounded to integer by dropping digits after decimal point.
`acos(x)` Returns the arc cosine of x.
`asin(x)` Returns the arc sine of x.
`atan(x)` Returns the arc tangent of x.
`atan2(y,x)` Returns the arc tangent of y/x.
`cos(x)` Returns the cosine of x.
`sin(x)` Returns the sine of x.
`cosh(x)` Returns the hyperbolic cosine of x.
`tan(x)` Returns the tangent of x.
`tanh(x)` Returns the hyperbolic tangent of x.
`infinity()` Returns a positive infinite value.
`is_infinity(x)` Determines whether the value is infinite.
`is_finity(x)` Determines whether the value is finite.
`is_nan(x)` Determines whether the value is numeric.