Mercurial > repos > deepakjadmin > mayatool3_test2
comparison lib/Constants.pm @ 0:4816e4a8ae95 draft default tip
Uploaded
author | deepakjadmin |
---|---|
date | Wed, 20 Jan 2016 09:23:18 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4816e4a8ae95 |
---|---|
1 package Constants; | |
2 # | |
3 # $RCSfile: Constants.pm,v $ | |
4 # $Date: 2015/02/28 20:47:02 $ | |
5 # $Revision: 1.21 $ | |
6 # | |
7 # Author: Manish Sud <msud@san.rr.com> | |
8 # | |
9 # Copyright (C) 2015 Manish Sud. All rights reserved. | |
10 # | |
11 # This file is part of MayaChemTools. | |
12 # | |
13 # MayaChemTools is free software; you can redistribute it and/or modify it under | |
14 # the terms of the GNU Lesser General Public License as published by the Free | |
15 # Software Foundation; either version 3 of the License, or (at your option) any | |
16 # later version. | |
17 # | |
18 # MayaChemTools is distributed in the hope that it will be useful, but without | |
19 # any warranty; without even the implied warranty of merchantability of fitness | |
20 # for a particular purpose. See the GNU Lesser General Public License for more | |
21 # details. | |
22 # | |
23 # You should have received a copy of the GNU Lesser General Public License | |
24 # along with MayaChemTools; if not, see <http://www.gnu.org/licenses/> or | |
25 # write to the Free Software Foundation Inc., 59 Temple Place, Suite 330, | |
26 # Boston, MA, 02111-1307, USA. | |
27 # | |
28 | |
29 use strict; | |
30 use Exporter; | |
31 | |
32 use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); | |
33 | |
34 @ISA = qw(Exporter); | |
35 | |
36 # Groups of constants... | |
37 my(@MathConstants) = qw(Pi TwoPi PiByTwo PiByFour InversePi OneByPi SqrtTwoPi OneBySqrtTwoPi InverseSqrtTwoPi Phi E BigNumber); | |
38 | |
39 # Export all constants... | |
40 @EXPORT = (@MathConstants); | |
41 @EXPORT_OK = qw(); | |
42 | |
43 # Tags to export individual groups of constants... | |
44 %EXPORT_TAGS = ( | |
45 math => [@MathConstants], | |
46 all => [@EXPORT, @EXPORT_OK] | |
47 ); | |
48 | |
49 # Math constants.. | |
50 use constant { | |
51 Pi => CORE::atan2(0, -1), | |
52 TwoPi => 2 * CORE::atan2(0, -1), | |
53 PiByTwo => CORE::atan2(1, 0), | |
54 PiByFour => CORE::atan2(1, 1), | |
55 OneByPi => 1.0 / CORE::atan2(0, -1), | |
56 InversePi => 1.0 / CORE::atan2(0, -1), | |
57 SqrtTwoPi => CORE::sqrt(2 * CORE::atan2(0, -1)), | |
58 OneBySqrtTwoPi => 1 / CORE::sqrt(2 * CORE::atan2(0, -1)), | |
59 InverseSqrtTwoPi => 1 / CORE::sqrt(2 * CORE::atan2(0, -1)), | |
60 | |
61 Phi => (1 + CORE::sqrt(5))/2, # Golden ratio... | |
62 | |
63 E => CORE::exp(1), | |
64 | |
65 BigNumber => 2**31 - 1, # Unsigned 31 bit number | |
66 | |
67 }; | |
68 | |
69 1; | |
70 | |
71 __END__ | |
72 | |
73 =head1 NAME | |
74 | |
75 Constants | |
76 | |
77 =head1 SYNOPSIS | |
78 | |
79 use Constants; | |
80 | |
81 use Constants qw(:all); | |
82 | |
83 use Constants qw(:math); | |
84 | |
85 =head1 DESCRIPTION | |
86 | |
87 B<Constants> module provided the following constants: | |
88 | |
89 Pi, TwoPi, PiByTwo, PiByFour, InversePi, OneByPi, SqrtTwoPi, OneBySqrtTwoPi, InverseSqrtTwoPi, | |
90 Phi, E | |
91 | |
92 =head1 AUTHOR | |
93 | |
94 Manish Sud <msud@san.rr.com> | |
95 | |
96 =head1 SEE ALSO | |
97 | |
98 MathUtil.pm | |
99 | |
100 =head1 COPYRIGHT | |
101 | |
102 Copyright (C) 2015 Manish Sud. All rights reserved. | |
103 | |
104 This file is part of MayaChemTools. | |
105 | |
106 MayaChemTools is free software; you can redistribute it and/or modify it under | |
107 the terms of the GNU Lesser General Public License as published by the Free | |
108 Software Foundation; either version 3 of the License, or (at your option) | |
109 any later version. | |
110 | |
111 =cut |