Skip to content

Commit

Permalink
Complex exponentiation involving zeros #2632
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniogamiz committed Mar 6, 2019
1 parent 2bee5b7 commit 01c7418
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions doc/Type/Complex.pod6
Expand Up @@ -206,6 +206,21 @@ coercion L<fails|/routine/fail> with C<X::Numeric::Real>.
The C<:D> variant returns the result of that coercion. The C<:U> variant issues
a warning about using an uninitialized value in numeric context and then returns value C<0e0>.
=head2 sub infix:<**>
multi sub infix:<**>(Complex:D \a, Complex:D \b --> Complex:D)
multi sub infix:<**>(Num(Real) \a, Complex:D \b --> Complex:D)
multi sub infix:<**>(Complex:D \a, Num(Real) \b --> Complex:D)
The X<exponentiation operator> coerces the second argument to L<Complex|/type/Complex>
and calculates the left-hand-side raised to the power of the right-hand side (both can
be equal to zero).
say i ** i # OUTPUT: «0.20787957635076193+0i␤»
say 2 ** i # OUTPUT: «0.7692389013639721+0.6389612763136348i␤»
say i ** 2 # OUTPUT: «-1+1.2246467991473532e-16i␤»
say 0 ** 1 # OUTPUT: «0+0i␤»
=end pod

# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6

0 comments on commit 01c7418

Please sign in to comment.