Average Error: 15.2 → 11.7
Time: 5.1s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -9.74214788097315123 \cdot 10^{-116} \lor \neg \left(a \le 2.322662704079896 \cdot 10^{-101}\right):\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{1}{\frac{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 -9.74214788097315123 \cdot 10^{-116} \lor \neg \left(a \le 2.322662704079896 \cdot 10^{-101}\right):\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{1}{\frac{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 r140311 = x;
        double r140312 = y;
        double r140313 = z;
        double r140314 = r140312 - r140313;
        double r140315 = t;
        double r140316 = r140315 - r140311;
        double r140317 = a;
        double r140318 = r140317 - r140313;
        double r140319 = r140316 / r140318;
        double r140320 = r140314 * r140319;
        double r140321 = r140311 + r140320;
        return r140321;
}

double f(double x, double y, double z, double t, double a) {
        double r140322 = a;
        double r140323 = -9.742147880973151e-116;
        bool r140324 = r140322 <= r140323;
        double r140325 = 2.3226627040798955e-101;
        bool r140326 = r140322 <= r140325;
        double r140327 = !r140326;
        bool r140328 = r140324 || r140327;
        double r140329 = y;
        double r140330 = z;
        double r140331 = r140329 - r140330;
        double r140332 = 1.0;
        double r140333 = r140322 - r140330;
        double r140334 = t;
        double r140335 = x;
        double r140336 = r140334 - r140335;
        double r140337 = r140333 / r140336;
        double r140338 = r140332 / r140337;
        double r140339 = fma(r140331, r140338, r140335);
        double r140340 = r140335 / r140330;
        double r140341 = r140334 / r140330;
        double r140342 = r140340 - r140341;
        double r140343 = fma(r140329, r140342, r140334);
        double r140344 = r140328 ? r140339 : r140343;
        return r140344;
}

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 < -9.742147880973151e-116 or 2.3226627040798955e-101 < a

    1. Initial program 11.0

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

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

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

    if -9.742147880973151e-116 < a < 2.3226627040798955e-101

    1. Initial program 25.3

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

      \[\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.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -9.74214788097315123 \cdot 10^{-116} \lor \neg \left(a \le 2.322662704079896 \cdot 10^{-101}\right):\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{1}{\frac{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 2020065 +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)))))