aboutsummaryrefslogtreecommitdiffstats
path: root/src/cfg_utils.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-05-27 18:59:02 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-05-27 18:59:02 +0400
commit0dc48ea239965d05b760cb9d8e570e0d91aedb77 (patch)
treedb2d4c9b80a3408d12cb8bf4cfad57d45238abb9 /src/cfg_utils.c
parentac8249b6ee746f022b0753789e6e2b46ab842abc (diff)
downloadrspamd-0dc48ea239965d05b760cb9d8e570e0d91aedb77.tar.gz
rspamd-0dc48ea239965d05b760cb9d8e570e0d91aedb77.zip
* Convert statistic sums to use long double for counters
* Use hyperbolic tangent for internal normalizer
Diffstat (limited to 'src/cfg_utils.c')
-rw-r--r--src/cfg_utils.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/cfg_utils.c b/src/cfg_utils.c
index f72bf51a3..d63e6bc93 100644
--- a/src/cfg_utils.c
+++ b/src/cfg_utils.c
@@ -719,25 +719,16 @@ check_worker_conf (struct config_file *cfg, struct worker_conf *c)
}
static double
-internal_normalizer_func (struct config_file *cfg, double score, void *data)
+internal_normalizer_func (struct config_file *cfg, long double score, void *data)
{
- double max = *(double *)data;
+ long double max = *(double *)data;
if (score < 0) {
return score;
}
- else if (score > 0.001 && score < 1) {
- return 1;
- }
- else if (score > 1 && score < max / 2.) {
- return MIN(max, score * score);
- }
- else if (score < max) {
- return score;
- }
- else if (score > max) {
- return max;
- }
+ else {
+ return max * tanhl (score / max);
+ }
return score;
}