summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2010-09-06 15:22:26 +0200
committerColin Guthrie <cguthrie@mandriva.org>2010-09-14 08:35:52 +0100
commit3d9b710bea79a3663aa7f78a182991e3e1502ecf (patch)
treee4de33f4293085c078bc2891fc427ddd4d7f3737
parenta65825fa45a1c393899eeb1e4532236964ea3a2c (diff)
smoother: avoid losing precision
Avoid losing precision by subtracting uint64 values before converting them to doubles.
-rw-r--r--src/pulsecore/time-smoother.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/pulsecore/time-smoother.c b/src/pulsecore/time-smoother.c
index d6c37878..422f12d4 100644
--- a/src/pulsecore/time-smoother.c
+++ b/src/pulsecore/time-smoother.c
@@ -313,10 +313,8 @@ static void estimate(pa_smoother *s, pa_usec_t x, pa_usec_t *y, double *deriv) {
calc_abc(s);
- tx = (double) x;
-
/* Move to origin */
- tx -= (double) s->ex;
+ tx = (double) (x - s->ex);
/* Horner scheme */
ty = (tx * (s->c + tx * (s->b + tx * s->a)));