# Scalar functions

## Mathematical functions

Function NameDescription
abs()Calculates the absolute value of the input.
acos()Returns the angle whose cosine is the specified number (the inverse operation of cos()).
asin()Returns the angle whose sine is the specified number (the inverse operation of sin()).
atan()Returns the angle whose tangent is the specified number (the inverse operation of tan()).
atan2()Calculates the angle, in radians, between the positive x-axis and the ray from the origin to the point (y, x).
cos()Returns the cosine function.
degrees()Converts angle value in radians into value in degrees, using formula degrees = (180 / PI) * angle-in-radians.
exp()The base-e exponential function of x, which is e raised to the power x: e^x.
exp2()The base-2 exponential function of x, which is 2 raised to the power x: 2^x.
gamma()Computes gamma function.
isinf()Returns whether input is an infinite (positive or negative) value.
isnan()Returns whether input is Not-a-Number (NaN) value.
log()Returns the natural logarithm function.
log10()Returns the common (base-10) logarithm function.
log2()Returns the base-2 logarithm function.
loggamma()Computes log of absolute value of the gamma function.
not()Reverses the value of its bool argument.
pi()Returns the constant value of Pi (π).
pow()Returns a result of raising to power.
radians()Converts angle value in degrees into value in radians, using formula radians = (PI / 180) * angle-in-degrees.
round()Returns the rounded source to the specified precision.
sign()Sign of a numeric expression.
sin()Returns the sine function.
sqrt()Returns the square root function.
tan()Returns the tangent function.
exp10()The base-10 exponential function of x, which is 10 raised to the power x: 10^x.
isint()Returns whether input is an integer (positive or negative) value
isfinite()Returns whether input is a finite value (is neither infinite nor NaN).

## abs()

Calculates the absolute value of the input.

### Arguments

NameTypeRequired or OptionalDescription
xint, real or timespanRequiredThe value to make absolute

### Returns

• Absolute value of x.

### Examples

``abs(x)``
``abs(80.5) == 80.5``
``````['sample-http-logs']
| project absolute_value = abs(req_duration_ms)``````

## acos()

Returns the angle whose cosine is the specified number (the inverse operation of cos()) .

### Arguments

NameTypeRequired or OptionalDescription
xrealRequiredA real number in range [-1,. 1]

### Returns

• The value of the arc cosine of x
• `null` if `x` < -1 or `x` > 1

### Examples

``acos(x)``
``acos(-1) == 3.141592653589793``

## asin()

Returns the angle whose sine is the specified number (the inverse operation of sin()) .

### Arguments

NameTypeRequired or OptionalDescription
xrealRequiredA real number in range [-1,. 1]
• x: A real number in range [-1, 1].

### Returns

• The value of the arc sine of x
• null if x < -1 or x > 1

### Examples

``asin(x)``
``````['sample-http-logs']
| project inverse_sin_angle = asin(-1)``````

## atan()

Returns the angle whose tangent is the specified number (the inverse operation of tan()) .

### Arguments

x: A real number.

### Returns

The value of the arc tangent of x

### Examples

``atan(x)``
``atan(-1) == -0.7853981633974483``

## atan2()

Calculates the angle, in radians, between the positive x-axis and the ray from the origin to the point (y, x).

### Arguments

x: X coordinate (a real number). y: Y coordinate (a real number).

### Returns

The angle, in radians, between the positive x-axis and the ray from the origin to the point (y, x).

### Examples

``atan2(y,x)``
``atan2(-1, 1) == -0.7853981633974483``

## cos()

Returns the cosine function.

### Arguments

x: A real number.

### Returns

The result of cos(x)

### Examples

``cos(x)``
``cos(-1) == 0.5403023058681398``

## degrees()

Converts angle value in radians into value in degrees, using formula degrees = (180 / PI ) * angle_in_radians

### Arguments

NameTypeRequired or OptionalDescription

### Returns

The corresponding angle in degrees for an angle specified in radians.

### Examples

``degrees(a)``
``degrees(3.14) == 179.9087476710785``

## exp()

The base-e exponential function of x, which is e raised to the power x: e^x.

### Arguments

NameTypeRequired or OptionalDescription
xreal numberRequiredValue of the exponent.

### Returns

• Exponential value of x.
• For natural (base-e) logarithms, see log().
• For exponential functions of base-2 and base-10 logarithms, see exp2(), exp10()

### Examples

``exp(x)``
``exp(1) == 2.718281828459045``

## exp2()

The base-2 exponential function of x, which is 2 raised to the power x: 2^x.

### Arguments

NameTypeRequired or OptionalDescription
xreal numberRequiredValue of the exponent.

### Returns

• Exponential value of x.
• For natural (base-2) logarithms, see log2().
• For exponential functions of base-e and base-10 logarithms, see exp(), exp10()

### Examples

``exp2(x)``
``| project base_2_exponential_value = exp2(req_duration_ms)``

## gamma()

Computes gamma function

### Arguments

• x: Parameter for the gamma function

### Returns

• Gamma function of x.
• For computing log-gamma function, see loggamma().

### Examples

``gamma(x)``
``gamma(4) == 6``

## isinf()

Returns whether input is an infinite (positive or negative) value.

### Example

``isinf(x)``
``isinf(45.56) == false``

### Arguments

