Average Error: 14.7 → 9.2
Time: 23.3s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -3.05828487626015833265941954080526345918 \cdot 10^{-127}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\ \mathbf{elif}\;a \le 6.713273107564123459794063379500506096135 \cdot 10^{-136}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - \frac{t}{z} \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -3.05828487626015833265941954080526345918 \cdot 10^{-127}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r5406926 = x;
        double r5406927 = y;
        double r5406928 = z;
        double r5406929 = r5406927 - r5406928;
        double r5406930 = t;
        double r5406931 = r5406930 - r5406926;
        double r5406932 = a;
        double r5406933 = r5406932 - r5406928;
        double r5406934 = r5406931 / r5406933;
        double r5406935 = r5406929 * r5406934;
        double r5406936 = r5406926 + r5406935;
        return r5406936;
}

double f(double x, double y, double z, double t, double a) {
        double r5406937 = a;
        double r5406938 = -3.0582848762601583e-127;
        bool r5406939 = r5406937 <= r5406938;
        double r5406940 = y;
        double r5406941 = z;
        double r5406942 = r5406940 - r5406941;
        double r5406943 = r5406937 - r5406941;
        double r5406944 = r5406942 / r5406943;
        double r5406945 = t;
        double r5406946 = x;
        double r5406947 = r5406945 - r5406946;
        double r5406948 = fma(r5406944, r5406947, r5406946);
        double r5406949 = 6.7132731075641235e-136;
        bool r5406950 = r5406937 <= r5406949;
        double r5406951 = r5406946 / r5406941;
        double r5406952 = r5406945 / r5406941;
        double r5406953 = r5406952 * r5406940;
        double r5406954 = r5406945 - r5406953;
        double r5406955 = fma(r5406951, r5406940, r5406954);
        double r5406956 = r5406950 ? r5406955 : r5406948;
        double r5406957 = r5406939 ? r5406948 : r5406956;
        return r5406957;
}

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 < -3.0582848762601583e-127 or 6.7132731075641235e-136 < a

    1. Initial program 11.1

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

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

      \[\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.4

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

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

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

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

    if -3.0582848762601583e-127 < a < 6.7132731075641235e-136

    1. Initial program 25.2

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

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

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

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

      \[\leadsto \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} + x\]
    8. Taylor expanded around inf 13.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -3.05828487626015833265941954080526345918 \cdot 10^{-127}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\ \mathbf{elif}\;a \le 6.713273107564123459794063379500506096135 \cdot 10^{-136}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - \frac{t}{z} \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019170 +o rules:numerics
(FPCore (x y z t a)
  :name "Numeric.Signal:interpolate   from hsignal-0.2.7.1"
  (+ x (* (- y z) (/ (- t x) (- a z)))))