Skip to content

Commit

Permalink
- Added the Complex.roots() method (separated from Complex.root() wit…
Browse files Browse the repository at this point in the history
…h 2 arguments)
  • Loading branch information
trizen committed Nov 27, 2015
1 parent 501b714 commit 26f78d4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/Sidef/Types/Number/Complex.pm
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,13 @@ package Sidef::Types::Number::Complex {
sub root {
my ($self, $n, $k) = @_;
local $Sidef::Types::Number::Number::GET_PERL_VALUE = 1;
@_ == 2
? Sidef::Types::Array::Array->new(map { $self->new($_) } $$self->root($n->get_value))
: $self->new($$self->root($n->get_value, $k->get_value));
$self->new($$self->root($n->get_value, $k->get_value));
}

sub roots {
my ($self, $n) = @_;
local $Sidef::Types::Number::Number::GET_PERL_VALUE = 1;
Sidef::Types::Array::Array->new(map { $self->new($_) } $$self->root($n->get_value));
}

sub int {
Expand Down

0 comments on commit 26f78d4

Please sign in to comment.