summaryrefslogtreecommitdiff
path: root/protocols/CurrencyRates/src/IsWithinAccuracy.h
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-03-02 12:32:44 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-03-02 12:32:55 +0300
commit931a7dc1ac0dbc7e6c1083583ced915e572f5b47 (patch)
tree9fe9a6448d44030e26aa7107ce16044ed413e0d0 /protocols/CurrencyRates/src/IsWithinAccuracy.h
parentdd7d9954042254e66e3bbbec7195c6be8b1a0663 (diff)
all protocols (even virtual ones) moved to the Protocols folder
Diffstat (limited to 'protocols/CurrencyRates/src/IsWithinAccuracy.h')
-rw-r--r--protocols/CurrencyRates/src/IsWithinAccuracy.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/protocols/CurrencyRates/src/IsWithinAccuracy.h b/protocols/CurrencyRates/src/IsWithinAccuracy.h
new file mode 100644
index 0000000000..558dbb87d3
--- /dev/null
+++ b/protocols/CurrencyRates/src/IsWithinAccuracy.h
@@ -0,0 +1,15 @@
+#ifndef __C8C6FB80_D66B_4382_8FAB_E92C83F77BB8_IsWithinAcuracy_h__
+#define __C8C6FB80_D66B_4382_8FAB_E92C83F77BB8_IsWithinAcuracy_h__
+
+inline bool IsWithinAccuracy(double dValue1, double dValue2, double dAccuracy = 1e-4)
+{
+ double dDifference = dValue1 - dValue2;
+
+ if ((-dAccuracy <= dDifference) && (dDifference <= dAccuracy))
+ return true;
+ else
+ return false;
+}
+
+
+#endif //__C8C6FB80_D66B_4382_8FAB_E92C83F77BB8_IsWithinAcuracy_h__