| xHarbour Reference Documentation > Operator Reference |
![]() |
![]() |
![]() |
Exponentiation (binary): raises a number to the power of an exponent.
<nNumber> ** <nExponent> <nNumber> ˆ <nExponent>
This operator is a binary operator that raises <nNumber> to the power of <nExponent>.
| See also: | %, *, +, -, /, = (compound assignment), SET DECIMALS, SET FIXED |
| Category: | Mathematical operators , Operators |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example shows some results of the "**" operator.
PROCEDURE Main
? 5 ** 0 // result: 1.00
? 5 ** 1 // result: 5.00
? 5 ** 2 // result: 25.00
? 5 ** -2 // result: 0.04
? -5 ** 2 // result: 25.00
? 5 ˆ 0 // result: 1.00
? 5 ˆ 1 // result: 5.00
? 5 ˆ 2 // result: 25.00
? 5 ˆ -2 // result: 0.04
? -5 ˆ 2 // result: 25.00
RETURN
http://www.xHarbour.com