File Coverage

lib/Spreadsheet/Engine/Function/INT.pm
Criterion Covered Total %
statement 13 13 100.0
branch 2 2 100.0
condition 3 3 100.0
subroutine 4 4 100.0
pod 1 1 100.0
total 23 23 100.0


line stmt bran cond sub pod time code
1             package Spreadsheet::Engine::Function::INT;
2              
3 28     28   147 use strict;
  28         55  
  28         1060  
4 28     28   149 use warnings;
  28         55  
  28         799  
5              
6 28     28   142 use base 'Spreadsheet::Engine::Fn::math';
  28         65  
  28         4381  
7              
8             sub calculate {
9 192     192 1 5914 my ($self, $value) = @_;
10 192         350 my $result = int $value;
11              
12             # round negatives towards minus infinity
13 192 100 100     692 $result-- if $value < 0 and $result != $value;
14 192         4095 return $result;
15             }
16              
17             1;
18              
19             __END__