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 r111581 = x;
        double r111582 = y;
        double r111583 = z;
        double r111584 = r111582 - r111583;
        double r111585 = t;
        double r111586 = r111585 - r111581;
        double r111587 = a;
        double r111588 = r111587 - r111583;
        double r111589 = r111586 / r111588;
        double r111590 = r111584 * r111589;
        double r111591 = r111581 + r111590;
        return r111591;
}

double f(double x, double y, double z, double t, double a) {
        double r111592 = a;
        double r111593 = -7.454512941735669e-281;
        bool r111594 = r111592 <= r111593;
        double r111595 = 4.956504028535711e-241;
        bool r111596 = r111592 <= r111595;
        double r111597 = !r111596;
        bool r111598 = r111594 || r111597;
        double r111599 = t;
        double r111600 = y;
        double r111601 = z;
        double r111602 = r111600 - r111601;
        double r111603 = r111592 - r111601;
        double r111604 = r111602 / r111603;
        double r111605 = r111599 * r111604;
        double r111606 = x;
        double r111607 = -r111606;
        double r111608 = fma(r111607, r111604, r111606);
        double r111609 = r111605 + r111608;
        double r111610 = r111606 / r111601;
        double r111611 = r111599 * r111600;
        double r111612 = r111611 / r111601;
        double r111613 = r111599 - r111612;
        double r111614 = fma(r111610, r111600, r111613);
        double r111615 = r111598 ? r111609 : r111614;
        return r111615;
}

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)))))