Average Error: 14.6 → 11.5
Time: 3.9s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -3.554774312063063627976250876728430334599 \cdot 10^{-90}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\ \mathbf{elif}\;a \le 6.45012504935001685189153150225110919065 \cdot 10^{-122}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y - z}{\frac{a - z}{t - x}} + x\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -3.554774312063063627976250876728430334599 \cdot 10^{-90}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\

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

\mathbf{else}:\\
\;\;\;\;\frac{y - z}{\frac{a - z}{t - x}} + x\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r108989 = x;
        double r108990 = y;
        double r108991 = z;
        double r108992 = r108990 - r108991;
        double r108993 = t;
        double r108994 = r108993 - r108989;
        double r108995 = a;
        double r108996 = r108995 - r108991;
        double r108997 = r108994 / r108996;
        double r108998 = r108992 * r108997;
        double r108999 = r108989 + r108998;
        return r108999;
}

double f(double x, double y, double z, double t, double a) {
        double r109000 = a;
        double r109001 = -3.5547743120630636e-90;
        bool r109002 = r109000 <= r109001;
        double r109003 = y;
        double r109004 = z;
        double r109005 = r109003 - r109004;
        double r109006 = t;
        double r109007 = x;
        double r109008 = r109006 - r109007;
        double r109009 = r109000 - r109004;
        double r109010 = r109008 / r109009;
        double r109011 = fma(r109005, r109010, r109007);
        double r109012 = 6.450125049350017e-122;
        bool r109013 = r109000 <= r109012;
        double r109014 = r109007 / r109004;
        double r109015 = r109006 / r109004;
        double r109016 = r109014 - r109015;
        double r109017 = fma(r109003, r109016, r109006);
        double r109018 = r109009 / r109008;
        double r109019 = r109005 / r109018;
        double r109020 = r109019 + r109007;
        double r109021 = r109013 ? r109017 : r109020;
        double r109022 = r109002 ? r109011 : r109021;
        return r109022;
}

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 < -3.5547743120630636e-90

    1. Initial program 10.2

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

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

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

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

    if -3.5547743120630636e-90 < a < 6.450125049350017e-122

    1. Initial program 24.1

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

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

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

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

    if 6.450125049350017e-122 < a

    1. Initial program 11.4

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

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

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

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

      \[\leadsto \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} + x\]
  3. Recombined 3 regimes into one program.
  4. Final simplification11.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -3.554774312063063627976250876728430334599 \cdot 10^{-90}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\ \mathbf{elif}\;a \le 6.45012504935001685189153150225110919065 \cdot 10^{-122}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y - z}{\frac{a - z}{t - x}} + x\\ \end{array}\]

Reproduce

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