Average Error: 15.2 → 10.0
Time: 6.2s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -7.1792620013319 \cdot 10^{227} \lor \neg \left(z \le 1.3008602074906434 \cdot 10^{112}\right):\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le -7.1792620013319 \cdot 10^{227} \lor \neg \left(z \le 1.3008602074906434 \cdot 10^{112}\right):\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r103314 = x;
        double r103315 = y;
        double r103316 = z;
        double r103317 = r103315 - r103316;
        double r103318 = t;
        double r103319 = r103318 - r103314;
        double r103320 = a;
        double r103321 = r103320 - r103316;
        double r103322 = r103319 / r103321;
        double r103323 = r103317 * r103322;
        double r103324 = r103314 + r103323;
        return r103324;
}

double f(double x, double y, double z, double t, double a) {
        double r103325 = z;
        double r103326 = -7.1792620013319e+227;
        bool r103327 = r103325 <= r103326;
        double r103328 = 1.3008602074906434e+112;
        bool r103329 = r103325 <= r103328;
        double r103330 = !r103329;
        bool r103331 = r103327 || r103330;
        double r103332 = y;
        double r103333 = x;
        double r103334 = r103333 / r103325;
        double r103335 = t;
        double r103336 = r103335 / r103325;
        double r103337 = r103334 - r103336;
        double r103338 = fma(r103332, r103337, r103335);
        double r103339 = 1.0;
        double r103340 = r103332 - r103325;
        double r103341 = a;
        double r103342 = r103341 - r103325;
        double r103343 = r103340 / r103342;
        double r103344 = r103335 - r103333;
        double r103345 = fma(r103343, r103344, r103333);
        double r103346 = r103339 * r103345;
        double r103347 = r103331 ? r103338 : r103346;
        return r103347;
}

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 z < -7.1792620013319e+227 or 1.3008602074906434e+112 < z

    1. Initial program 28.7

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

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

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

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

    if -7.1792620013319e+227 < z < 1.3008602074906434e+112

    1. Initial program 10.6

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

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

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

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

      \[\leadsto \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} + x\]
    8. Using strategy rm
    9. Applied *-un-lft-identity10.4

      \[\leadsto \frac{y - z}{\frac{a - z}{t - x}} + \color{blue}{1 \cdot x}\]
    10. Applied *-un-lft-identity10.4

      \[\leadsto \color{blue}{1 \cdot \frac{y - z}{\frac{a - z}{t - x}}} + 1 \cdot x\]
    11. Applied distribute-lft-out10.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -7.1792620013319 \cdot 10^{227} \lor \neg \left(z \le 1.3008602074906434 \cdot 10^{112}\right):\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\ \end{array}\]

Reproduce

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