infix **

Documentation for infix ** assembled from the following types:

language documentation Operators

From Operators

(Operators) infix **

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 ^5OUTPUT: «0␤1␤4␤9␤16␤»

It also works for sequences of several Unicode superscript numbers

sub twentytwoedInt $num ) { $num²² };
say twentytwoed($_for ^5# OUTPUT: «0␤1␤4194304␤31381059609␤17592186044416␤»