Average Error: 14.4 → 11.4
Time: 18.6s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -5.6084778564962155 \cdot 10^{+104}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right) - \frac{y}{\frac{z}{t}}\\ \mathbf{elif}\;z \le 6.562213605057352 \cdot 10^{+178}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right) - \frac{y}{\frac{z}{t}}\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le -5.6084778564962155 \cdot 10^{+104}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right) - \frac{y}{\frac{z}{t}}\\

\mathbf{elif}\;z \le 6.562213605057352 \cdot 10^{+178}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r5832319 = x;
        double r5832320 = y;
        double r5832321 = z;
        double r5832322 = r5832320 - r5832321;
        double r5832323 = t;
        double r5832324 = r5832323 - r5832319;
        double r5832325 = a;
        double r5832326 = r5832325 - r5832321;
        double r5832327 = r5832324 / r5832326;
        double r5832328 = r5832322 * r5832327;
        double r5832329 = r5832319 + r5832328;
        return r5832329;
}

double f(double x, double y, double z, double t, double a) {
        double r5832330 = z;
        double r5832331 = -5.6084778564962155e+104;
        bool r5832332 = r5832330 <= r5832331;
        double r5832333 = x;
        double r5832334 = r5832333 / r5832330;
        double r5832335 = y;
        double r5832336 = t;
        double r5832337 = fma(r5832334, r5832335, r5832336);
        double r5832338 = r5832330 / r5832336;
        double r5832339 = r5832335 / r5832338;
        double r5832340 = r5832337 - r5832339;
        double r5832341 = 6.562213605057352e+178;
        bool r5832342 = r5832330 <= r5832341;
        double r5832343 = r5832335 - r5832330;
        double r5832344 = r5832336 - r5832333;
        double r5832345 = a;
        double r5832346 = r5832345 - r5832330;
        double r5832347 = r5832344 / r5832346;
        double r5832348 = fma(r5832343, r5832347, r5832333);
        double r5832349 = r5832342 ? r5832348 : r5832340;
        double r5832350 = r5832332 ? r5832340 : r5832349;
        return r5832350;
}

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 < -5.6084778564962155e+104 or 6.562213605057352e+178 < z

    1. Initial program 26.8

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

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

      \[\leadsto \color{blue}{\left(y - z\right) \cdot \frac{t - x}{a - z} + x}\]
    5. Taylor expanded around inf 24.8

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

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

    if -5.6084778564962155e+104 < z < 6.562213605057352e+178

    1. Initial program 9.1

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -5.6084778564962155 \cdot 10^{+104}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right) - \frac{y}{\frac{z}{t}}\\ \mathbf{elif}\;z \le 6.562213605057352 \cdot 10^{+178}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right) - \frac{y}{\frac{z}{t}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019163 +o rules:numerics
(FPCore (x y z t a)
  :name "Numeric.Signal:interpolate   from hsignal-0.2.7.1"
  (+ x (* (- y z) (/ (- t x) (- a z)))))