smoother: avoid losing precision

Avoid losing precision by subtracting uint64 values before converting them to
doubles.
This commit is contained in:
Wim Taymans 2010-09-06 15:22:26 +02:00
parent c36ab6896f
commit 2ee7cd15b3

View file

@ -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)));