Average Error: 14.2 → 11.4
Time: 20.1s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -2.145869478761536680500210929593317634387 \cdot 10^{-21}:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{\frac{a - z}{t - x}}, y - z, x\right)\\ \mathbf{elif}\;a \le 9.245984676792925009764001853570344430799 \cdot 10^{-181}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - \frac{y \cdot t}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t - x}{\frac{a - z}{y - z}} + x\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -2.145869478761536680500210929593317634387 \cdot 10^{-21}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\frac{a - z}{t - x}}, y - z, x\right)\\

\mathbf{elif}\;a \le 9.245984676792925009764001853570344430799 \cdot 10^{-181}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - \frac{y \cdot t}{z}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{t - x}{\frac{a - z}{y - z}} + x\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r119589 = x;
        double r119590 = y;
        double r119591 = z;
        double r119592 = r119590 - r119591;
        double r119593 = t;
        double r119594 = r119593 - r119589;
        double r119595 = a;
        double r119596 = r119595 - r119591;
        double r119597 = r119594 / r119596;
        double r119598 = r119592 * r119597;
        double r119599 = r119589 + r119598;
        return r119599;
}

double f(double x, double y, double z, double t, double a) {
        double r119600 = a;
        double r119601 = -2.1458694787615367e-21;
        bool r119602 = r119600 <= r119601;
        double r119603 = 1.0;
        double r119604 = z;
        double r119605 = r119600 - r119604;
        double r119606 = t;
        double r119607 = x;
        double r119608 = r119606 - r119607;
        double r119609 = r119605 / r119608;
        double r119610 = r119603 / r119609;
        double r119611 = y;
        double r119612 = r119611 - r119604;
        double r119613 = fma(r119610, r119612, r119607);
        double r119614 = 9.245984676792925e-181;
        bool r119615 = r119600 <= r119614;
        double r119616 = r119607 / r119604;
        double r119617 = r119611 * r119606;
        double r119618 = r119617 / r119604;
        double r119619 = r119606 - r119618;
        double r119620 = fma(r119616, r119611, r119619);
        double r119621 = r119605 / r119612;
        double r119622 = r119608 / r119621;
        double r119623 = r119622 + r119607;
        double r119624 = r119615 ? r119620 : r119623;
        double r119625 = r119602 ? r119613 : r119624;
        return r119625;
}

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 3 regimes
  2. if a < -2.1458694787615367e-21

    1. Initial program 8.6

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

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

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

    if -2.1458694787615367e-21 < a < 9.245984676792925e-181

    1. Initial program 23.0

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

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

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

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

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

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

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

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

    if 9.245984676792925e-181 < a

    1. Initial program 11.5

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

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

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

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

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

      \[\leadsto \left(t - x\right) \cdot \color{blue}{\frac{y - z}{a - z}} + x\]
    9. Using strategy rm
    10. Applied clear-num9.2

      \[\leadsto \left(t - x\right) \cdot \color{blue}{\frac{1}{\frac{a - z}{y - z}}} + x\]
    11. Using strategy rm
    12. Applied *-un-lft-identity9.2

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

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

      \[\leadsto 1 \cdot \color{blue}{\frac{t - x}{\frac{a - z}{y - z}}} + x\]
  3. Recombined 3 regimes into one program.
  4. Final simplification11.4

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

Reproduce

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