Average Error: 14.7 → 7.6
Time: 6.1s
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 r116091 = x;
        double r116092 = y;
        double r116093 = z;
        double r116094 = r116092 - r116093;
        double r116095 = t;
        double r116096 = r116095 - r116091;
        double r116097 = a;
        double r116098 = r116097 - r116093;
        double r116099 = r116096 / r116098;
        double r116100 = r116094 * r116099;
        double r116101 = r116091 + r116100;
        return r116101;
}

double f(double x, double y, double z, double t, double a) {
        double r116102 = t;
        double r116103 = y;
        double r116104 = z;
        double r116105 = r116103 - r116104;
        double r116106 = 1.0;
        double r116107 = a;
        double r116108 = r116107 - r116104;
        double r116109 = r116106 / r116108;
        double r116110 = r116105 * r116109;
        double r116111 = r116102 * r116110;
        double r116112 = x;
        double r116113 = -r116112;
        double r116114 = r116105 / r116108;
        double r116115 = fma(r116113, r116114, r116112);
        double r116116 = r116111 + r116115;
        return r116116;
}

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