^ Operator, Pow Function

Purpose

Raises a number to the power of another number.

Syntax

# = x ^ y
# = Pow( x, y)

x,y : aexp

Description

The result is number raised to the power of exponent, always as a Double value. The value of exponent can be fractional, negative, or both.

Example 1

Global Single x, y

x = 2.2

y = 8.1

Debug x ^ y             // prints 593.77775248624

Debug Pow(x, y)         // prints 593.77775248624

Debug (y - 2 * x) ^ 4   // prints 187.416157967765

Debug.Show

Example 2

Local a%, b%, c%, d%, y%, x%, e%

x% = 2, y% = 5

a% = x ^ y

b% = Pow(x, y)

c% = Exp(y * Log(x))

d% = Exp2(y * Log2(x))

e% = Exp10(y * Log10(x))

Debug a%, b%, c%, d%, e%

Debug.Show

Remarks

When more than one exponentiation is performed in a single expression, the ^ operator is evaluated as it is encountered from left to right.

See Also

Operator Hierarchy

{Created by Sjouke Hamstra; Last updated: 15/01/2023 by James Gaite}