diff options
author | Josh Allen <josh@allensw.com> | 2017-04-09 08:51:29 -0400 |
---|---|---|
committer | Josh Allen <josh@allensw.com> | 2017-04-09 08:51:29 -0400 |
commit | 8dee94008fec1506a3a2f58292a45e1f93b6d333 (patch) | |
tree | 30d0b8c50414c60b1d76f83e58dab401f3a0c8a1 | |
parent | 7686ad97d5f2542338f88e6f6e8055953609651c (diff) | |
download | libsurvive-8dee94008fec1506a3a2f58292a45e1f93b6d333.tar.gz libsurvive-8dee94008fec1506a3a2f58292a45e1f93b6d333.tar.bz2 |
should be absolute valuetau_test
if statement should not be combined
-rw-r--r-- | src/survive_data.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/survive_data.c b/src/survive_data.c index 8d115fd..22ce8c2 100644 --- a/src/survive_data.c +++ b/src/survive_data.c @@ -125,12 +125,14 @@ uint8_t remove_outliers(SurviveObject *so) { // uint8_t removed_outliers = 0; - uint32_t d1 = *min - mean; - uint32_t d2 = *max - mean; + uint32_t d1 = abs(*min - mean); + uint32_t d2 = abs(*max - mean); - if (d1>d2 && d1>tau_test) { - *min = 0; - return 1; + if (d1>d2) { + if (d1 > tau_test) { + *min = 0; + return 1; + } } else if (d2>tau_test) { *max = 0; |