**
ErrorsCollection

**

Synthesised documentation from language/operators

From language/operators

See Original text in context

multi sub infix:<**>(AnyAny --> Numeric:Dis 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 squaredInt $num ) { $num² };
say squared($_for ^5# OUTPUT: «0␤1␤4␤9␤16␤»

It also works for sequences of several Unicode superscript numbers:

sub twenty-second-powerInt $num ) { $num²² };
say twenty-second-power($_for ^5# OUTPUT: «0␤1␤4194304␤31381059609␤17592186044416␤»