POWER Function (NUMBERS)
Raises
a number to a power. For instance you can use this function to square the
number 2 to get the result, 4.
NewNumber := POWER(Number, Power)
Example
Text constant
|
ENU value
|
Text000
|
'%1
raised to the power of %2 = %3'
|
Text001
|
'%1
raised to the power of %2 = %3'
|
Text002
|
'%1
raised to the power of %2 = %3'
|
Number1 := 2; Power1 := 8;
Number2 := 100; Power2 := 0;Number3 := 5; Power3 := 0.5;
Res1 := POWER(Number1, Power1);
Res2 := POWER(Number2, Power2);
Res3 := POWER(Number3, Power3);
MESSAGE(Text000, Number1, Power1, Res1)
MESSAGE(Text001, Number2, Power2, Res2);
MESSAGE(Text001, Number3, Power3, Res3);
The
message windows display the following:
2
raised to the power of 8 = 256
100
raised to the power 0 = 1
5
raised to the power of 0.5 = 2.2360679775
The last message window shows that raising a number to the power
of 0.5 corresponds to the square root of the number.