| 1 | 53 | ▶ | use strict; use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | package Lingy::Numbers; | ||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | 53 | ▶ | use Lingy::Common; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 10131 | ▶ | sub add { $_[0] + $_[1] } | ||||||||||||||||||
|
Subroutine
add: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 15 | ▶ | sub dec { $_[0] - 1 } | ||||||||||||||||||
|
Subroutine
dec: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 16 | ▶ | sub divide { $_[0] / $_[1] } | ||||||||||||||||||
|
Subroutine
divide: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 0 | ▶ | sub equiv { $_[0] == $_[1] } | ||||||||||||||||||
|
Subroutine
equiv: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 427 | ▶ | sub gt { $_[0] > $_[1] } | ||||||||||||||||||
|
Subroutine
gt: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 248 | ▶ | sub gte { $_[0] >= $_[1] } | ||||||||||||||||||
|
Subroutine
gte: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 18 | ▶ | sub inc { $_[0] + 1 } | ||||||||||||||||||
|
Subroutine
inc: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 250 | ▶ | sub isPos { $_[0] > 0 } | ||||||||||||||||||
|
Subroutine
isPos: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 264 | ▶ | sub isZero { ${$_[0]} == 0 } | ||||||||||||||||||
|
Subroutine
isZero: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 247 | ▶ | sub lt { $_[0] < $_[1] } | ||||||||||||||||||
|
Subroutine
lt: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 23 | ▶ | sub lte { $_[0] <= $_[1] } | ||||||||||||||||||
|
Subroutine
lte: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 20061 | ▶ | sub minus { | ||||||||||||||||||
|
Subroutine
minus: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 29 | @_ == 1 | ||||||||||||||||||||
| 30 | 20061 | ▶ | ? (0 - ${$_[0]}) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 31 | : $_[0] - $_[1]; | ||||||||||||||||||||
| 32 | } | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 24 | ▶ | sub multiply { $_[0] * $_[1] } | ||||||||||||||||||
|
Subroutine
multiply: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 11 | ▶ | sub quotient { NUMBER->new(int($_[0] / $_[1])) } | ||||||||||||||||||
|
Subroutine
quotient: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 3 | ▶ | sub range { | ||||||||||||||||||
|
Subroutine
range: called CC=9 SCAR=22.7
Pod
undocumented
| |||||||||||||||||||||
| 39 | 3 | my ($start, $end, $step) = @_; | |||||||||||||||||||
| 40 | 3 | ▶ | if (not defined $end) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 41 | 0 | $end = $start; | |||||||||||||||||||
| 42 | 0 | $start = NUMBER->new(0); | |||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | 3 | ▶ | $step //= NUMBER->new(1); | ||||||||||||||||||
|
Condition66%2/3
$step //= "Lingy::Number"->new(1)
MC/DC0%0/2
$step //= "Lingy::Number"->new(1)
$step
"Lingy::Number"->new(1)
Truth table66%2/3
A //= B
A= $stepB= "Lingy::Number"->new(1)
| |||||||||||||||||||||
| 45 | 3 | ($start, $end, $step) = ($$start, $$end, $$step); | |||||||||||||||||||
| 46 | 3 | ▶ | return list([]) if $step == 0; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 47 | 3 | my @range; | |||||||||||||||||||
| 48 | 3 | ▶ | if ($step > 0) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 49 | 2 | ▶ | return list([]) if $start > $end; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 50 | 2 | ▶ | while ($start < $end) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 51 | 32 | push @range, NUMBER->new($start); | |||||||||||||||||||
| 52 | 32 | $start += $step; | |||||||||||||||||||
| 53 | } | ||||||||||||||||||||
| 54 | } else { | ||||||||||||||||||||
| 55 | 1 | ▶ | return list([]) if $start < $end; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 56 | 1 | ▶ | while ($start > $end) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 57 | 3 | push @range, NUMBER->new($start); | |||||||||||||||||||
| 58 | 3 | $start += $step; | |||||||||||||||||||
| 59 | } | ||||||||||||||||||||
| 60 | } | ||||||||||||||||||||
| 61 | 3 | list([@range]); | |||||||||||||||||||
| 62 | } | ||||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | 134 | ▶ | sub remainder { | ||||||||||||||||||
|
Subroutine
remainder: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 65 | 134 | $_[0] % $_[1]; | |||||||||||||||||||
| 66 | } | ||||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | 53 | 1; | |||||||||||||||||||