QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
mathconstants.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2010 StatPro Italia srl
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20#ifndef quantlib_math_constants_hpp
21#define quantlib_math_constants_hpp
22
23#include <cmath>
24
25#ifndef M_E
26 #define M_E 2.71828182845904523536
27#endif
28
29#ifndef M_LOG2E
30 #define M_LOG2E 1.44269504088896340736
31#endif
32
33#ifndef M_LOG10E
34 #define M_LOG10E 0.434294481903251827651
35#endif
36
37#ifndef M_IVLN10
38 #define M_IVLN10 0.434294481903251827651
39#endif
40
41#ifndef M_LN2
42 #define M_LN2 0.693147180559945309417
43#endif
44
45#ifndef M_LOG2_E
46 #define M_LOG2_E 0.693147180559945309417
47#endif
48
49#ifndef M_LN10
50 #define M_LN10 2.30258509299404568402
51#endif
52
53#ifndef M_PI
54# define M_PI 3.141592653589793238462643383280
55#endif
56
57#ifndef M_TWOPI
58 #define M_TWOPI (M_PI * 2.0)
59#endif
60
61#ifndef M_PI_2
62 #define M_PI_2 1.57079632679489661923
63#endif
64
65#ifndef M_PI_4
66 #define M_PI_4 0.785398163397448309616
67#endif
68
69#ifndef M_3PI_4
70 #define M_3PI_4 2.3561944901923448370E0
71#endif
72
73#ifndef M_SQRTPI
74 #define M_SQRTPI 1.77245385090551602792981
75#endif
76
77#ifndef M_1_PI
78 #define M_1_PI 0.318309886183790671538
79#endif
80
81#ifndef M_2_PI
82 #define M_2_PI 0.636619772367581343076
83#endif
84
85#ifndef M_1_SQRTPI
86 #define M_1_SQRTPI 0.564189583547756286948
87#endif
88
89#ifndef M_2_SQRTPI
90 #define M_2_SQRTPI 1.12837916709551257390
91#endif
92
93#ifndef M_SQRT2
94 #define M_SQRT2 1.41421356237309504880
95#endif
96
97#ifndef M_SQRT_2
98 #define M_SQRT_2 0.7071067811865475244008443621048490392848359376887
99#endif
100
101#ifndef M_SQRT1_2
102 #define M_SQRT1_2 0.7071067811865475244008443621048490392848359376887
103#endif
104
105#ifndef M_LN2LO
106 #define M_LN2LO 1.9082149292705877000E-10
107#endif
108
109#ifndef M_LN2HI
110 #define M_LN2HI 6.9314718036912381649E-1
111#endif
112
113#ifndef M_SQRT3
114 #define M_SQRT3 1.73205080756887719000
115#endif
116
117#ifndef M_INVLN2
118 #define M_INVLN2 1.4426950408889633870E0
119#endif
120
121/* This should ensure that no macro are redefined if we happen to
122 include <math.h> again, whether or not we're using our macros
123 or theirs. We can't know in advance, since it depends on the
124 order of inclusion of headers in client code. */
125#ifdef _MSC_VER
126 #undef _USE_MATH_DEFINES
127#endif
128
129#endif
130