summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/time-smoother.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2010-09-06 15:22:26 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2010-09-07 12:07:24 +0200
commit2ee7cd15b3cbfbde466b9edb0eb87f6b32a14dbb (patch)
tree0fae04f313b5b2cff5ad6bd64f57f5b5546b8b54 /src/pulsecore/time-smoother.c
parentc36ab6896fd75931531f709844ea7f95c5829228 (diff)
smoother: avoid losing precision
Avoid losing precision by subtracting uint64 values before converting them to doubles.
Diffstat (limited to 'src/pulsecore/time-smoother.c')
-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 1371ad56..0696cabc 100644
--- a/src/pulsecore/time-smoother.c
+++ b/src/pulsecore/time-smoother.c
@@ -320,10 +320,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)));