From: Heng Li Date: Thu, 30 Sep 2010 14:12:02 +0000 (+0000) Subject: round to the nearest integer X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=bed4b3da86b4c2c27ae31ad76904d08404bcfb36;p=samtools.git round to the nearest integer --- diff --git a/kaln.c b/kaln.c index b52d73a..9fe7d6f 100644 --- a/kaln.c +++ b/kaln.c @@ -542,7 +542,7 @@ int ka_prob_glocal(const uint8_t *_ref, int l_ref, const uint8_t *_query, int l_ } max /= sum; sum *= s[i]; // if everything works as is expected, sum == 1.0 if (state) state[i-1] = max_k; - if (q) k = -4.343 * log(1. - max), q[i-1] = k > 100? 99 : k; + if (q) k = (int)(-4.343 * log(1. - max) + .499), q[i-1] = k > 100? 99 : k; #ifdef _MAIN fprintf(stderr, "(%.10lg,%.10lg) (%d,%d:%d)~%lg\n", pb, sum, i-1, max_k>>2, max_k&3, max); // DEBUG #endif