Average Error: 15.0 → 10.1
Time: 22.7s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -2.541013017625737369852614769016586561972 \cdot 10^{-148}:\\ \;\;\;\;\left(t - x\right) \cdot \left(\left(y - z\right) \cdot \frac{1}{a - z}\right) + x\\ \mathbf{elif}\;a \le 2.514308981190710013046616702272373999374 \cdot 10^{-108}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - \frac{t \cdot y}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t - x\right) \cdot \frac{y - z}{a - z} + x\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -2.541013017625737369852614769016586561972 \cdot 10^{-148}:\\
\;\;\;\;\left(t - x\right) \cdot \left(\left(y - z\right) \cdot \frac{1}{a - z}\right) + x\\

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

\mathbf{else}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y - z}{a - z} + x\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r91891 = x;
        double r91892 = y;
        double r91893 = z;
        double r91894 = r91892 - r91893;
        double r91895 = t;
        double r91896 = r91895 - r91891;
        double r91897 = a;
        double r91898 = r91897 - r91893;
        double r91899 = r91896 / r91898;
        double r91900 = r91894 * r91899;
        double r91901 = r91891 + r91900;
        return r91901;
}

double f(double x, double y, double z, double t, double a) {
        double r91902 = a;
        double r91903 = -2.5410130176257374e-148;
        bool r91904 = r91902 <= r91903;
        double r91905 = t;
        double r91906 = x;
        double r91907 = r91905 - r91906;
        double r91908 = y;
        double r91909 = z;
        double r91910 = r91908 - r91909;
        double r91911 = 1.0;
        double r91912 = r91902 - r91909;
        double r91913 = r91911 / r91912;
        double r91914 = r91910 * r91913;
        double r91915 = r91907 * r91914;
        double r91916 = r91915 + r91906;
        double r91917 = 2.51430898119071e-108;
        bool r91918 = r91902 <= r91917;
        double r91919 = r91906 / r91909;
        double r91920 = r91905 * r91908;
        double r91921 = r91920 / r91909;
        double r91922 = r91905 - r91921;
        double r91923 = fma(r91919, r91908, r91922);
        double r91924 = r91910 / r91912;
        double r91925 = r91907 * r91924;
        double r91926 = r91925 + r91906;
        double r91927 = r91918 ? r91923 : r91926;
        double r91928 = r91904 ? r91916 : r91927;
        return r91928;
}

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 3 regimes
  2. if a < -2.5410130176257374e-148

    1. Initial program 11.6

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

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

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

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

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

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

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

    if -2.5410130176257374e-148 < a < 2.51430898119071e-108

    1. Initial program 26.4

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

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

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

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

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

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

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

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

    if 2.51430898119071e-108 < a

    1. Initial program 10.7

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -2.541013017625737369852614769016586561972 \cdot 10^{-148}:\\ \;\;\;\;\left(t - x\right) \cdot \left(\left(y - z\right) \cdot \frac{1}{a - z}\right) + x\\ \mathbf{elif}\;a \le 2.514308981190710013046616702272373999374 \cdot 10^{-108}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - \frac{t \cdot y}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t - x\right) \cdot \frac{y - z}{a - z} + x\\ \end{array}\]

Reproduce

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