-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patharithmeticwith.h
79 lines (51 loc) · 1.34 KB
/
arithmeticwith.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef ARITHMETICWITH_H
#define ARITHMETICWITH_H
// #include <cmath>
#include <concepts>
// #include <quadmath.h>
//template<class N>
//concept SignedNumber = std::is_signed_v<N>
// && std::is_arithmetic<N>
// && std::is_floating_point<N>;
template<typename T, typename N>
concept AddableWith = requires (T x, N y) {
x + x; x + y; y + x; x += y;
};
template<typename T, typename N>
concept SubtractableWith = requires (T x, N y) {
x - x; x - y; y - x; x -= y;
};
template<typename T, typename N>
concept MultipliableWith = requires (T x, N y) {
x * x; x * y; y * x; x *= y;
};
template<typename T, typename N>
concept DivisibleWith = requires (T x, N y) {
x / x; x / y; y / x; x *= y;
};
template<typename T, typename N>
concept ArithmeticWith = AddableWith<T, N>
&& SubtractableWith<T, N>
&& MultipliableWith<T, N>
&& DivisibleWith<T, N>;
using numeric_val = long double;
// using numeric_val = double_t;
// using numeric_val = __float128;
//namespace std {
////numeric_val cos(numeric_val qn) {
//// return cosq(qn);
////}
////numeric_val sin(numeric_val qn) {
//// return sinq(qn);
////}
//numeric_val sqrt(numeric_val qn) {
// return sqrtq(qn);
//}
//numeric_val pow(numeric_val qn1, numeric_val qn2) {
// return powq(qn1, qn2);
//}
////numeric_val exp(numeric_val qn) {
//// return expq(qn);
////}
//}
#endif // ARITHMETICWITH_H