| 1 | 1 | ▶ | use strict; use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | package Lingy::Lang::Number; | ||||||||||
| 3 | |||||||||||
| 4 | 1 | ▶ | use Lingy::Common; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use base SCALARTYPE; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | use overload | ||||||||||
| 8 | 0 | ▶ | '""' => sub { ${$_[0]} }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 9 | 1 | '+' => \&add, | |||||||||
| 10 | '-' => \&subtract, | ||||||||||
| 11 | '*' => \&multiply, | ||||||||||
| 12 | '/' => \÷, | ||||||||||
| 13 | '==' => \&equal_to, | ||||||||||
| 14 | '>' => \&greater_than, | ||||||||||
| 15 | '>=' => \&greater_equal, | ||||||||||
| 16 | '<' => \&less_than, | ||||||||||
| 17 | '<=' => \&less_equal, | ||||||||||
| 18 | '%' => \&modulo, | ||||||||||
| 19 | cmp => \&comp_pair, | ||||||||||
| 20 | 1 | ▶ | ; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | |||||||||||
| 22 | sub greater_than { | ||||||||||
| 23 | 0 | ▶ | my ($x, $y) = @_; | ||||||||
|
Subroutine
greater_than: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 24 | 0 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 0 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 0 | BOOLEAN->new($x > $y); | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | sub greater_equal { | ||||||||||
| 30 | 0 | ▶ | my ($x, $y) = @_; | ||||||||
|
Subroutine
greater_equal: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 31 | 0 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 0 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | 0 | BOOLEAN->new($x >= $y); | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | sub less_than { | ||||||||||
| 37 | 0 | ▶ | my ($x, $y) = @_; | ||||||||
|
Subroutine
less_than: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 38 | 0 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 0 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 0 | BOOLEAN->new($x < $y); | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | sub less_equal { | ||||||||||
| 44 | 0 | ▶ | my ($x, $y) = @_; | ||||||||
|
Subroutine
less_equal: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 45 | 0 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | 0 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 0 | BOOLEAN->new($x <= $y); | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | sub add { | ||||||||||
| 51 | 0 | ▶ | my ($x, $y) = @_; | ||||||||
|
Subroutine
add: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 52 | 0 | my $class = ref($x); | |||||||||
| 53 | 0 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | 0 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | 0 | $class->new($x + $y); | |||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | sub subtract { | ||||||||||
| 59 | 0 | ▶ | my ($x, $y) = @_; | ||||||||
|
Subroutine
subtract: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 60 | 0 | my $class = ref($x); | |||||||||
| 61 | 0 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 62 | 0 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 63 | 0 | $class->new($x - $y); | |||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | sub multiply { | ||||||||||
| 67 | 0 | ▶ | my ($x, $y) = @_; | ||||||||
|
Subroutine
multiply: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 68 | 0 | my $class = ref($x); | |||||||||
| 69 | 0 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 70 | 0 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 71 | 0 | $class->new($x * $y); | |||||||||
| 72 | } | ||||||||||
| 73 | |||||||||||
| 74 | sub divide { | ||||||||||
| 75 | 0 | ▶ | my ($x, $y) = @_; | ||||||||
|
Subroutine
divide: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 76 | 0 | my $class = ref($x); | |||||||||
| 77 | 0 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 78 | 0 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 79 | 0 | $class->new($x / $y); | |||||||||
| 80 | } | ||||||||||
| 81 | |||||||||||
| 82 | sub modulo { | ||||||||||
| 83 | 0 | ▶ | my ($x, $y) = @_; | ||||||||
|
Subroutine
modulo: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 84 | 0 | my $class = ref($x); | |||||||||
| 85 | 0 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 86 | 0 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 87 | 0 | $class->new($x % $y); | |||||||||
| 88 | } | ||||||||||
| 89 | |||||||||||
| 90 | 1 | 1; | |||||||||