Average Error: 14.8 → 10.1
Time: 6.4s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -7.51801560809933867 \cdot 10^{-132} \lor \neg \left(a \le 3.72023372207912083 \cdot 10^{-99}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -7.51801560809933867 \cdot 10^{-132} \lor \neg \left(a \le 3.72023372207912083 \cdot 10^{-99}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r156455 = x;
        double r156456 = y;
        double r156457 = z;
        double r156458 = r156456 - r156457;
        double r156459 = t;
        double r156460 = r156459 - r156455;
        double r156461 = a;
        double r156462 = r156461 - r156457;
        double r156463 = r156460 / r156462;
        double r156464 = r156458 * r156463;
        double r156465 = r156455 + r156464;
        return r156465;
}

double f(double x, double y, double z, double t, double a) {
        double r156466 = a;
        double r156467 = -7.518015608099339e-132;
        bool r156468 = r156466 <= r156467;
        double r156469 = 3.720233722079121e-99;
        bool r156470 = r156466 <= r156469;
        double r156471 = !r156470;
        bool r156472 = r156468 || r156471;
        double r156473 = y;
        double r156474 = z;
        double r156475 = r156473 - r156474;
        double r156476 = r156466 - r156474;
        double r156477 = r156475 / r156476;
        double r156478 = t;
        double r156479 = x;
        double r156480 = r156478 - r156479;
        double r156481 = fma(r156477, r156480, r156479);
        double r156482 = r156479 / r156474;
        double r156483 = r156478 / r156474;
        double r156484 = r156482 - r156483;
        double r156485 = fma(r156473, r156484, r156478);
        double r156486 = r156472 ? r156481 : r156485;
        return r156486;
}

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 < -7.518015608099339e-132 or 3.720233722079121e-99 < a

    1. Initial program 11.0

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

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

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

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

      \[\leadsto \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} + x\]
    8. Using strategy rm
    9. Applied associate-/r/8.8

      \[\leadsto \color{blue}{\frac{y - z}{a - z} \cdot \left(t - x\right)} + x\]
    10. Applied fma-def8.8

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

    if -7.518015608099339e-132 < a < 3.720233722079121e-99

    1. Initial program 24.6

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -7.51801560809933867 \cdot 10^{-132} \lor \neg \left(a \le 3.72023372207912083 \cdot 10^{-99}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \end{array}\]

Reproduce

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