line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Sah::Format::perl::sci2dec; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2016-06-17'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.001'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
1839
|
use 5.010001; |
|
1
|
|
|
|
|
4
|
|
7
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
8
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
93
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub format { |
11
|
1
|
|
|
1
|
0
|
10
|
my %args = @_; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
|
|
1
|
my $dt = $args{data_term}; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
2
|
my $res = {}; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
3
|
$res->{expr} = join( |
18
|
|
|
|
|
|
|
"", |
19
|
|
|
|
|
|
|
"!defined($dt) ? $dt : ", |
20
|
|
|
|
|
|
|
"$dt =~ /\\A(?:[+-]?)(?:\\d+\\.|\\d*\\.(\\d+))[eE]([+-]?\\d+)\\z/ ? do { my \$n = length(\$1 || '') - \$2; \$n=0 if \$n<0; sprintf \"%.\${n}f\", $dt } : ", |
21
|
|
|
|
|
|
|
$dt, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
3
|
$res; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
# ABSTRACT: Format scientific notation number as decimal number |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |