Skip to content

Commit

Permalink
Handle sign(0), add signature
Browse files Browse the repository at this point in the history
  • Loading branch information
coke committed Feb 4, 2023
1 parent 8bd5eef commit 3504a40
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core.e/Complex.pm6
@@ -1,5 +1,8 @@
augment class Complex {
method sign() { self / self.abs }
method sign(Complex:D: --> Complex:D) {
my $abs = self.abs;
$abs == 0 ?? 0i !! self / $abs
}
}

# vim: expandtab shiftwidth=4

0 comments on commit 3504a40

Please sign in to comment.