vSMC
vSMC: Scalable Monte Carlo
constants.hpp
Go to the documentation of this file.
1 //============================================================================
2 // vSMC/include/vsmc/math/constants.hpp
3 //----------------------------------------------------------------------------
4 // vSMC: Scalable Monte Carlo
5 //----------------------------------------------------------------------------
6 // Copyright (c) 2013,2014, Yan Zhou
7 // All rights reserved.
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are met:
11 //
12 // Redistributions of source code must retain the above copyright notice,
13 // this list of conditions and the following disclaimer.
14 //
15 // Redistributions in binary form must reproduce the above copyright notice,
16 // this list of conditions and the following disclaimer in the documentation
17 // and/or other materials provided with the distribution.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
20 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 // POSSIBILITY OF SUCH DAMAGE.
30 //============================================================================
31 
32 #ifndef VSMC_MATH_CONSTANTS_HPP
33 #define VSMC_MATH_CONSTANTS_HPP
34 
35 #define VSMC_DEFINE_MATH_CONSTANTS(name, val) \
36 template <typename T> inline T name () {return static_cast<T>(val##l);} \
37 template <> inline float name <float> () {return val##f;} \
38 template <> inline double name <double> () {return val;} \
39 template <> inline long double name <long double> () {return val##l;}
40 
41 namespace vsmc {
42 
43 namespace math {
44 
48  3.141592653589793238462643383279502884197)
49 
53  6.283185307179586476925286766559005768394)
54 
58  0.3183098861837906715377675267450287240689)
59 
63  9.869604401089358618834490999876151135314)
64 
68  1.570796326794896619231321691639751442099)
69 
73  1.047197551196597746154214461093167628066)
74 
78  0.7853981633974483096156608458198757210493)
79 
83  0.5235987755982988730771072305465838140329)
84 
88  2.094395102393195492308428922186335256131)
89 
93  2.356194490192344928846982537459627163148)
94 
98  4.188790204786390984616857844372670512263)
99 
103  1.772453850905516027298167483341145182798)
104 
108  2.506628274631000502415765284811045253007)
109 
113  0.5641895835477562869480794515607725858441)
114 
118  1.253314137315500251207882642405522626503)
119 
123  1.023326707946488488479551624889264860707)
124 
128  0.8862269254527580136490837416705725913988)
129 
133  0.7236012545582676593630146272907957678721)
134 
138  1.447202509116535318726029254581591535744)
139 
143  1.534990061919732732719327437333897291061)
144 
148  2.046653415892976976959103249778529721415)
149 
153  1.144729885849400174143427351353058711647)
154 
158  1.837877066409345483560659472811235279723)
159 
163  0.4515827052894548647261952298948821435718)
164 
168  0.04611759718129048274818211443053300699980)
169 
173  -0.2415644752704904446910368915632944245037)
174 
178  -0.6470295833786548266690500070276435610757)
179 
183  0.7392647777412357921654142358887095750753)
184 
188  0.8570478133976192467042083453592312801438)
189 
193  1.432411958301181101582646357346886143151)
194 
198  2.718281828459045235360287471352662497757)
199 
203  0.3678794411714423215955237701614608674458)
204 
208  1.648721270700128146848650787814163571654)
209 
213  0.6065306597126334236037995349911804534419)
214 
218  1.414213562373095048801688724209698078570)
219 
223  1.732050807568877293527446341505872366943)
224 
228  2.236067977499789696409173668731276235441)
229 
233  3.162277660168379331998893544432718533720)
234 
238  0.7071067811865475244008443621048490392848)
239 
243  0.5773502691896257645091487805019574556476)
244 
248  0.4472135954999579392818347337462552470881)
249 
253  0.3162277660168379331998893544432718533720)
254 
258  0.6931471805599453094172321214581765680755)
259 
263  1.098612288668109691395245236922525704647)
264 
268  1.609437912434100374600759333226187639526)
269 
273  2.302585092994045684017991454684364207601)
274 
278  1.442695040888963407359924681001892137427)
279 
283  0.9102392266268373936142401657361070006126)
284 
288  0.6213349345596118107071993881805725841234)
289 
293  0.4342944819032518276511289189166050822944)
294 
298  -0.3665129205816643270124391582326694694543)
299 
300 } // namespace vsmc::math
301 
302 } // namespace vsmc
303 
304 #endif // VSMC_MATH_CONSTANTS_HPP
T sqrt_pi_2by3()
Definition: constants.hpp:138
Definition: adapter.hpp:37
T sqrt_1by3()
Definition: constants.hpp:243
T sqrt_pi_by6()
Definition: constants.hpp:133
T sqrt_pi_by2()
Definition: constants.hpp:118
T pi_by4()
Definition: constants.hpp:78
T sqrt_pi_2()
Definition: constants.hpp:108
T pi_sqr()
Definition: constants.hpp:63
T sqrt_pi_inv()
Definition: constants.hpp:113
T pi_by3()
Definition: constants.hpp:73
T pi_by6()
Definition: constants.hpp:83
#define VSMC_DEFINE_MATH_CONSTANTS(name, val)
Definition: constants.hpp:35
T sqrt_e_inv()
Definition: constants.hpp:213
T sqrt_pi_4by3()
Definition: constants.hpp:148
T pi_by2()
Definition: constants.hpp:68
T sqrt_1by10()
Definition: constants.hpp:253
T sqrt_pi()
Definition: constants.hpp:103
T pi_3by4()
Definition: constants.hpp:93
T sqrt_pi_3by4()
Definition: constants.hpp:143
T pi_4by3()
Definition: constants.hpp:98
T ln_inv_10()
Definition: constants.hpp:293
T ln_pi_by3()
Definition: constants.hpp:168
T ln_inv_5()
Definition: constants.hpp:288
T ln_pi_2by3()
Definition: constants.hpp:183
T ln_pi_by6()
Definition: constants.hpp:178
T sqrt_pi_by4()
Definition: constants.hpp:128
T sqrt_pi_by3()
Definition: constants.hpp:123
T sqrt_1by2()
Definition: constants.hpp:238
T pi_inv()
Definition: constants.hpp:58
T ln_pi_2()
Definition: constants.hpp:158
T ln_inv_3()
Definition: constants.hpp:283
T ln_pi_by2()
Definition: constants.hpp:163
T ln_inv_2()
Definition: constants.hpp:278
T sqrt_10()
Definition: constants.hpp:233
T ln_ln_2()
Definition: constants.hpp:298
T ln_pi_4by3()
Definition: constants.hpp:193
T sqrt_1by5()
Definition: constants.hpp:248
T ln_pi_by4()
Definition: constants.hpp:173
T ln_pi_3by4()
Definition: constants.hpp:188
T pi_2by3()
Definition: constants.hpp:88