Raises a number to the power of another number.
Number ^ exponent
The result value will be number raised to the exponent power.
Double. All operands of a different type will be converted to Double.
Number can be negative only if exponent is an integer value. When more than one exponentiation is performed in a single expression, the ^ operator is evaluated as it is encountered from left to right.
Usually, the data type of result is Double.
This example uses the ^ operator to raise a number to the power of an exponent. The result is the first operand raised to the power of the second.
Dim myValue As Double myValue = 2^
2 ' Returns 4. myValue = 3^
3^
3 ' Returns 19683. myValue = (-5)^
3 ' Returns -125. myValue = (-5) ^ 4 ' Returns 625.
^= Operator | Arithmetic Operators | Operator Precedence in Visual Basic | Operators Listed by Functionality |