pow()
Returns a base number raised to the power of the specified exponent.
Syntax
pow(BASE, EXPONENT)
Parameters
BASE- The base number to exponentiate. Must be a numeric type.
EXPONENT- The exponent. Must be a numeric type.
Description
The pow() function returns BASE raised to the power of EXPONENT as a 64-bit double. Internally uses Math.pow(base, exponent).
Returns null if either BASE or EXPONENT is null or not a numeric type.
Error codes
N/A
Usage examples
To prepare the WEB_APACHE_SAMPLE table used in these examples, refer to Preparing sample data.
-
Calculate the square of the request size.
table limit=5 WEB_APACHE_SAMPLE | eval result = pow(bytes, 2) | fields bytes, result -
Calculate the square root using a fractional exponent.
table limit=5 WEB_APACHE_SAMPLE | eval result = pow(bytes, 0.5) | fields bytes, result -
NULL input
json "{}" | eval p = pow(null, 2) | # p: null
Compatibility
The pow() function is available since before Sonar 4.0.