Average Error: 15.0 → 12.9
Time: 3.9s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.95333646582006522 \cdot 10^{197} \lor \neg \left(z \le 2.80403393809698577 \cdot 10^{31}\right):\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{\frac{1}{a - z}}{\frac{1}{t - x}}, x\right)\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le -1.95333646582006522 \cdot 10^{197} \lor \neg \left(z \le 2.80403393809698577 \cdot 10^{31}\right):\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r116629 = x;
        double r116630 = y;
        double r116631 = z;
        double r116632 = r116630 - r116631;
        double r116633 = t;
        double r116634 = r116633 - r116629;
        double r116635 = a;
        double r116636 = r116635 - r116631;
        double r116637 = r116634 / r116636;
        double r116638 = r116632 * r116637;
        double r116639 = r116629 + r116638;
        return r116639;
}

double f(double x, double y, double z, double t, double a) {
        double r116640 = z;
        double r116641 = -1.9533364658200652e+197;
        bool r116642 = r116640 <= r116641;
        double r116643 = 2.8040339380969858e+31;
        bool r116644 = r116640 <= r116643;
        double r116645 = !r116644;
        bool r116646 = r116642 || r116645;
        double r116647 = y;
        double r116648 = x;
        double r116649 = r116648 / r116640;
        double r116650 = t;
        double r116651 = r116650 / r116640;
        double r116652 = r116649 - r116651;
        double r116653 = fma(r116647, r116652, r116650);
        double r116654 = r116647 - r116640;
        double r116655 = 1.0;
        double r116656 = a;
        double r116657 = r116656 - r116640;
        double r116658 = r116655 / r116657;
        double r116659 = r116650 - r116648;
        double r116660 = r116655 / r116659;
        double r116661 = r116658 / r116660;
        double r116662 = fma(r116654, r116661, r116648);
        double r116663 = r116646 ? r116653 : r116662;
        return r116663;
}

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 < -1.9533364658200652e+197 or 2.8040339380969858e+31 < z

    1. Initial program 25.4

      \[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 27.3

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

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

    if -1.9533364658200652e+197 < z < 2.8040339380969858e+31

    1. Initial program 9.4

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

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

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

      \[\leadsto \mathsf{fma}\left(y - z, \frac{1}{\color{blue}{\left(a - z\right) \cdot \frac{1}{t - x}}}, x\right)\]
    7. Applied associate-/r*9.4

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

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

Reproduce

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