constants.hpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Ifdefs
10 *****************************************************************************/
11 
12 #ifndef ECL_MATH_CONSTANTS_HPP_
13 #define ECL_MATH_CONSTANTS_HPP_
14 
15 /*****************************************************************************
16 ** Includes
17 *****************************************************************************/
18 
19 #include <cmath>
20 
21 /*****************************************************************************
22 ** Namespaces
23 *****************************************************************************/
24 
25 namespace ecl {
26 
27 #ifdef M_PI // defined by all POSIX systems and some non-POSIX ones
28  double const pi = M_PI;
29  const double two_pi = 2.0*pi;
30  const double pi_2 = pi/2.0;
31  const double pi_4 = pi/4.0;
32  const float two_pi_f= two_pi;
33  const float pi_f = pi;
34  const float pi_2_f = pi_2;
35  const float pi_4_f = pi_4;
36 #else
37  double const pi = 4.0*std::atan(1.0);
38  const double two_pi = 2.0*pi;
39  const double pi_2 = pi/2.0;
40  const double pi_4 = pi/4.0;
41  const float two_pi_f= two_pi;
42  const float pi_f = pi;
43  const float pi_2_f = pi_2;
44  const float pi_4_f = pi_4;
45 #endif
46 
47 // Above method of setting is more intelligent.
48 //const double two_pi = 6.283185307179586476925286766559005768394338798750211641949888; /**< @brief Mathematical constant for 2*pi. */
49 //const double pi = 3.141592653589793238462643383279502884197169399375105820974944; /**< @brief Mathematical constant for pi. */
50 //const double pi_2 = 1.57079632679489661923; /**< @brief Mathematical constant for pi/2. */
51 //const double pi_4 = 0.78539816339744830962; /**< @brief Mathematical constant for pi/4. */
52 //const float two_pi_f= 6.283185307179586476925286766559005768394338798750211641949888; /**< @brief Mathematical constant (float format) for 2*pi. */
53 //const float pi_f = 3.141592653589793238462643383279502884197169399375105820974944; /**< @brief Mathematical constant (float format) for pi. */
54 //const float pi_2_f = 1.57079632679489661923; /**< @brief Mathematical constant (float format) for pi/2. */
55 //const float pi_4_f = 0.78539816339744830962; /**< @brief Mathematical constant (float format) for pi/4. */
56 
57 
58 }; // namespace ecl
59 
60 #endif /*ECL_MATH_CONSTANTS_HPP_*/
Embedded control libraries.
double const pi
Mathematical constant for pi.
Definition: constants.hpp:37
const double two_pi
Mathematical constant for 2*pi.
Definition: constants.hpp:38
const float pi_2_f
Mathematical constant (float format) for pi/2.
Definition: constants.hpp:43
const float pi_4_f
Mathematical constant (float format) for pi/4.
Definition: constants.hpp:44
const float pi_f
Mathematical constant (float format) for pi.
Definition: constants.hpp:42
const double pi_4
Mathematical constant for pi/4.
Definition: constants.hpp:40
const float two_pi_f
Mathematical constant (float format) for 2*pi.
Definition: constants.hpp:41
const double pi_2
Mathematical constant for pi/2.
Definition: constants.hpp:39


ecl_math
Author(s): Daniel Stonier
autogenerated on Mon Feb 28 2022 22:18:37