line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Math::Tutor::Role::DecFrac; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1901
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
89
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
App::Math::Tutor::Role::DecFrac - role for decimal fraction numbers |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=cut |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
6
|
use Moo::Role; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
13
|
1
|
|
|
1
|
|
349
|
use App::Math::Tutor::Numbers; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
199
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.004'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
requires "range", "digits"; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _check_decimal_fraction |
20
|
|
|
|
|
|
|
{ |
21
|
230
|
|
|
230
|
|
292
|
my $self = shift; |
22
|
230
|
|
|
|
|
223
|
my ( $minr, $minc, $maxr, $maxc ) = @{ $self->range }; |
|
230
|
|
|
|
|
488
|
|
23
|
230
|
|
|
|
|
349
|
my $digits = $self->digits; |
24
|
230
|
|
|
|
|
668
|
$digits += length( "" . int( $_[0] ) ) + 1; |
25
|
230
|
|
|
|
|
884
|
my $s1 = sprintf( "%.${digits}g", $_[0] ); |
26
|
|
|
|
|
|
|
|
27
|
230
|
|
100
|
|
|
652
|
return ( $minc->( $minr, $_[0] ) |
28
|
|
|
|
|
|
|
and $maxc->( $maxr, $_[0] ) |
29
|
|
|
|
|
|
|
and $s1 == $_[0] |
30
|
|
|
|
|
|
|
and length($s1) >= 3 ); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Copyright 2010-2014 Jens Rehsack. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
38
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
39
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |