# ^ 运算符 (Visual Basic)^ Operator (Visual Basic)

## 语法Syntax

number ^ exponent


## 组成部分Parts

number

exponent

## 支持的类型Supported Types

Double.Double. 任何不同类型的操作数都转换为 DoubleOperands of any different type are converted to Double.

## 备注Remarks

Visual Basic 总是对Double 数据类型执行幂运算。Visual Basic always performs exponentiation in the Double Data Type.

^运算符可以重载，这意味着当操作数具有该类或结构的类型时，该类或结构可以重新定义其行为。The ^ operator can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. 如果你的代码在该类或结构上使用此运算符，请确保了解其重新定义的行为。If your code uses this operator on such a class or structure, be sure you understand its redefined behavior. 有关详细信息，请参阅 Operator ProceduresFor more information, see Operator Procedures.

## 示例Example

Dim exp1, exp2, exp3, exp4, exp5, exp6 As Double
exp1 = 2 ^ 2
exp2 = 3 ^ 3 ^ 3
exp3 = (-5) ^ 3
exp4 = (-5) ^ 4
exp5 = 8 ^ (1.0 / 3.0)
exp6 = 8 ^ (-1.0 / 3.0)


exp1设置为4（2 squared）。exp1 is set to 4 (2 squared).

exp2设置为19683（3个立方，然后是该值的立方）。exp2 is set to 19683 (3 cubed, then that value cubed).

exp3设置为-125 （-5 的立方）。exp3 is set to -125 (-5 cubed).

exp4设置为625（-5 到第四次幂）。exp4 is set to 625 (-5 to the fourth power).

exp5设置为2（多维数据集的第8个）。exp5 is set to 2 (cube root of 8).

exp6设置为0.5 （1.0 除以8的 cube 根）。exp6 is set to 0.5 (1.0 divided by the cube root of 8).

exp4 = -5 ^ 4将计算为–（5到第四次幂），这会导致-625。exp4 = -5 ^ 4 would be calculated as –(5 to the fourth power), which would result in -625.

exp6 = 8 ^ -1.0 / 3.0将计算为（8到-1 个幂，即0.125）除以3.0，这将导致0.041666666666666666666666666666667。exp6 = 8 ^ -1.0 / 3.0 would be calculated as (8 to the –1 power, or 0.125) divided by 3.0, which would result in 0.041666666666666666666666666666667.