Average Error: 14.9 → 7.1
Time: 12.6s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -2.954199409932442086183595114849451162545 \cdot 10^{-204} \lor \neg \left(a \le 2.629474828766037561291881684659171626279 \cdot 10^{-181}\right):\\ \;\;\;\;\frac{y - z}{a - z} \cdot t + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, 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 -2.954199409932442086183595114849451162545 \cdot 10^{-204} \lor \neg \left(a \le 2.629474828766037561291881684659171626279 \cdot 10^{-181}\right):\\
\;\;\;\;\frac{y - z}{a - z} \cdot t + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, 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 r109125 = x;
        double r109126 = y;
        double r109127 = z;
        double r109128 = r109126 - r109127;
        double r109129 = t;
        double r109130 = r109129 - r109125;
        double r109131 = a;
        double r109132 = r109131 - r109127;
        double r109133 = r109130 / r109132;
        double r109134 = r109128 * r109133;
        double r109135 = r109125 + r109134;
        return r109135;
}

double f(double x, double y, double z, double t, double a) {
        double r109136 = a;
        double r109137 = -2.954199409932442e-204;
        bool r109138 = r109136 <= r109137;
        double r109139 = 2.6294748287660376e-181;
        bool r109140 = r109136 <= r109139;
        double r109141 = !r109140;
        bool r109142 = r109138 || r109141;
        double r109143 = y;
        double r109144 = z;
        double r109145 = r109143 - r109144;
        double r109146 = r109136 - r109144;
        double r109147 = r109145 / r109146;
        double r109148 = t;
        double r109149 = r109147 * r109148;
        double r109150 = x;
        double r109151 = -r109150;
        double r109152 = fma(r109151, r109147, r109150);
        double r109153 = r109149 + r109152;
        double r109154 = r109150 / r109144;
        double r109155 = r109148 / r109144;
        double r109156 = r109154 - r109155;
        double r109157 = fma(r109143, r109156, r109148);
        double r109158 = r109142 ? r109153 : r109157;
        return r109158;
}

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 < -2.954199409932442e-204 or 2.6294748287660376e-181 < a

    1. Initial program 12.6

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

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

      \[\leadsto \color{blue}{\left(y - z\right) \cdot \frac{t - x}{a - z} + x}\]
    5. Using strategy rm
    6. Applied div-sub12.6

      \[\leadsto \left(y - z\right) \cdot \color{blue}{\left(\frac{t}{a - z} - \frac{x}{a - z}\right)} + x\]
    7. Using strategy rm
    8. Applied div-inv12.5

      \[\leadsto \left(y - z\right) \cdot \left(\frac{t}{a - z} - \color{blue}{x \cdot \frac{1}{a - z}}\right) + x\]
    9. Applied div-inv12.6

      \[\leadsto \left(y - z\right) \cdot \left(\color{blue}{t \cdot \frac{1}{a - z}} - x \cdot \frac{1}{a - z}\right) + x\]
    10. Applied distribute-rgt-out--12.6

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

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

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

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

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

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

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

    if -2.954199409932442e-204 < a < 2.6294748287660376e-181

    1. Initial program 26.9

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

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

      \[\leadsto \color{blue}{\left(\frac{x \cdot y}{z} + t\right) - \frac{t \cdot y}{z}}\]
    4. Simplified10.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 simplification7.1

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

Reproduce

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