^ Operator

Raises a number to a power.

Syntax

number ^ power

Parts

number
Required numeric expression
power
Required numeric expression

Remarks

The result is a double-precision value. If either expression is not a double-precision value, it will be converted automatically.

Unlike standard mathematical notation which gives exponentiation precedence over negation, ViviFire's unary operators (including negation) have higher precedence than the ^ operator. Thus, the expression "−3²" must be coded as "−(3^2)".

Examples

ExampleResult
2 ^ 3
8.0
-2 ^ 3
-8.0
-2 ^ 4
16.0
2 ^ 3 ^ 4
4096.0
4 ^ -2
0.0625
16 ^ (1 / 2)
4.0
9 ^ -(1 / 2)
0.33333333333333333333333333333333