POWER
The POWER® function returns the value of the first argument to the power of the second argument.
The schema is SYSIBM.
Each argument must be an expression that returns the value of any built-in numeric data type. If either argument includes a DECIMAL or REAL data type, but not a DECFLOAT data type, the arguments are converted to a double precision floating-point number for processing by the function. If either argument includes a DECFLOAT data type, the arguments are converted to DECFLOAT for processing by the function.
The result of the function depends on the data type of the arguments:
- If both arguments are SMALLINT or INTEGER, the result is INTEGER.
- If either argument is a DECFLOAT, the data type of
the result is DECFLOAT(34). If either argument is a DECFLOAT and one of the following statements is true, the result is NaN and an invalid operation condition:
- both arguments are zero
- the second argument has a non-zero fractional part
- the second argument has more than 9 digits
- the second argument is Infinite
- Otherwise, the result is DOUBLE.
The result can be null; if any argument is null, the result is the null value.
Example 1: Assume that host variable HPOWER is
INTEGER with a value of 3. The following statement returns the value
8.
SELECT POWER(2,:HPOWER)
FROM SYSIBM.SYSDUMMY1;
Example 2: The
following statement returns the value 1.
SELECT POWER(0,0)
FROM SYSIBM.SYSDUMMY1;