Line data Source code
1 : ! ***********************************************************************
2 : !
3 : ! Copyright (C) 2010-2019 The MESA Team
4 : !
5 : ! This program is free software: you can redistribute it and/or modify
6 : ! it under the terms of the GNU Lesser General Public License
7 : ! as published by the Free Software Foundation,
8 : ! either version 3 of the License, or (at your option) any later version.
9 : !
10 : ! This program is distributed in the hope that it will be useful,
11 : ! but WITHOUT ANY WARRANTY; without even the implied warranty of
12 : ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 : ! See the GNU Lesser General Public License for more details.
14 : !
15 : ! You should have received a copy of the GNU Lesser General Public License
16 : ! along with this program. If not, see <https://www.gnu.org/licenses/>.
17 : !
18 : ! ***********************************************************************
19 :
20 : module math_pown
21 :
22 : use const_def, only: dp
23 :
24 : implicit none
25 :
26 : interface powm1
27 : module procedure powm1_
28 : end interface powm1
29 :
30 : interface pow2
31 : module procedure pow2_
32 : end interface pow2
33 :
34 : interface pow3
35 : module procedure pow3_
36 : end interface pow3
37 :
38 : interface pow4
39 : module procedure pow4_
40 : end interface pow4
41 :
42 : interface pow5
43 : module procedure pow5_
44 : end interface pow5
45 :
46 : interface pow6
47 : module procedure pow6_
48 : end interface pow6
49 :
50 : interface pow7
51 : module procedure pow7_
52 : end interface pow7
53 :
54 : interface pow8
55 : module procedure pow8_
56 : end interface pow8
57 :
58 : private
59 :
60 : public :: powm1, pow2, pow3, pow4, pow5, pow6, pow7, pow8
61 :
62 : contains
63 :
64 111989504 : elemental function powm1_ (x) result (powm1_x)
65 :
66 : real(dp), intent(in) :: x
67 : real(dp) :: powm1_x
68 :
69 111989504 : powm1_x = 1.0_dp / x
70 :
71 111989504 : end function powm1_
72 :
73 :
74 136553549 : elemental function pow2_ (x) result (pow2_x)
75 :
76 : real(dp), intent(in) :: x
77 : real(dp) :: pow2_x
78 :
79 136553549 : pow2_x = x*x
80 :
81 136553549 : end function pow2_
82 :
83 :
84 97254399 : elemental function pow3_ (x) result (pow3_x)
85 :
86 : real(dp), intent(in) :: x
87 : real(dp) :: pow3_x
88 :
89 97254399 : pow3_x = x*x*x
90 :
91 97254399 : end function pow3_
92 :
93 :
94 14775242 : elemental function pow4_ (x) result (pow4_x)
95 :
96 : real(dp), intent(in) :: x
97 : real(dp) :: pow4_x
98 :
99 14775242 : pow4_x = x*x*x*x
100 :
101 14775242 : end function pow4_
102 :
103 :
104 7468887 : elemental function pow5_ (x) result (pow5_x)
105 :
106 : real(dp), intent(in) :: x
107 : real(dp) :: pow5_x
108 :
109 7468887 : pow5_x = x*x*x*x*x
110 :
111 7468887 : end function pow5_
112 :
113 :
114 23 : elemental function pow6_ (x) result (pow6_x)
115 :
116 : real(dp), intent(in) :: x
117 : real(dp) :: pow6_x
118 :
119 23 : pow6_x = x*x*x*x*x*x
120 :
121 23 : end function pow6_
122 :
123 :
124 5 : elemental function pow7_ (x) result (pow7_x)
125 :
126 : real(dp), intent(in) :: x
127 : real(dp) :: pow7_x
128 :
129 5 : pow7_x = x*x*x*x*x*x*x
130 :
131 5 : end function pow7_
132 :
133 :
134 3 : elemental function pow8_ (x) result (pow8_x)
135 :
136 : real(dp), intent(in) :: x
137 : real(dp) :: pow8_x
138 :
139 3 : pow8_x = x*x*x*x*x*x*x*x
140 :
141 3 : end function pow8_
142 :
143 : end module math_pown
|