Average Error: 14.9 → 7.5
Time: 21.2s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -9.761624435913419480839438189484770858705 \cdot 10^{-143}:\\ \;\;\;\;\left(x - \frac{y - z}{a - z} \cdot x\right) + \frac{y - z}{a - z} \cdot t\\ \mathbf{elif}\;a \le 2.406524337071742095706715807006424376958 \cdot 10^{-201}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - y \cdot \frac{t}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y - z}{a - z} \cdot x\right) + \frac{y - z}{a - z} \cdot t\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -9.761624435913419480839438189484770858705 \cdot 10^{-143}:\\
\;\;\;\;\left(x - \frac{y - z}{a - z} \cdot x\right) + \frac{y - z}{a - z} \cdot t\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r4068517 = x;
        double r4068518 = y;
        double r4068519 = z;
        double r4068520 = r4068518 - r4068519;
        double r4068521 = t;
        double r4068522 = r4068521 - r4068517;
        double r4068523 = a;
        double r4068524 = r4068523 - r4068519;
        double r4068525 = r4068522 / r4068524;
        double r4068526 = r4068520 * r4068525;
        double r4068527 = r4068517 + r4068526;
        return r4068527;
}

double f(double x, double y, double z, double t, double a) {
        double r4068528 = a;
        double r4068529 = -9.76162443591342e-143;
        bool r4068530 = r4068528 <= r4068529;
        double r4068531 = x;
        double r4068532 = y;
        double r4068533 = z;
        double r4068534 = r4068532 - r4068533;
        double r4068535 = r4068528 - r4068533;
        double r4068536 = r4068534 / r4068535;
        double r4068537 = r4068536 * r4068531;
        double r4068538 = r4068531 - r4068537;
        double r4068539 = t;
        double r4068540 = r4068536 * r4068539;
        double r4068541 = r4068538 + r4068540;
        double r4068542 = 2.406524337071742e-201;
        bool r4068543 = r4068528 <= r4068542;
        double r4068544 = r4068531 / r4068533;
        double r4068545 = r4068539 / r4068533;
        double r4068546 = r4068532 * r4068545;
        double r4068547 = r4068539 - r4068546;
        double r4068548 = fma(r4068544, r4068532, r4068547);
        double r4068549 = r4068543 ? r4068548 : r4068541;
        double r4068550 = r4068530 ? r4068541 : r4068549;
        return r4068550;
}

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 a < -9.76162443591342e-143 or 2.406524337071742e-201 < a

    1. Initial program 12.5

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

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

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

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

      \[\leadsto \color{blue}{\frac{y - z}{a - z} \cdot \left(t - x\right)} + x\]
    8. Using strategy rm
    9. Applied sub-neg10.0

      \[\leadsto \frac{y - z}{a - z} \cdot \color{blue}{\left(t + \left(-x\right)\right)} + x\]
    10. Applied distribute-lft-in10.0

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

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

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

    if -9.76162443591342e-143 < a < 2.406524337071742e-201

    1. Initial program 24.9

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

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

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

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

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

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

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

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

Reproduce

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