Average Error: 15.0 → 13.0
Time: 34.9s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -6.30789665243507388 \cdot 10^{-65} \lor \neg \left(a \le 500051093016.9032\right):\\ \;\;\;\;\left(t - x\right) \cdot \left(\left(y - z\right) \cdot \frac{1}{a - z}\right) + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right) - \frac{t \cdot y}{z}\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -6.30789665243507388 \cdot 10^{-65} \lor \neg \left(a \le 500051093016.9032\right):\\
\;\;\;\;\left(t - x\right) \cdot \left(\left(y - z\right) \cdot \frac{1}{a - z}\right) + x\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r74935 = x;
        double r74936 = y;
        double r74937 = z;
        double r74938 = r74936 - r74937;
        double r74939 = t;
        double r74940 = r74939 - r74935;
        double r74941 = a;
        double r74942 = r74941 - r74937;
        double r74943 = r74940 / r74942;
        double r74944 = r74938 * r74943;
        double r74945 = r74935 + r74944;
        return r74945;
}

double f(double x, double y, double z, double t, double a) {
        double r74946 = a;
        double r74947 = -6.307896652435074e-65;
        bool r74948 = r74946 <= r74947;
        double r74949 = 500051093016.9032;
        bool r74950 = r74946 <= r74949;
        double r74951 = !r74950;
        bool r74952 = r74948 || r74951;
        double r74953 = t;
        double r74954 = x;
        double r74955 = r74953 - r74954;
        double r74956 = y;
        double r74957 = z;
        double r74958 = r74956 - r74957;
        double r74959 = 1.0;
        double r74960 = r74946 - r74957;
        double r74961 = r74959 / r74960;
        double r74962 = r74958 * r74961;
        double r74963 = r74955 * r74962;
        double r74964 = r74963 + r74954;
        double r74965 = r74954 / r74957;
        double r74966 = fma(r74965, r74956, r74953);
        double r74967 = r74953 * r74956;
        double r74968 = r74967 / r74957;
        double r74969 = r74966 - r74968;
        double r74970 = r74952 ? r74964 : r74969;
        return r74970;
}

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 < -6.307896652435074e-65 or 500051093016.9032 < a

    1. Initial program 9.1

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

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

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

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

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

      \[\leadsto \left(t - x\right) \cdot \color{blue}{\frac{y - z}{a - z}} + x\]
    9. Using strategy rm
    10. Applied div-inv7.4

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

    if -6.307896652435074e-65 < a < 500051093016.9032

    1. Initial program 23.2

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

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

      \[\leadsto \color{blue}{\frac{t - x}{a - z} \cdot \left(y - z\right) + x}\]
    5. Using strategy rm
    6. Applied div-inv23.3

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

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

      \[\leadsto \left(t - x\right) \cdot \color{blue}{\frac{y - z}{a - z}} + x\]
    9. Taylor expanded around inf 21.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -6.30789665243507388 \cdot 10^{-65} \lor \neg \left(a \le 500051093016.9032\right):\\ \;\;\;\;\left(t - x\right) \cdot \left(\left(y - z\right) \cdot \frac{1}{a - z}\right) + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right) - \frac{t \cdot y}{z}\\ \end{array}\]

Reproduce

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