ExponentiationΒΆ

The ^ operator is used to raise one number to the power of another.

Disco> 2 ^ 5
32
Disco> 2 ^ 0
1
Disco> 2 ^ (-5)
1/32
Disco> (-3) ^ (-5)
-1/243

If the exponent is a natural number, the result will have the same type as the base. If the exponent is an integer, the result will be fractional or rational, depending on the type of the base.

Fractional exponents may not be used, as the result could be irrational, and Disco has no way to represent irrational numbers. For example, \(2^{1/2} = \sqrt{2}\).