-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath_utility.cpp
73 lines (55 loc) · 1.59 KB
/
math_utility.cpp
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
#include "math_utility.hpp"
bool csce::math_utility::equals(long double a, long double b){
return std::abs(a - b) <= csce::math_utility::EPS;
}
bool csce::math_utility::equals(double a, double b){
return std::abs(a - b) <= csce::math_utility::EPS;
}
bool csce::math_utility::equals(float a, float b){
return std::abs(a - b) <= csce::math_utility::EPS;
}
bool csce::math_utility::equals(int a, int b){
return a == b;
}
bool csce::math_utility::equals(long long int a, long long int b){
return a == b;
}
bool csce::math_utility::equals(short a, short b) {
return a == b;
}
bool csce::math_utility::equals_zero(long double a){
return std::abs(a) <= csce::math_utility::EPS;
}
bool csce::math_utility::equals_zero(double a){
return std::abs(a) <= csce::math_utility::EPS;
}
bool csce::math_utility::equals_zero(float a){
return std::abs(a) <= csce::math_utility::EPS;
}
bool csce::math_utility::equals_zero(int a){
return a == 0;
}
bool csce::math_utility::equals_zero(long long int a){
return a == 0L;
}
bool csce::math_utility::equals_zero(short a) {
return a == 0;
}
bool csce::math_utility::less_than(long double a, long double b) {
return std::abs(a - b) > EPS && a < b;
}
bool csce::math_utility::less_than(double a, double b) {
return std::abs(a - b) > EPS && a < b;
}
bool csce::math_utility::less_than(float a, float b) {
return std::abs(a - b) > EPS && a < b;
}
bool csce::math_utility::less_than(int a, int b) {
return a < b;
}
bool csce::math_utility::less_than(long long int a, long long int b) {
return a < b;
}
bool csce::math_utility::less_than(short a, short b) {
return a < b;
}