Average Error: 14.8 → 10.1
Time: 5.7s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -7.51801560809933867 \cdot 10^{-132} \lor \neg \left(a \le 3.72023372207912083 \cdot 10^{-99}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -7.51801560809933867 \cdot 10^{-132} \lor \neg \left(a \le 3.72023372207912083 \cdot 10^{-99}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r142875 = x;
        double r142876 = y;
        double r142877 = z;
        double r142878 = r142876 - r142877;
        double r142879 = t;
        double r142880 = r142879 - r142875;
        double r142881 = a;
        double r142882 = r142881 - r142877;
        double r142883 = r142880 / r142882;
        double r142884 = r142878 * r142883;
        double r142885 = r142875 + r142884;
        return r142885;
}

double f(double x, double y, double z, double t, double a) {
        double r142886 = a;
        double r142887 = -7.518015608099339e-132;
        bool r142888 = r142886 <= r142887;
        double r142889 = 3.720233722079121e-99;
        bool r142890 = r142886 <= r142889;
        double r142891 = !r142890;
        bool r142892 = r142888 || r142891;
        double r142893 = y;
        double r142894 = z;
        double r142895 = r142893 - r142894;
        double r142896 = r142886 - r142894;
        double r142897 = r142895 / r142896;
        double r142898 = t;
        double r142899 = x;
        double r142900 = r142898 - r142899;
        double r142901 = fma(r142897, r142900, r142899);
        double r142902 = r142899 / r142894;
        double r142903 = r142898 / r142894;
        double r142904 = r142902 - r142903;
        double r142905 = fma(r142893, r142904, r142898);
        double r142906 = r142892 ? r142901 : r142905;
        return r142906;
}

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 a < -7.518015608099339e-132 or 3.720233722079121e-99 < a

    1. Initial program 11.0

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

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

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

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

      \[\leadsto \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} + x\]
    8. Using strategy rm
    9. Applied associate-/r/8.8

      \[\leadsto \color{blue}{\frac{y - z}{a - z} \cdot \left(t - x\right)} + x\]
    10. Applied fma-def8.8

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

    if -7.518015608099339e-132 < a < 3.720233722079121e-99

    1. Initial program 24.6

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -7.51801560809933867 \cdot 10^{-132} \lor \neg \left(a \le 3.72023372207912083 \cdot 10^{-99}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \end{array}\]

Reproduce

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