xHarbour Reference Documentation > Operator Reference xHarbour Developers Network  

**

Exponentiation (binary): raises a number to the power of an exponent.

Syntax

<nNumber> ** <nExponent>
<nNumber> ˆ <nExponent>

Arguments

<nNumber>
<nNumber> is numeric value to raise to the power defined by <nExponent>.
<nExponent>
<nExponent> is the power to raise <nNumber1>.

Description

This operator is a binary operator that raises <nNumber> to the power of <nExponent>.

Info

See also:%, *, +, -, /, = (compound assignment), SET DECIMALS, SET FIXED
Category: Mathematical operators , Operators
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe