Average Error: 14.8 → 7.5
Time: 9.8s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \le -7.4600009498 \cdot 10^{-93}:\\ \;\;\;\;x + \left(y - z\right) \cdot \left(\left(t - x\right) \cdot \frac{1}{a - z}\right)\\ \mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \le -6.35262688856634336 \cdot 10^{-298}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\ \mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \le 4.9578464189718553 \cdot 10^{-290}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \le 8.36348514863932005 \cdot 10^{307}:\\ \;\;\;\;x + \left(y - z\right) \cdot \left(\left(t - x\right) \cdot \frac{1}{a - z}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \le -7.4600009498 \cdot 10^{-93}:\\
\;\;\;\;x + \left(y - z\right) \cdot \left(\left(t - x\right) \cdot \frac{1}{a - z}\right)\\

\mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \le -6.35262688856634336 \cdot 10^{-298}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\

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

\mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \le 8.36348514863932005 \cdot 10^{307}:\\
\;\;\;\;x + \left(y - z\right) \cdot \left(\left(t - x\right) \cdot \frac{1}{a - z}\right)\\

\mathbf{else}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r445 = x;
        double r446 = y;
        double r447 = z;
        double r448 = r446 - r447;
        double r449 = t;
        double r450 = r449 - r445;
        double r451 = a;
        double r452 = r451 - r447;
        double r453 = r450 / r452;
        double r454 = r448 * r453;
        double r455 = r445 + r454;
        return r455;
}

double f(double x, double y, double z, double t, double a) {
        double r456 = x;
        double r457 = y;
        double r458 = z;
        double r459 = r457 - r458;
        double r460 = t;
        double r461 = r460 - r456;
        double r462 = a;
        double r463 = r462 - r458;
        double r464 = r461 / r463;
        double r465 = r459 * r464;
        double r466 = r456 + r465;
        double r467 = -7.460000949819656e-93;
        bool r468 = r466 <= r467;
        double r469 = 1.0;
        double r470 = r469 / r463;
        double r471 = r461 * r470;
        double r472 = r459 * r471;
        double r473 = r456 + r472;
        double r474 = -6.352626888566343e-298;
        bool r475 = r466 <= r474;
        double r476 = r459 * r461;
        double r477 = r476 / r463;
        double r478 = r456 + r477;
        double r479 = 4.9578464189718553e-290;
        bool r480 = r466 <= r479;
        double r481 = r456 / r458;
        double r482 = r460 / r458;
        double r483 = r481 - r482;
        double r484 = fma(r457, r483, r460);
        double r485 = 8.36348514863932e+307;
        bool r486 = r466 <= r485;
        double r487 = r486 ? r473 : r478;
        double r488 = r480 ? r484 : r487;
        double r489 = r475 ? r478 : r488;
        double r490 = r468 ? r473 : r489;
        return r490;
}

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 3 regimes
  2. if (+ x (* (- y z) (/ (- t x) (- a z)))) < -7.460000949819656e-93 or 4.9578464189718553e-290 < (+ x (* (- y z) (/ (- t x) (- a z)))) < 8.36348514863932e+307

    1. Initial program 5.2

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
    2. Using strategy rm
    3. Applied div-inv5.3

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

    if -7.460000949819656e-93 < (+ x (* (- y z) (/ (- t x) (- a z)))) < -6.352626888566343e-298 or 8.36348514863932e+307 < (+ x (* (- y z) (/ (- t x) (- a z))))

    1. Initial program 26.9

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
    2. Using strategy rm
    3. Applied associate-*r/6.9

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

    if -6.352626888566343e-298 < (+ x (* (- y z) (/ (- t x) (- a z)))) < 4.9578464189718553e-290

    1. Initial program 61.0

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \le -7.4600009498 \cdot 10^{-93}:\\ \;\;\;\;x + \left(y - z\right) \cdot \left(\left(t - x\right) \cdot \frac{1}{a - z}\right)\\ \mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \le -6.35262688856634336 \cdot 10^{-298}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\ \mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \le 4.9578464189718553 \cdot 10^{-290}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \le 8.36348514863932005 \cdot 10^{307}:\\ \;\;\;\;x + \left(y - z\right) \cdot \left(\left(t - x\right) \cdot \frac{1}{a - z}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\ \end{array}\]

Reproduce

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