Average Error: 14.6 → 13.4
Time: 15.5s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3.2582793557416086 \cdot 10^{232}:\\ \;\;\;\;t\\ \mathbf{elif}\;z \le 6.50101691097810777 \cdot 10^{225}:\\ \;\;\;\;\mathsf{fma}\left(\left(t - x\right) \cdot \frac{1}{a - z}, y - z, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le -3.2582793557416086 \cdot 10^{232}:\\
\;\;\;\;t\\

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

\mathbf{else}:\\
\;\;\;\;t\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r133660 = x;
        double r133661 = y;
        double r133662 = z;
        double r133663 = r133661 - r133662;
        double r133664 = t;
        double r133665 = r133664 - r133660;
        double r133666 = a;
        double r133667 = r133666 - r133662;
        double r133668 = r133665 / r133667;
        double r133669 = r133663 * r133668;
        double r133670 = r133660 + r133669;
        return r133670;
}

double f(double x, double y, double z, double t, double a) {
        double r133671 = z;
        double r133672 = -3.2582793557416086e+232;
        bool r133673 = r133671 <= r133672;
        double r133674 = t;
        double r133675 = 6.501016910978108e+225;
        bool r133676 = r133671 <= r133675;
        double r133677 = x;
        double r133678 = r133674 - r133677;
        double r133679 = 1.0;
        double r133680 = a;
        double r133681 = r133680 - r133671;
        double r133682 = r133679 / r133681;
        double r133683 = r133678 * r133682;
        double r133684 = y;
        double r133685 = r133684 - r133671;
        double r133686 = fma(r133683, r133685, r133677);
        double r133687 = r133676 ? r133686 : r133674;
        double r133688 = r133673 ? r133674 : r133687;
        return r133688;
}

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 < -3.2582793557416086e+232 or 6.501016910978108e+225 < z

    1. Initial program 30.7

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

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

      \[\leadsto \color{blue}{t}\]

    if -3.2582793557416086e+232 < z < 6.501016910978108e+225

    1. Initial program 11.8

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3.2582793557416086 \cdot 10^{232}:\\ \;\;\;\;t\\ \mathbf{elif}\;z \le 6.50101691097810777 \cdot 10^{225}:\\ \;\;\;\;\mathsf{fma}\left(\left(t - x\right) \cdot \frac{1}{a - z}, y - z, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array}\]

Reproduce

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