power function
The pow
function returns the value of the first expression raised to the power of the second expression.
Syntax:
double pow(n2,n1)
Semantics:
- n1, n2: The arguments n1 and n2 are expressions that resolve to numbers.
- return type: double.
- Returns a NULL value in the following cases:
- If either of the arguments resolves to a NULL value
- If either of the arguments does not resolve to a number
- Returns positive infinity if n2 resolves to positive/negative infinity.
- Returns positive infinity if n1 resolves to positive infinity and zero if n1 resolves to negative infinity.
- Returns a NULL value in the following cases:
Example:
SELECT pow(n2,n1) FROM PHtable
Value of n | Value of b | Output |
---|---|---|
2 | 4 | 16.0 |
2 | 0 | 1.0 |
-0.5 | 4 | 0.0625 |
0.5 | -4 | 16.0 |