Average Error: 15.1 → 13.3
Time: 19.6s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -9.629551716185815802079564146219277537856 \cdot 10^{108} \lor \neg \left(z \le 1.899992387810078819800897324896277379132 \cdot 10^{186}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - \frac{t \cdot y}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t - x}{a - z}, y - z, x\right)\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le -9.629551716185815802079564146219277537856 \cdot 10^{108} \lor \neg \left(z \le 1.899992387810078819800897324896277379132 \cdot 10^{186}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - \frac{t \cdot y}{z}\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r82905 = x;
        double r82906 = y;
        double r82907 = z;
        double r82908 = r82906 - r82907;
        double r82909 = t;
        double r82910 = r82909 - r82905;
        double r82911 = a;
        double r82912 = r82911 - r82907;
        double r82913 = r82910 / r82912;
        double r82914 = r82908 * r82913;
        double r82915 = r82905 + r82914;
        return r82915;
}

double f(double x, double y, double z, double t, double a) {
        double r82916 = z;
        double r82917 = -9.629551716185816e+108;
        bool r82918 = r82916 <= r82917;
        double r82919 = 1.8999923878100788e+186;
        bool r82920 = r82916 <= r82919;
        double r82921 = !r82920;
        bool r82922 = r82918 || r82921;
        double r82923 = x;
        double r82924 = r82923 / r82916;
        double r82925 = y;
        double r82926 = t;
        double r82927 = r82926 * r82925;
        double r82928 = r82927 / r82916;
        double r82929 = r82926 - r82928;
        double r82930 = fma(r82924, r82925, r82929);
        double r82931 = r82926 - r82923;
        double r82932 = a;
        double r82933 = r82932 - r82916;
        double r82934 = r82931 / r82933;
        double r82935 = r82925 - r82916;
        double r82936 = fma(r82934, r82935, r82923);
        double r82937 = r82922 ? r82930 : r82936;
        return r82937;
}

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 < -9.629551716185816e+108 or 1.8999923878100788e+186 < z

    1. Initial program 28.3

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
    2. Taylor expanded around inf 25.7

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

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

    if -9.629551716185816e+108 < z < 1.8999923878100788e+186

    1. Initial program 9.6

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

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

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

      \[\leadsto \mathsf{fma}\left(\left(t - x\right) \cdot \color{blue}{{\left(\frac{1}{a - z}\right)}^{1}}, y - z, x\right)\]
    7. Applied pow19.6

      \[\leadsto \mathsf{fma}\left(\color{blue}{{\left(t - x\right)}^{1}} \cdot {\left(\frac{1}{a - z}\right)}^{1}, y - z, x\right)\]
    8. Applied pow-prod-down9.6

      \[\leadsto \mathsf{fma}\left(\color{blue}{{\left(\left(t - x\right) \cdot \frac{1}{a - z}\right)}^{1}}, y - z, x\right)\]
    9. Simplified9.5

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

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

Reproduce

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