Average Error: 14.6 → 12.9
Time: 5.0s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.488227998811165 \cdot 10^{232} \lor \neg \left(z \le 1.2029316985791688 \cdot 10^{210}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - \frac{t \cdot y}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \left(t - x\right) \cdot \frac{1}{a - z}, x\right)\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le -1.488227998811165 \cdot 10^{232} \lor \neg \left(z \le 1.2029316985791688 \cdot 10^{210}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - \frac{t \cdot y}{z}\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \left(t - x\right) \cdot \frac{1}{a - z}, x\right)\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r75444 = x;
        double r75445 = y;
        double r75446 = z;
        double r75447 = r75445 - r75446;
        double r75448 = t;
        double r75449 = r75448 - r75444;
        double r75450 = a;
        double r75451 = r75450 - r75446;
        double r75452 = r75449 / r75451;
        double r75453 = r75447 * r75452;
        double r75454 = r75444 + r75453;
        return r75454;
}

double f(double x, double y, double z, double t, double a) {
        double r75455 = z;
        double r75456 = -1.4882279988111647e+232;
        bool r75457 = r75455 <= r75456;
        double r75458 = 1.2029316985791688e+210;
        bool r75459 = r75455 <= r75458;
        double r75460 = !r75459;
        bool r75461 = r75457 || r75460;
        double r75462 = x;
        double r75463 = r75462 / r75455;
        double r75464 = y;
        double r75465 = t;
        double r75466 = r75465 * r75464;
        double r75467 = r75466 / r75455;
        double r75468 = r75465 - r75467;
        double r75469 = fma(r75463, r75464, r75468);
        double r75470 = r75464 - r75455;
        double r75471 = r75465 - r75462;
        double r75472 = 1.0;
        double r75473 = a;
        double r75474 = r75473 - r75455;
        double r75475 = r75472 / r75474;
        double r75476 = r75471 * r75475;
        double r75477 = fma(r75470, r75476, r75462);
        double r75478 = r75461 ? r75469 : r75477;
        return r75478;
}

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 < -1.4882279988111647e+232 or 1.2029316985791688e+210 < z

    1. Initial program 30.7

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

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

      \[\leadsto \mathsf{fma}\left(y - z, \color{blue}{\left(t - x\right) \cdot \frac{1}{a - z}}, x\right)\]
    5. Taylor expanded around inf 24.2

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

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

    if -1.4882279988111647e+232 < z < 1.2029316985791688e+210

    1. Initial program 11.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.488227998811165 \cdot 10^{232} \lor \neg \left(z \le 1.2029316985791688 \cdot 10^{210}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - \frac{t \cdot y}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \left(t - x\right) \cdot \frac{1}{a - z}, x\right)\\ \end{array}\]

Reproduce

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