line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SVG::Estimate::Role::Round; |
2
|
|
|
|
|
|
|
$SVG::Estimate::Role::Round::VERSION = '1.0113'; |
3
|
37
|
|
|
37
|
|
294664
|
use strict; |
|
37
|
|
|
|
|
201
|
|
|
37
|
|
|
|
|
1077
|
|
4
|
37
|
|
|
37
|
|
207
|
use Moo::Role; |
|
37
|
|
|
|
|
86
|
|
|
37
|
|
|
|
|
203
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
SVG::Estimate::Role::Round - Round to the nearest thousandth |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
version 1.0113 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 METHODS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head2 round ( value [, significant ] ) |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Rounds to the nearest 1000th of a unit unless you specify a different significant digit. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub round { |
23
|
149
|
|
|
149
|
1
|
39517
|
my ($self, $value, $significant) = @_; |
24
|
149
|
50
|
|
|
|
330
|
unless (defined $significant) { |
25
|
149
|
|
|
|
|
186
|
$significant = 3; |
26
|
|
|
|
|
|
|
} |
27
|
149
|
|
|
|
|
1863
|
return sprintf '%.'.$significant.'f', $value; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |