line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Scalar::Util::Numeric::PP; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2015-06-16'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.03'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
801
|
use 5.010001; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
41
|
|
7
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
31
|
|
8
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
651
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
require Exporter; |
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
12
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
13
|
|
|
|
|
|
|
isint |
14
|
|
|
|
|
|
|
isnum |
15
|
|
|
|
|
|
|
isnan |
16
|
|
|
|
|
|
|
isinf |
17
|
|
|
|
|
|
|
isneg |
18
|
|
|
|
|
|
|
isfloat |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub isint { |
22
|
21
|
|
|
21
|
1
|
65
|
local $_ = shift; |
23
|
21
|
100
|
|
|
|
52
|
return 0 unless defined; |
24
|
20
|
100
|
|
|
|
188
|
return 1 if /\A[+-]?(?:0|[1-9][0-9]*)\z/; |
25
|
13
|
|
|
|
|
44
|
0; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub isnan($) { |
29
|
19
|
|
|
19
|
1
|
32
|
local $_ = shift; |
30
|
19
|
100
|
|
|
|
47
|
return 0 unless defined; |
31
|
18
|
100
|
|
|
|
742
|
return 1 if /\A\s*[+-]?nan\s*\z/i; |
32
|
13
|
|
|
|
|
51
|
0; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub isinf($) { |
36
|
18
|
|
|
18
|
1
|
33
|
local $_ = shift; |
37
|
18
|
100
|
|
|
|
46
|
return 0 unless defined; |
38
|
17
|
100
|
|
|
|
107
|
return 1 if /\A\s*[+-]?inf(?:inity)?\s*\z/i; |
39
|
11
|
|
|
|
|
47
|
0; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub isneg($) { |
43
|
6
|
|
|
6
|
1
|
17
|
local $_ = shift; |
44
|
6
|
100
|
|
|
|
19
|
return 0 unless defined; |
45
|
5
|
100
|
|
|
|
774
|
return 1 if /\A\s*-/; |
46
|
2
|
|
|
|
|
24
|
0; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub isnum($) { |
50
|
14
|
|
|
14
|
1
|
33
|
local $_ = shift; |
51
|
14
|
100
|
|
|
|
67
|
return 0 unless defined; |
52
|
13
|
100
|
|
|
|
27
|
return 1 if isint($_); |
53
|
9
|
100
|
|
|
|
21
|
return 1 if isfloat($_); |
54
|
4
|
|
|
|
|
19
|
0; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub isfloat($) { |
58
|
26
|
|
|
26
|
1
|
49
|
local $_ = shift; |
59
|
26
|
100
|
|
|
|
71
|
return 0 unless defined; |
60
|
25
|
100
|
66
|
|
|
401
|
return 1 if /\A[+-]? |
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
61
|
|
|
|
|
|
|
(?: (?:0|[1-9][0-9]*)(\.[0-9]+)? | (\.[0-9]+) ) |
62
|
|
|
|
|
|
|
([eE][+-]?[0-9]+)?\z/x && $1 || $2 || $3; |
63
|
14
|
100
|
100
|
|
|
34
|
return 1 if isnan($_) || isinf($_); |
64
|
10
|
|
|
|
|
36
|
0; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
68
|
|
|
|
|
|
|
# ABSTRACT: Pure-perl drop-in replacement/approximation of Scalar::Util::Numeric |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__END__ |