x: A real number.

### Returns

A non-zero value (true) if x is a positive or negative infinite; and zero (false) otherwise.

## isnan()

Returns whether input is Not-a-Number (NaN) value.

### Arguments

x: A real number.

### Returns

A non-zero value (true) if x is NaN; and zero (false) otherwise.

### Examples

``isnan(x)``
``isnan(45.56) == false``

## log()

log() returns the natural logarithm function.

### Arguments

NameTypeRequired or OptionalDescription
xrealRequiredA real number > 0.

### Returns

The natural logarithm is the base-e logarithm: the inverse of the natural exponential function (exp). null if the argument is negative or null or can't be converted to a real value.

### Examples

``log(x)``
``log(1) == 0``

## log10()

log10() returns the common (base-10) logarithm function.

### Arguments

NameTypeRequired or OptionalDescription
xrealRequiredA real number > 0.

### Returns

The common logarithm is the base-10 logarithm: the inverse of the exponential function (exp) with base 10. null if the argument is negative or null or can't be converted to a real value.

### Examples

``log10(x)``
``log10(4) == 0.6020599913279624``

## log2()

log2() returns the base-2 logarithm function.

### Arguments

NameTypeRequired or OptionalDescription
xrealRequiredA real number > 0.

### Returns

The logarithm is the base-2 logarithm: the inverse of the exponential function (exp) with base 2. null if the argument is negative or null or can't be converted to a real value.

### Examples

``log2(x)``
``log2(6) == 2.584962500721156``

## loggamma()

Computes log of absolute value of the gamma function

### Arguments

x: Parameter for the gamma function

### Returns

• Returns the natural logarithm of the absolute value of the gamma function of x.

### Examples

``````loggamma(x)

```apl copy
loggamma(16) == 27.89927138384089``````

## not()

Reverses the value of its bool argument.

### Examples

``not(expr)``

### Arguments

NameTypeRequired or OptionalDescription
ExprboolRequiredA `bool` expression to be reversed.

### Returns

Returns the reversed logical value of its bool argument.

## pi()

Returns the constant value of Pi.

### Returns

• The double value of Pi (3.1415926...)

### Examples

``pi()``
``````['sample-http-logs']
| project pie = pi()``````

## pow()

Returns a result of raising to power

### Examples

``pow(base, exponent )``
``pow(2, 6) == 64``

### Arguments

• base: Base value.
• exponent: Exponent value.

### Returns

Returns base raised to the power exponent: base ^ exponent.

Converts angle value in degrees into value in radians, using formula `radians = (PI / 180 ) * angle_in_degrees`

### Arguments

NameTypeRequired or OptionalDescription
arealRequiredAngle in degrees (a real number).

### Returns

The corresponding angle in radians for an angle specified in degrees.

### Examples

``radians(a)``
``radians(60) == 1.0471975511965976``

## round()

Returns the rounded source to the specified precision.

### Arguments

• source: The source scalar the round is calculated on.
• Precision: Number of digits the source will be rounded to.(default value is 0)

### Returns

The rounded source to the specified precision.

### Examples

``round(source [, Precision])``
``round(25.563663) == 26``

## sign()

Sign of a numeric expression

### Examples

``sign(x)``
``sign(25.563663) == 1``

### Arguments

• x: A real number.

### Returns

• The positive (+1), zero (0), or negative (-1) sign of the specified expression.

## sin()

Returns the sine function.

### Examples

``sin(x)``
``sin(25.563663) == 0.41770848373492825``

### Arguments

NameTypeRequired or OptionalDescription
xrealRequiredA real number.

### Returns

The result of sin(x)

## sqrt()

Returns the square root function.

### Examples

``sqrt(x)``
``sqrt(25.563663) == 5.0560521160288685``

### Arguments

NameTypeRequired or OptionalDescription
xrealRequiredA real number >= 0.

### Returns

• A positive number such that _sqrt(x) _ sqrt(x) == x*
• null if the argument is negative or cannot be converted to a real value.

## tan()

Returns the tangent function.

### Examples

``tan(x)``
``tan(25.563663) == 0.4597371460602336``

### Argument

NameTypeRequired or OptionalDescription
xrealRequiredA real number.

### Returns

• The result of `tan(x)`

## exp10()

The base-10 exponential function of x, which is 10 raised to the power x: 10^x.

### Examples

``exp10(x)``
``exp10(25.563663) == 36,615,333,994,520,800,000,000,000``

### Arguments

NameTypeRequired or OptionalDescription
xrealRequiredA real number, value of the exponent.

### Returns

• Exponential value of x.
• For natural (base-10) logarithms, see log10().
• For exponential functions of base-e and base-2 logarithms, see exp(), exp2()

## isint()

Returns whether input is an integer (positive or negative) value.

### Arguments

• Expr: expression value which can be a real number

### Returns

A non-zero value (true) if expression is a positive or negative integer; and zero (false) otherwise.

### Examples

``isint(expression)``
``isint(resp_body_size_bytes) == true``
``isint(25.563663) == false``

## isfinite()

Returns whether input is a finite value (is neither infinite nor NaN).

### Arguments

• number: A real number.

### Returns

A non-zero value (true) if x is finite; and zero (false) otherwise.

### Examples

``isfinite(number)``
``isfinite(25.563663) == true``