blib/lib/PDL/Constants.pm

filter: Statementstmt 100% 30 / 30 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 100% 38 / 38 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« .pptest/sub/Makefile.PL ↑ Summary blib/lib/PDL/Lite.pm »
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<constant> 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 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 our $VERSION = "0.02";
23 2 $VERSION = eval $VERSION;
24  
25 2 require Exporter;
26 2 our @ISA = qw(Exporter);
27 2 our @EXPORT_OK = qw(PI DEGRAD E DEG2RAD RAD2DEG);
28  
29 2 ▶use PDL::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 =head2 PI
32  
33 The ratio of a circle's circumference to its diameter
34  
35 =cut
36  
37 2 ▶use constant PI => 4 * atan2(1, 1);
Subroutine BEGIN: called CC=1 SCAR=0.0
38  
39 =head2 DEGRAD
40  
41 The number of degrees of arc per radian (180/PI)
42  
43 =cut
44  
45 2 ▶use constant DEGRAD => 180/PI;
Subroutine BEGIN: called CC=1 SCAR=0.0
46  
47 =head2 DEG2RAD
48  
49 The constant to convert degrees of arc into radians (PI/180)
50  
51 $radians = DEG2RAD * $degrees;
52  
53 =cut
54  
55 2 ▶use constant DEG2RAD => PI/180;
Subroutine BEGIN: called CC=1 SCAR=0.0
56  
57 =head2 RAD2DEG
58  
59 The constant to convert radians into degrees of arc (180/PI)
60  
61 $degrees = RAD2DEG * $radians;
62  
63 =cut
64  
65 2 ▶use constant RAD2DEG => 180/PI;
Subroutine BEGIN: called CC=1 SCAR=0.0
66  
67 =head2 E
68  
69 The base of the natural logarithms or Euler's number
70  
71 =cut
72  
73 2 ▶use constant E => exp(1);
Subroutine BEGIN: called CC=1 SCAR=0.0
74  
75 =head1 COPYRIGHT & LICENSE
76  
77 Copyright 2010 Chris Marshall (chm at cpan dot org).
78  
79 This program is free software; you can redistribute it and/or modify it
80 under the terms of either: the GNU General Public License as published
81 by the Free Software Foundation; or the Artistic License.
82  
83 See http://dev.perl.org/licenses/ for more information.
84  
85 =cut
86  
87 2 1;
« .pptest/sub/Makefile.PL ↑ Summary blib/lib/PDL/Lite.pm »