blib/lib/Math/Business/BlackScholes/Binaries/Greeks/Math.pm untested

filter: Statementstmt 0.0% 0 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 26 CC 1 SCAR 6.9
CC
1
Cov
0%
dgauss
2.0
ddgauss
2.0
BEGIN
2.0
CRAP 2.0
1 package Math::Business::BlackScholes::Binaries::Greeks::Math;
2 use strict; use warnings;
3  
4 our $VERSION = '0.04';
5  
6 =head1 NAME
7  
8 BOM::Utility::Math::Routines
9  
10 =head1 DESCRIPTION
11  
12 Misc math routines.
13  
14 =cut
15  
16 use base qw( Exporter );
17 our @EXPORT_OK = qw( ddgauss dgauss );
18  
19 =head2 dgauss
20  
21 normal density
22  
23 =cut
24  
25 use constant PI => 4 * atan2(1, 1);
26  
27 sub dgauss {
28 my $x = shift;
29  
30 return exp(-1 * $x * $x / 2) / (2 * PI)**0.5;
31 }
32  
33 =head2 ddgauss
34  
35 dnormal density
36  
37 =cut
38  
39 sub ddgauss {
40 my $x = shift;
41  
42 return -1 * $x * dgauss($x);
43 }
44  
45 1;