File Coverage

lib/Spreadsheet/Engine/Fn/math.pm
Criterion Covered Total %
statement 23 23 100.0
branch 2 2 100.0
condition n/a
subroutine 9 9 100.0
pod 3 3 100.0
total 37 37 100.0


line stmt bran cond sub pod time code
1             package Spreadsheet::Engine::Fn::math;
2              
3 28     28   183 use strict;
  28         64  
  28         1258  
4 28     28   153 use warnings;
  28         57  
  28         783  
5              
6 28     28   9596 use base 'Spreadsheet::Engine::Fn::base';
  28         119  
  28         7121  
7              
8 28     28   205 use constant PI => atan2(1, 1) * 4;
  28         72  
  28         2576  
9 28     28   157 use constant JULIAN_OFFSET => 2_415_019;
  28         72  
  28         6459  
10              
11 4215     4215 1 12778 sub signature { 'n' }
12 4008     4008   23018 sub _result_type_key { 'oneargnumeric' }
13              
14             sub result_type {
15 5483     5483 1 6815 my $self = shift;
16 5483         14818 return $self->optype($self->_result_type_key => $self->_ops);
17             }
18              
19             sub result {
20 7506     7506 1 9425 my $self = shift;
21 7506         18531 my $type = $self->result_type;
22 7182 100       176121 die $type unless $type->is_num;
23              
24 7106         191445 return Spreadsheet::Engine::Value->new(
25             type => $type->type,
26             value => $self->calculate(map $_->value, $self->_ops),
27             );
28             }
29              
30             1;
31              
32             __END__