Skip to content

Commit 4e85fd6

Browse files
committed
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into feature/Add-map-math-function
2 parents 9770c2b + e450177 commit 4e85fd6

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/src/Helpers/ESPEasy_math.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@
44
#include "../Helpers/StringConverter.h"
55
#endif // ifndef BUILD_NO_DEBUG
66

7-
87
#include <Arduino.h>
98
// Need to include Arduino.h first, then cmath
109
// See: https://github.com/esp8266/Arduino/issues/8922#issuecomment-1542301697
1110
#include <cmath>
1211

1312
#if FEATURE_USE_DOUBLE_AS_ESPEASY_RULES_FLOAT_TYPE
14-
constexpr double ESPEASY_DOUBLE_EPSILON = ESPEASY_DOUBLE_EPSILON_FACTOR * std::numeric_limits<double>::epsilon();
15-
constexpr double ESPEASY_DOUBLE_EPSILON_NEG = -1.0 * ESPEASY_DOUBLE_EPSILON_FACTOR * std::numeric_limits<double>::epsilon();
13+
constexpr double ESPEASY_DOUBLE_EPSILON = ESPEASY_DOUBLE_EPSILON_FACTOR * std::numeric_limits<double>::epsilon();
14+
constexpr double ESPEASY_DOUBLE_EPSILON_NEG = -1.0 * ESPEASY_DOUBLE_EPSILON_FACTOR * std::numeric_limits<double>::epsilon();
1615
#endif
17-
constexpr float ESPEASY_FLOAT_EPSILON = std::numeric_limits<float>::epsilon();
18-
constexpr float ESPEASY_FLOAT_EPSILON_NEG = -1.0f * std::numeric_limits<float>::epsilon();
16+
constexpr float ESPEASY_FLOAT_EPSILON = ESPEASY_FLOAT_EPSILON_FACTOR * std::numeric_limits<float>::epsilon();
17+
constexpr float ESPEASY_FLOAT_EPSILON_NEG = -1.0f * ESPEASY_FLOAT_EPSILON_FACTOR * std::numeric_limits<float>::epsilon();
1918

2019
#if FEATURE_USE_DOUBLE_AS_ESPEASY_RULES_FLOAT_TYPE
2120
int maxNrDecimals_fpType(const double& value)

src/src/Helpers/ESPEasy_math.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
// Internal ESPEasy representation of double values
88
#define ESPEASY_DOUBLE_NR_DECIMALS 14
9-
#define ESPEASY_DOUBLE_EPSILON_FACTOR 1000
9+
#define ESPEASY_DOUBLE_EPSILON_FACTOR 2.0
1010
#define ESPEASY_FLOAT_NR_DECIMALS 6
11-
#define ESPEASY_FLOAT_EPSILON_FACTOR 1000
11+
#define ESPEASY_FLOAT_EPSILON_FACTOR 2.0
1212

1313
#if FEATURE_USE_DOUBLE_AS_ESPEASY_RULES_FLOAT_TYPE
1414
int maxNrDecimals_fpType(const double& value);

0 commit comments

Comments
 (0)