Average Error: 14.7 → 11.2
Time: 24.4s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le 1.51672741748560259757194279897230946449 \cdot 10^{213}:\\ \;\;\;\;\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 - \frac{t \cdot y}{z}\right)\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le 1.51672741748560259757194279897230946449 \cdot 10^{213}:\\
\;\;\;\;\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 - \frac{t \cdot y}{z}\right)\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r8196762 = x;
        double r8196763 = y;
        double r8196764 = z;
        double r8196765 = r8196763 - r8196764;
        double r8196766 = t;
        double r8196767 = r8196766 - r8196762;
        double r8196768 = a;
        double r8196769 = r8196768 - r8196764;
        double r8196770 = r8196767 / r8196769;
        double r8196771 = r8196765 * r8196770;
        double r8196772 = r8196762 + r8196771;
        return r8196772;
}

double f(double x, double y, double z, double t, double a) {
        double r8196773 = z;
        double r8196774 = 1.5167274174856026e+213;
        bool r8196775 = r8196773 <= r8196774;
        double r8196776 = t;
        double r8196777 = x;
        double r8196778 = r8196776 - r8196777;
        double r8196779 = y;
        double r8196780 = r8196779 - r8196773;
        double r8196781 = 1.0;
        double r8196782 = a;
        double r8196783 = r8196782 - r8196773;
        double r8196784 = r8196781 / r8196783;
        double r8196785 = r8196780 * r8196784;
        double r8196786 = r8196778 * r8196785;
        double r8196787 = r8196786 + r8196777;
        double r8196788 = r8196777 / r8196773;
        double r8196789 = r8196776 * r8196779;
        double r8196790 = r8196789 / r8196773;
        double r8196791 = r8196776 - r8196790;
        double r8196792 = fma(r8196788, r8196779, r8196791);
        double r8196793 = r8196775 ? r8196787 : r8196792;
        return r8196793;
}

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 < 1.5167274174856026e+213

    1. Initial program 12.9

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

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

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

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

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

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

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

    if 1.5167274174856026e+213 < z

    1. Initial program 32.1

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le 1.51672741748560259757194279897230946449 \cdot 10^{213}:\\ \;\;\;\;\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 - \frac{t \cdot y}{z}\right)\\ \end{array}\]

Reproduce

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