Pothos  0.3.0-ga8f2d4e2
The Pothos dataflow programming software suite
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
MathCompat.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 #include <Pothos/Config.hpp>
13 
14 #include <cmath>
15 
16 #if defined(_MSC_VER) && (_MSC_VER < 1800)
17 
18 namespace std
19 {
20  template <typename T>
21  T round(const T x)
22  {
23  return (x < T(0.0)) ? std::ceil(x - T(0.5)) : std::floor(x + T(0.5));
24  }
25 
26  template <typename T>
27  long int lround(const T x)
28  {
29  return (long int)((x < T(0.0)) ? (x - T(0.5)) : (x + T(0.5)));
30  }
31 
32  template <typename T>
33  long long int llround(const T x)
34  {
35  return (long long int)((x < T(0.0)) ? (x - T(0.5)) : (x + T(0.5)));
36  }
37 
38  template <typename T>
39  T log2(const T x)
40  {
41  return std::log(x)/std::log(2.0);
42  }
43 }
44 
45 #endif