Average Error: 14.6 → 9.1
Time: 6.0s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.6873865685691577 \cdot 10^{222}:\\ \;\;\;\;1 \cdot \mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{elif}\;z \le 6.19396887548895724 \cdot 10^{-135}:\\ \;\;\;\;1 \cdot \mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\ \mathbf{elif}\;z \le 9.4575014122928456 \cdot 10^{198}:\\ \;\;\;\;\frac{y}{\frac{a - z}{t - x}} - \left(\frac{z}{\frac{a - z}{t - x}} - x\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \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}\;z \le -1.6873865685691577 \cdot 10^{222}:\\
\;\;\;\;1 \cdot \mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\

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

\mathbf{elif}\;z \le 9.4575014122928456 \cdot 10^{198}:\\
\;\;\;\;\frac{y}{\frac{a - z}{t - x}} - \left(\frac{z}{\frac{a - z}{t - x}} - x\right)\\

\mathbf{else}:\\
\;\;\;\;1 \cdot \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 r100733 = x;
        double r100734 = y;
        double r100735 = z;
        double r100736 = r100734 - r100735;
        double r100737 = t;
        double r100738 = r100737 - r100733;
        double r100739 = a;
        double r100740 = r100739 - r100735;
        double r100741 = r100738 / r100740;
        double r100742 = r100736 * r100741;
        double r100743 = r100733 + r100742;
        return r100743;
}

double f(double x, double y, double z, double t, double a) {
        double r100744 = z;
        double r100745 = -1.6873865685691577e+222;
        bool r100746 = r100744 <= r100745;
        double r100747 = 1.0;
        double r100748 = y;
        double r100749 = x;
        double r100750 = r100749 / r100744;
        double r100751 = t;
        double r100752 = r100751 / r100744;
        double r100753 = r100750 - r100752;
        double r100754 = fma(r100748, r100753, r100751);
        double r100755 = r100747 * r100754;
        double r100756 = 6.193968875488957e-135;
        bool r100757 = r100744 <= r100756;
        double r100758 = r100748 - r100744;
        double r100759 = a;
        double r100760 = r100759 - r100744;
        double r100761 = r100758 / r100760;
        double r100762 = r100751 - r100749;
        double r100763 = fma(r100761, r100762, r100749);
        double r100764 = r100747 * r100763;
        double r100765 = 9.457501412292846e+198;
        bool r100766 = r100744 <= r100765;
        double r100767 = r100760 / r100762;
        double r100768 = r100748 / r100767;
        double r100769 = r100744 / r100767;
        double r100770 = r100769 - r100749;
        double r100771 = r100768 - r100770;
        double r100772 = r100766 ? r100771 : r100755;
        double r100773 = r100757 ? r100764 : r100772;
        double r100774 = r100746 ? r100755 : r100773;
        return r100774;
}

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 z < -1.6873865685691577e+222 or 9.457501412292846e+198 < z

    1. Initial program 31.4

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

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

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

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

      \[\leadsto \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} + x\]
    8. Using strategy rm
    9. Applied *-un-lft-identity31.9

      \[\leadsto \frac{y - z}{\frac{a - z}{t - x}} + \color{blue}{1 \cdot x}\]
    10. Applied *-un-lft-identity31.9

      \[\leadsto \color{blue}{1 \cdot \frac{y - z}{\frac{a - z}{t - x}}} + 1 \cdot x\]
    11. Applied distribute-lft-out31.9

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

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

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

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

    if -1.6873865685691577e+222 < z < 6.193968875488957e-135

    1. Initial program 10.2

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)}\]
    3. Using strategy rm
    4. Applied clear-num10.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-udef10.4

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

      \[\leadsto \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} + x\]
    8. Using strategy rm
    9. Applied *-un-lft-identity10.1

      \[\leadsto \frac{y - z}{\frac{a - z}{t - x}} + \color{blue}{1 \cdot x}\]
    10. Applied *-un-lft-identity10.1

      \[\leadsto \color{blue}{1 \cdot \frac{y - z}{\frac{a - z}{t - x}}} + 1 \cdot x\]
    11. Applied distribute-lft-out10.1

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

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

    if 6.193968875488957e-135 < z < 9.457501412292846e+198

    1. Initial program 12.3

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)}\]
    3. Using strategy rm
    4. Applied clear-num12.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-udef12.4

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

      \[\leadsto \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} + x\]
    8. Using strategy rm
    9. Applied div-sub12.1

      \[\leadsto \color{blue}{\left(\frac{y}{\frac{a - z}{t - x}} - \frac{z}{\frac{a - z}{t - x}}\right)} + x\]
    10. Applied associate-+l-9.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.6873865685691577 \cdot 10^{222}:\\ \;\;\;\;1 \cdot \mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{elif}\;z \le 6.19396887548895724 \cdot 10^{-135}:\\ \;\;\;\;1 \cdot \mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\ \mathbf{elif}\;z \le 9.4575014122928456 \cdot 10^{198}:\\ \;\;\;\;\frac{y}{\frac{a - z}{t - x}} - \left(\frac{z}{\frac{a - z}{t - x}} - x\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \end{array}\]

Reproduce

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