Average Error: 15.0 → 9.9
Time: 22.1s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -4.566794582426086766953000029549497615298 \cdot 10^{-156}:\\ \;\;\;\;\mathsf{fma}\left(t - x, \frac{1}{\frac{a - z}{y - z}}, x\right)\\ \mathbf{elif}\;a \le 7.692781660197598904440558192035913736358 \cdot 10^{-150}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t - \frac{t \cdot y}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{t - x}{\frac{a - z}{y - z}}\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -4.566794582426086766953000029549497615298 \cdot 10^{-156}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{1}{\frac{a - z}{y - z}}, x\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r112235 = x;
        double r112236 = y;
        double r112237 = z;
        double r112238 = r112236 - r112237;
        double r112239 = t;
        double r112240 = r112239 - r112235;
        double r112241 = a;
        double r112242 = r112241 - r112237;
        double r112243 = r112240 / r112242;
        double r112244 = r112238 * r112243;
        double r112245 = r112235 + r112244;
        return r112245;
}

double f(double x, double y, double z, double t, double a) {
        double r112246 = a;
        double r112247 = -4.566794582426087e-156;
        bool r112248 = r112246 <= r112247;
        double r112249 = t;
        double r112250 = x;
        double r112251 = r112249 - r112250;
        double r112252 = 1.0;
        double r112253 = z;
        double r112254 = r112246 - r112253;
        double r112255 = y;
        double r112256 = r112255 - r112253;
        double r112257 = r112254 / r112256;
        double r112258 = r112252 / r112257;
        double r112259 = fma(r112251, r112258, r112250);
        double r112260 = 7.692781660197599e-150;
        bool r112261 = r112246 <= r112260;
        double r112262 = r112250 / r112253;
        double r112263 = r112249 * r112255;
        double r112264 = r112263 / r112253;
        double r112265 = r112249 - r112264;
        double r112266 = fma(r112262, r112255, r112265);
        double r112267 = r112251 / r112257;
        double r112268 = r112250 + r112267;
        double r112269 = r112261 ? r112266 : r112268;
        double r112270 = r112248 ? r112259 : r112269;
        return r112270;
}

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 < -4.566794582426087e-156

    1. Initial program 11.5

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

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

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

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

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

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

      \[\leadsto \left(t - x\right) \cdot \color{blue}{\frac{1}{\frac{a - z}{y - z}}} + x\]
    11. Using strategy rm
    12. Applied fma-def9.1

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

    if -4.566794582426087e-156 < a < 7.692781660197599e-150

    1. Initial program 25.7

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

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

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

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

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

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

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

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

    if 7.692781660197599e-150 < a

    1. Initial program 11.9

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

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

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

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

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

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

      \[\leadsto \left(t - x\right) \cdot \color{blue}{\frac{1}{\frac{a - z}{y - z}}} + x\]
    11. Using strategy rm
    12. Applied pow19.4

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

      \[\leadsto \color{blue}{{\left(t - x\right)}^{1}} \cdot {\left(\frac{1}{\frac{a - z}{y - z}}\right)}^{1} + x\]
    14. Applied pow-prod-down9.4

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

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

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

Reproduce

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