File Coverage

blib/lib/PDL/Constants.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 24 24 100.0


line stmt bran cond sub pod time code
1             =head1 NAME
2              
3             PDL::Constants -- basic compile time constants for PDL
4              
5             =head1 DESCRIPTION
6              
7             This module is used to define compile time constant
8             values for PDL. It uses Perl's L pragma for
9             simplicity and availability.
10              
11             =head1 SYNOPSIS
12              
13             use PDL::Constants qw(PI E);
14             print 'PI is ' . PI . "\n";
15             print 'E is ' . E . "\n";
16              
17             =cut
18              
19             package PDL::Constants;
20 1     1   135644 use strict;
  1         2  
  1         72  
21 1     1   13 use warnings;
  1         2  
  1         139  
22             our $VERSION = "0.02";
23             $VERSION = eval $VERSION;
24              
25             require Exporter;
26             our @ISA = qw(Exporter);
27             our @EXPORT_OK = qw(PI DEGRAD E I J); # symbols to export
28              
29 1     1   507 use PDL::Lite;
  1         5  
  1         10  
30              
31             =head2 PI
32              
33             The ratio of a circle's circumference to its diameter
34              
35             =cut
36              
37 1     1   8 use constant PI => 4 * atan2(1, 1);
  1         2  
  1         116  
38              
39             =head2 DEGRAD
40              
41             The number of degrees of arc per radian (180/PI)
42              
43             =cut
44              
45 1     1   7 use constant DEGRAD => 180/PI;
  1         2  
  1         63  
46              
47             =head2 E
48              
49             The base of the natural logarithms or Euler's number
50              
51             =cut
52              
53 1     1   6 use constant E => exp(1);
  1         2  
  1         72  
54              
55             =head1 COPYRIGHT & LICENSE
56              
57             Copyright 2010 Chris Marshall (chm at cpan dot org).
58              
59             This program is free software; you can redistribute it and/or modify it
60             under the terms of either: the GNU General Public License as published
61             by the Free Software Foundation; or the Artistic License.
62              
63             See http://dev.perl.org/licenses/ for more information.
64              
65             =cut
66              
67             1;