src/math.h

changeset 18
918b6c0f8b5b
equal deleted inserted replaced
17:a5111f4e6412 18:918b6c0f8b5b
1 #pragma once
2 #include <cmath>
3
4 namespace math
5 {
6 using std::abs;
7 using std::sqrt;
8 using std::sin;
9 using std::cos;
10 using std::tan;
11 using std::atan;
12 using std::atan2;
13 using std::acos;
14 using std::asin;
15 using std::exp;
16 using std::log;
17 using std::log10;
18 using std::hypot;
19 using std::min;
20 using std::max;
21 using std::floor;
22 using std::ceil;
23 using std::trunc;
24 using std::round;
25 template<typename T, typename... Rest>
26 auto hypot(T&& x, Rest&&... rest)
27 {
28 return math::hypot(x, math::hypot(rest...));
29 }
30 template<typename T, typename... Rest>
31 auto max(T&& x, Rest&&... rest)
32 {
33 return math::max(x, math::max(rest...));
34 }
35 template<typename T, typename... Rest>
36 auto min(T&& x, Rest&&... rest)
37 {
38 return math::min(x, math::min(rest...));
39 }
40 constexpr double infinity = std::numeric_limits<double>::infinity();
41 constexpr double pi = M_PIl;
42 }

mercurial