Average Error: 14.9 → 7.5
Time: 5.9s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -7.4545129417356688 \cdot 10^{-281} \lor \neg \left(a \le 4.9565040285357107 \cdot 10^{-241}\right):\\ \;\;\;\;t \cdot \frac{y - z}{a - z} + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - \frac{t \cdot y}{z}\right)\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -7.4545129417356688 \cdot 10^{-281} \lor \neg \left(a \le 4.9565040285357107 \cdot 10^{-241}\right):\\
\;\;\;\;t \cdot \frac{y - z}{a - z} + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r100327 = x;
        double r100328 = y;
        double r100329 = z;
        double r100330 = r100328 - r100329;
        double r100331 = t;
        double r100332 = r100331 - r100327;
        double r100333 = a;
        double r100334 = r100333 - r100329;
        double r100335 = r100332 / r100334;
        double r100336 = r100330 * r100335;
        double r100337 = r100327 + r100336;
        return r100337;
}

double f(double x, double y, double z, double t, double a) {
        double r100338 = a;
        double r100339 = -7.454512941735669e-281;
        bool r100340 = r100338 <= r100339;
        double r100341 = 4.956504028535711e-241;
        bool r100342 = r100338 <= r100341;
        double r100343 = !r100342;
        bool r100344 = r100340 || r100343;
        double r100345 = t;
        double r100346 = y;
        double r100347 = z;
        double r100348 = r100346 - r100347;
        double r100349 = r100338 - r100347;
        double r100350 = r100348 / r100349;
        double r100351 = r100345 * r100350;
        double r100352 = x;
        double r100353 = -r100352;
        double r100354 = fma(r100353, r100350, r100352);
        double r100355 = r100351 + r100354;
        double r100356 = r100352 / r100347;
        double r100357 = r100345 * r100346;
        double r100358 = r100357 / r100347;
        double r100359 = r100345 - r100358;
        double r100360 = fma(r100356, r100346, r100359);
        double r100361 = r100344 ? r100355 : r100360;
        return r100361;
}

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.454512941735669e-281 or 4.956504028535711e-241 < a

    1. Initial program 14.1

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

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

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

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

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

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

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

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

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

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

    if -7.454512941735669e-281 < a < 4.956504028535711e-241

    1. Initial program 25.5

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

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

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

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

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

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

Reproduce

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