In Operators§
See primary documentation in context for infix **
multi infix:<**>(Any, Any --> Numeric) is assoc<right>
The exponentiation operator coerces both arguments to Numeric
and calculates the left-hand-side raised to the power of the right-hand side.
If the right-hand side is a non-negative integer and the left-hand side is an arbitrary precision type (Int
, FatRat
), then the calculation is carried out without loss of precision.
Unicode superscripts will behave in exactly the same way.
sub squared( Int ) ;say squared() for ^5; # OUTPUT: «014916»
It also works for sequences of several Unicode superscript numbers:
sub twenty-second-power( Int ) ;say twenty-second-power() for ^5; # OUTPUT: «0141943043138105960917592186044416»