aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-10-15 18:05:46 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-10-15 18:05:46 +0100
commite56f614d40bcc1383c785f7068c8e0053328b0e9 (patch)
treeff88010d66fde94daa7b232908366a0bf07fdce5 /src
parentb78d753f1ee152d92c20662779f8e54462d28be2 (diff)
downloadrspamd-e56f614d40bcc1383c785f7068c8e0053328b0e9.tar.gz
rspamd-e56f614d40bcc1383c785f7068c8e0053328b0e9.zip
[Minor] Some fixes towards epsilon comparison
Diffstat (limited to 'src')
-rw-r--r--src/libmime/filter.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libmime/filter.c b/src/libmime/filter.c
index d2b549251..5f47a5c6a 100644
--- a/src/libmime/filter.c
+++ b/src/libmime/filter.c
@@ -152,6 +152,10 @@ rspamd_check_group_score (struct rspamd_task *task,
return w;
}
+#ifndef DBL_EPSILON
+#define DBL_EPSILON 2.2204460492503131e-16
+#endif
+
static struct rspamd_symbol_result *
insert_metric_result (struct rspamd_task *task,
const gchar *symbol,
@@ -361,21 +365,17 @@ insert_metric_result (struct rspamd_task *task,
}
if (!isnan (final_score)) {
-#ifndef DBL_EPSILON
-#define DBL_EPSILON 2.2204460492503131e-16
-#endif
const double epsilon = DBL_EPSILON;
metric_res->score += final_score;
metric_res->grow_factor = next_gf;
s->score = final_score;
- /* We ignore zero scored symbols */
if (final_score > epsilon) {
metric_res->npositive ++;
metric_res->positive_score += final_score;
}
- else if (final_score < epsilon) {
+ else if (final_score < -epsilon) {
metric_res->nnegative ++;
metric_res->negative_score += fabs (final_score);
}