line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package oEdtk::FPField;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
726
|
use strict;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
7
|
use base 'oEdtk::Field';
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
333
|
|
7
|
|
|
|
|
|
|
our $VERSION = 0.01;
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new {
|
10
|
0
|
|
|
0
|
0
|
|
my ($class, $name, $ilen, $flen) = @_;
|
11
|
|
|
|
|
|
|
|
12
|
0
|
0
|
|
|
|
|
$flen = 0 if (!(defined $flen));
|
13
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new($name, $ilen + $flen);
|
14
|
0
|
|
|
|
|
|
$self->{'intlen'} = $ilen;
|
15
|
0
|
|
|
|
|
|
$self->{'fraclen'} = $flen;
|
16
|
0
|
|
|
|
|
|
return $self;
|
17
|
|
|
|
|
|
|
}
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub process {
|
20
|
0
|
|
|
0
|
0
|
|
my ($self, $data) = @_;
|
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
$data =~ s/\s+//g;
|
23
|
0
|
|
|
|
|
|
my $flen = $self->{'fraclen'};
|
24
|
0
|
0
|
|
|
|
|
return $data if $data eq '';
|
25
|
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
|
if ($data !~ /\./) {
|
27
|
0
|
|
|
|
|
|
$data /= 10 ** $flen;
|
28
|
|
|
|
|
|
|
}
|
29
|
0
|
|
|
|
|
|
return sprintf("%.${flen}f", $data);
|
30
|
|
|
|
|
|
|
}
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1;
|