File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,21 @@ coercion L<fails|/routine/fail> with C<X::Numeric::Real>.
206
206
The C < :D > variant returns the result of that coercion. The C < :U > variant issues
207
207
a warning about using an uninitialized value in numeric context and then returns value C < 0e0 > .
208
208
209
+ = head2 sub infix:<**>
210
+
211
+ multi sub infix:<**>(Complex:D \a, Complex:D \b --> Complex:D)
212
+ multi sub infix:<**>(Num(Real) \a, Complex:D \b --> Complex:D)
213
+ multi sub infix:<**>(Complex:D \a, Num(Real) \b --> Complex:D)
214
+
215
+ The X < exponentiation operator > coerces the second argument to L < Complex|/type/Complex >
216
+ and calculates the left-hand-side raised to the power of the right-hand side (both can
217
+ be equal to zero).
218
+
219
+ say i ** i # OUTPUT: «0.20787957635076193+0i»
220
+ say 2 ** i # OUTPUT: «0.7692389013639721+0.6389612763136348i»
221
+ say i ** 2 # OUTPUT: «-1+1.2246467991473532e-16i»
222
+ say 0 ** 1 # OUTPUT: «0+0i»
223
+
209
224
= end pod
210
225
211
226
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6
You can’t perform that action at this time.
0 commit comments