From: Paul Brossier Date: Tue, 16 Feb 2016 16:50:19 +0000 (+0100) Subject: src/mathutils.c: use smpl_t for constants X-Git-Tag: 0.4.4~300^2~336 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=6ab6611c26210d823233796d41b61a326ccaa06d;p=aubio.git src/mathutils.c: use smpl_t for constants --- diff --git a/src/mathutils.c b/src/mathutils.c index 7ea6dbfa..513f33b6 100644 --- a/src/mathutils.c +++ b/src/mathutils.c @@ -442,6 +442,7 @@ smpl_t fvec_median (fvec_t * input) { smpl_t fvec_quadratic_peak_pos (fvec_t * x, uint_t pos) { smpl_t s0, s1, s2; uint_t x0, x2; + smpl_t half = .5, two = 2.; if (pos == 0 || pos == x->length - 1) return pos; x0 = (pos < 1) ? pos : pos - 1; x2 = (pos + 1 < x->length) ? pos + 1 : pos; @@ -450,7 +451,7 @@ smpl_t fvec_quadratic_peak_pos (fvec_t * x, uint_t pos) { s0 = x->data[x0]; s1 = x->data[pos]; s2 = x->data[x2]; - return pos + 0.5 * (s0 - s2 ) / (s0 - 2.* s1 + s2); + return pos + half * (s0 - s2 ) / (s0 - two * s1 + s2); } smpl_t fvec_quadratic_peak_mag (fvec_t *x, smpl_t pos) {