Important

   

This documentation space contains information about PATROL Agents when deployed in a TrueSight Operations Management environment. If you are a BMC Helix Operations Management user, see PATROL Agent 22.1 for BMC Helix Operations Management. Open link

pow()

Raise a number to a power.

Syntax

pow(base,exponent)

Parameter

Parameter

Definition

base

numeric value that is to be multiplied by itself exponent number of times

exponent

numeric value that indicates the number of times base should be multiplied by itself The exponent must be positive if base = 0, and exponent must be an integer if base < 0

Description

The pow() function returns the value of base raised to the power exponent, or baseexponent. 

The output range for the pow() function is – ∞ < pow() < ∞ .

Example

The following PSL script uses the pow() function to produce a table of powers of the integers from one to nine.

function main() {
print(" n n^4 n^5 n^6 n^7 n^8 n^9\n");
print("-- --------- --------- --------- --------- --------- ---------\n");
base = 1;
while (base <= 9) {
printf("%2d",base);
exponent = 4;
while (exponent <= 9) {
printf(" %9d",pow(base,exponent));
exponent++;
}
printf("\n");
base++;
}
}

The example produces the following table:

n 		n^4 	n^5 	n^6 	n^7 	n^8 	n^9
-- --------- --------- --------- --------- --------- ---------
1		1		1		1		1		1		 1
2		16		32		64		128		256		 512
3		81		243		729		2187	6561 	 19683
4 		256 	1024 	4096 	16384 	65536 	 262144
5 		625 	3125 	15625 	78125 	390625 	 1953125
6 		1296 	7776 	46656 	279936 	1679616	 10077696
7		2401 	16807 	117649 	823543  5764801  40353607
8 		4096 	32768 	262144  2097152 16777216 134217728
9 		6561 	59049 	531441 	4782969 43046721 387420489

Was this page helpful? Yes No Submitting... Thank you

Comments