Average Error: 14.7 → 7.6
Time: 6.3s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[t \cdot \left(\left(y - z\right) \cdot \frac{1}{a - z}\right) + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
t \cdot \left(\left(y - z\right) \cdot \frac{1}{a - z}\right) + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)
double f(double x, double y, double z, double t, double a) {
        double r115281 = x;
        double r115282 = y;
        double r115283 = z;
        double r115284 = r115282 - r115283;
        double r115285 = t;
        double r115286 = r115285 - r115281;
        double r115287 = a;
        double r115288 = r115287 - r115283;
        double r115289 = r115286 / r115288;
        double r115290 = r115284 * r115289;
        double r115291 = r115281 + r115290;
        return r115291;
}

double f(double x, double y, double z, double t, double a) {
        double r115292 = t;
        double r115293 = y;
        double r115294 = z;
        double r115295 = r115293 - r115294;
        double r115296 = 1.0;
        double r115297 = a;
        double r115298 = r115297 - r115294;
        double r115299 = r115296 / r115298;
        double r115300 = r115295 * r115299;
        double r115301 = r115292 * r115300;
        double r115302 = x;
        double r115303 = -r115302;
        double r115304 = r115295 / r115298;
        double r115305 = fma(r115303, r115304, r115302);
        double r115306 = r115301 + r115305;
        return r115306;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Derivation

  1. Initial program 14.7

    \[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
  2. Simplified14.6

    \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)}\]
  3. Using strategy rm
  4. Applied div-sub14.6

    \[\leadsto \mathsf{fma}\left(y - z, \color{blue}{\frac{t}{a - z} - \frac{x}{a - z}}, x\right)\]
  5. Using strategy rm
  6. Applied div-inv14.6

    \[\leadsto \mathsf{fma}\left(y - z, \frac{t}{a - z} - \color{blue}{x \cdot \frac{1}{a - z}}, x\right)\]
  7. Using strategy rm
  8. Applied fma-udef14.7

    \[\leadsto \color{blue}{\left(y - z\right) \cdot \left(\frac{t}{a - z} - x \cdot \frac{1}{a - z}\right) + x}\]
  9. Simplified11.6

    \[\leadsto \color{blue}{\left(\left(y - z\right) \cdot \frac{1}{a - z}\right) \cdot \left(t - x\right)} + x\]
  10. Using strategy rm
  11. Applied sub-neg11.6

    \[\leadsto \left(\left(y - z\right) \cdot \frac{1}{a - z}\right) \cdot \color{blue}{\left(t + \left(-x\right)\right)} + x\]
  12. Applied distribute-rgt-in11.6

    \[\leadsto \color{blue}{\left(t \cdot \left(\left(y - z\right) \cdot \frac{1}{a - z}\right) + \left(-x\right) \cdot \left(\left(y - z\right) \cdot \frac{1}{a - z}\right)\right)} + x\]
  13. Applied associate-+l+8.3

    \[\leadsto \color{blue}{t \cdot \left(\left(y - z\right) \cdot \frac{1}{a - z}\right) + \left(\left(-x\right) \cdot \left(\left(y - z\right) \cdot \frac{1}{a - z}\right) + x\right)}\]
  14. Simplified7.6

    \[\leadsto t \cdot \left(\left(y - z\right) \cdot \frac{1}{a - z}\right) + \color{blue}{\mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)}\]
  15. Final simplification7.6

    \[\leadsto t \cdot \left(\left(y - z\right) \cdot \frac{1}{a - z}\right) + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)\]

Reproduce

herbie shell --seed 2020001 +o rules:numerics
(FPCore (x y z t a)
  :name "Numeric.Signal:interpolate   from hsignal-0.2.7.1"
  :precision binary64
  (+ x (* (- y z) (/ (- t x) (- a z)))))