^
Operator
Raises a number to a power.
Syntax
number ^ exponent
Parts
number
- A numeric expression.
exponent
- A numeric expression.
Result
The result is number
raised to the power of exponent
.
Its data type can be one of Real64
or Real128
.
See Data Types of Operator Results for more information.
Applicable types
If the operands are not one of Real64
or Real128
, they will be converted to one of these.
Instructions
The value of exponent
can be fractional and/or negative.
If an expression has more than one caret operator, they are read from right to left.
Note: ViviFire's caret operator has precedence rules different from standard mathematics. Standard mathematics gives exponentiation precedence above negation. ViviFire gives unary operators (negation included) precedence above the caret operator. Thus, “−3²” must be coded as “-(3^2)”.
Examples
Example | Result |
---|---|
| 8.0 |
| -8.0 |
| 16.0 |
| 262144.0 |
| 0.0625 |
| 4.0 |
| 0.33333333333333333333333333333333 |