Average Error: 14.5 → 11.5
Time: 20.6s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.065198081982860996989152359302888484807 \cdot 10^{170}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - \frac{t \cdot y}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t - x\right) \cdot \frac{y - z}{a - z} + x\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le -2.065198081982860996989152359302888484807 \cdot 10^{170}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - \frac{t \cdot y}{z}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y - z}{a - z} + x\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r69746 = x;
        double r69747 = y;
        double r69748 = z;
        double r69749 = r69747 - r69748;
        double r69750 = t;
        double r69751 = r69750 - r69746;
        double r69752 = a;
        double r69753 = r69752 - r69748;
        double r69754 = r69751 / r69753;
        double r69755 = r69749 * r69754;
        double r69756 = r69746 + r69755;
        return r69756;
}

double f(double x, double y, double z, double t, double a) {
        double r69757 = z;
        double r69758 = -2.065198081982861e+170;
        bool r69759 = r69757 <= r69758;
        double r69760 = x;
        double r69761 = r69760 / r69757;
        double r69762 = y;
        double r69763 = t;
        double r69764 = r69763 * r69762;
        double r69765 = r69764 / r69757;
        double r69766 = r69763 - r69765;
        double r69767 = fma(r69761, r69762, r69766);
        double r69768 = r69763 - r69760;
        double r69769 = r69762 - r69757;
        double r69770 = a;
        double r69771 = r69770 - r69757;
        double r69772 = r69769 / r69771;
        double r69773 = r69768 * r69772;
        double r69774 = r69773 + r69760;
        double r69775 = r69759 ? r69767 : r69774;
        return r69775;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Derivation

  1. Split input into 2 regimes
  2. if z < -2.065198081982861e+170

    1. Initial program 28.4

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

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

      \[\leadsto \color{blue}{\frac{t - x}{a - z} \cdot \left(y - z\right) + x}\]
    5. Using strategy rm
    6. Applied div-inv28.5

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

      \[\leadsto \color{blue}{\left(t - x\right) \cdot \left(\frac{1}{a - z} \cdot \left(y - z\right)\right)} + x\]
    8. Simplified22.7

      \[\leadsto \left(t - x\right) \cdot \color{blue}{\frac{y - z}{a - z}} + x\]
    9. Taylor expanded around inf 25.3

      \[\leadsto \color{blue}{\left(\frac{x \cdot y}{z} + t\right) - \frac{t \cdot y}{z}}\]
    10. Simplified22.1

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

    if -2.065198081982861e+170 < z

    1. Initial program 12.7

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

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

      \[\leadsto \color{blue}{\frac{t - x}{a - z} \cdot \left(y - z\right) + x}\]
    5. Using strategy rm
    6. Applied div-inv12.7

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

      \[\leadsto \color{blue}{\left(t - x\right) \cdot \left(\frac{1}{a - z} \cdot \left(y - z\right)\right)} + x\]
    8. Simplified10.0

      \[\leadsto \left(t - x\right) \cdot \color{blue}{\frac{y - z}{a - z}} + x\]
  3. Recombined 2 regimes into one program.
  4. Final simplification11.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -2.065198081982860996989152359302888484807 \cdot 10^{170}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - \frac{t \cdot y}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t - x\right) \cdot \frac{y - z}{a - z} + x\\ \end{array}\]

Reproduce

herbie shell --seed 2019306 +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)))))