| 1 | # Copyright 2010, 2011, 2012, 2013, 2014, 2016, 2019, 2020 Kevin Ryde | ||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||
| 3 | # This file is part of Math-NumSeq. | ||||||||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||||||||
| 5 | # Math-NumSeq is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||
| 6 | # it under the terms of the GNU General Public License as published by the | ||||||||||||||||||||||||||||||||||
| 7 | # Free Software Foundation; either version 3, or (at your option) any later | ||||||||||||||||||||||||||||||||||
| 8 | # version. | ||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||
| 10 | # Math-NumSeq is distributed in the hope that it will be useful, but | ||||||||||||||||||||||||||||||||||
| 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||||||||||||||||||||||||||||||||||
| 12 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||||||||||||||||||||||||||||||||||
| 13 | # for more details. | ||||||||||||||||||||||||||||||||||
| 14 | # | ||||||||||||||||||||||||||||||||||
| 15 | # You should have received a copy of the GNU General Public License along | ||||||||||||||||||||||||||||||||||
| 16 | # with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>. | ||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||
| 18 | package Math::NumSeq::Base::Digits; | ||||||||||||||||||||||||||||||||||
| 19 | 15 | ▶ | use 5.004; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 20 | 15 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||
| 22 | 15 | ▶ | use vars '$VERSION', '@ISA', '@EXPORT_OK'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 23 | 15 | $VERSION = 75; | |||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||
| 25 | 15 | ▶ | use Exporter; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 26 | 15 | ▶ | use Math::NumSeq; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 27 | 15 | @ISA = ('Math::NumSeq', 'Exporter'); | |||||||||||||||||||||||||||||||||
| 28 | 15 | @EXPORT_OK = ('parameter_info_array'); | |||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||
| 30 | 8 | ▶ | sub characteristic_digits { | ||||||||||||||||||||||||||||||||
|
Subroutine
characteristic_digits: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 31 | 8 | my ($self) = @_; | |||||||||||||||||||||||||||||||||
| 32 | 8 | return $self->{'radix'}; | |||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||
| 34 | 15 | ▶ | use constant characteristic_increasing => 0; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 35 | # use constant characteristic_non_decreasing => 0; | ||||||||||||||||||||||||||||||||||
| 36 | 15 | ▶ | use constant characteristic_smaller => 1; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 37 | 15 | ▶ | use constant characteristic_integer => 1; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 38 | 15 | ▶ | use constant values_min => 0; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | sub values_max { | ||||||||||||||||||||||||||||||||
|
Subroutine
values_max: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 40 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||
| 41 | 0 | return $self->{'radix'} - 1; | |||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||
| 44 | 15 | ▶ | use constant parameter_common_radix => | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 45 | { name => 'radix', | ||||||||||||||||||||||||||||||||||
| 46 | type => 'integer', | ||||||||||||||||||||||||||||||||||
| 47 | display => Math::NumSeq::__('Radix'), | ||||||||||||||||||||||||||||||||||
| 48 | default => 10, | ||||||||||||||||||||||||||||||||||
| 49 | minimum => 2, | ||||||||||||||||||||||||||||||||||
| 50 | width => 3, | ||||||||||||||||||||||||||||||||||
| 51 | description => Math::NumSeq::__('Radix, ie. base, for the values calculation. Default is decimal (base 10).'), | ||||||||||||||||||||||||||||||||||
| 52 | 15 | }; | |||||||||||||||||||||||||||||||||
| 53 | 15 | ▶ | use constant parameter_info_array => [ parameter_common_radix() ]; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||
| 55 | 104 | ▶ | sub pred { | ||||||||||||||||||||||||||||||||
|
Subroutine
pred: called CC=3 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 56 | 104 | my ($self, $value) = @_; | |||||||||||||||||||||||||||||||||
| 57 | return ($value == int($value) | ||||||||||||||||||||||||||||||||||
| 58 | && $value >= 0 | ||||||||||||||||||||||||||||||||||
| 59 | 104 | ▶ | && $value < $self->{'radix'}); | ||||||||||||||||||||||||||||||||
|
Condition33%2/6
$value == int $value && $value >= 0 && $value < $self->{'radix'}
$value == int $value and $value >= 0
MC/DC0%0/3
$value == int $value && $value >= 0 && $value < $self->{'radix'}
$value == int $value
$value >= 0
$value < $self->{'radix'}
Truth table25%1/4
A and B && C
A= $value == int $valueB= $value >= 0C= $value < $self->{'radix'}
| |||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||
| 62 | 15 | 1; | |||||||||||||||||||||||||||||||||
| 63 | __END__ | ||||||||||||||||||||||||||||||||||