Average Error: 14.6 → 13.4
Time: 20.4s
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 r107117 = x;
        double r107118 = y;
        double r107119 = z;
        double r107120 = r107118 - r107119;
        double r107121 = t;
        double r107122 = r107121 - r107117;
        double r107123 = a;
        double r107124 = r107123 - r107119;
        double r107125 = r107122 / r107124;
        double r107126 = r107120 * r107125;
        double r107127 = r107117 + r107126;
        return r107127;
}

double f(double x, double y, double z, double t, double a) {
        double r107128 = z;
        double r107129 = -3.2582793557416086e+232;
        bool r107130 = r107128 <= r107129;
        double r107131 = t;
        double r107132 = 6.501016910978108e+225;
        bool r107133 = r107128 <= r107132;
        double r107134 = x;
        double r107135 = r107131 - r107134;
        double r107136 = 1.0;
        double r107137 = a;
        double r107138 = r107137 - r107128;
        double r107139 = r107136 / r107138;
        double r107140 = r107135 * r107139;
        double r107141 = y;
        double r107142 = r107141 - r107128;
        double r107143 = fma(r107140, r107142, r107134);
        double r107144 = r107133 ? r107143 : r107131;
        double r107145 = r107130 ? r107131 : r107144;
        return r107145;
}

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)))))