Average Error: 15.0 → 5.9
Time: 18.7s
Precision: binary64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
\[\begin{array}{l} t_1 := \frac{t - x}{a - z}\\ t_2 := x + \left(y - z\right) \cdot t_1\\ t_3 := \mathsf{fma}\left(y - z, t_1, x\right)\\ \mathbf{if}\;t_2 \leq -1.650857283112171 \cdot 10^{-274}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t_2 \leq 0:\\ \;\;\;\;\left(\frac{x \cdot y}{z} + \left(t + \frac{t \cdot a}{z}\right)\right) - \left(\frac{y \cdot t}{z} + \frac{x \cdot a}{z}\right)\\ \mathbf{elif}\;t_2 \leq 4.122632137532037 \cdot 10^{-67} \lor \neg \left(t_2 \leq 1.6527103431256226 \cdot 10^{+305}\right):\\ \;\;\;\;\left(\frac{x \cdot z}{a - z} + \left(x + \frac{y \cdot t}{a - z}\right)\right) - \left(\frac{1}{\frac{a - z}{x \cdot y}} + \frac{z \cdot t}{a - z}\right)\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := x + \left(y - z\right) \cdot t_1\\
t_3 := \mathsf{fma}\left(y - z, t_1, x\right)\\
\mathbf{if}\;t_2 \leq -1.650857283112171 \cdot 10^{-274}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;\left(\frac{x \cdot y}{z} + \left(t + \frac{t \cdot a}{z}\right)\right) - \left(\frac{y \cdot t}{z} + \frac{x \cdot a}{z}\right)\\

\mathbf{elif}\;t_2 \leq 4.122632137532037 \cdot 10^{-67} \lor \neg \left(t_2 \leq 1.6527103431256226 \cdot 10^{+305}\right):\\
\;\;\;\;\left(\frac{x \cdot z}{a - z} + \left(x + \frac{y \cdot t}{a - z}\right)\right) - \left(\frac{1}{\frac{a - z}{x \cdot y}} + \frac{z \cdot t}{a - z}\right)\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ (- t x) (- a z)))
        (t_2 (+ x (* (- y z) t_1)))
        (t_3 (fma (- y z) t_1 x)))
   (if (<= t_2 -1.650857283112171e-274)
     t_3
     (if (<= t_2 0.0)
       (-
        (+ (/ (* x y) z) (+ t (/ (* t a) z)))
        (+ (/ (* y t) z) (/ (* x a) z)))
       (if (or (<= t_2 4.122632137532037e-67)
               (not (<= t_2 1.6527103431256226e+305)))
         (-
          (+ (/ (* x z) (- a z)) (+ x (/ (* y t) (- a z))))
          (+ (/ 1.0 (/ (- a z) (* x y))) (/ (* z t) (- a z))))
         t_3)))))
double code(double x, double y, double z, double t, double a) {
	return x + ((y - z) * ((t - x) / (a - z)));
}
double code(double x, double y, double z, double t, double a) {
	double t_1 = (t - x) / (a - z);
	double t_2 = x + ((y - z) * t_1);
	double t_3 = fma((y - z), t_1, x);
	double tmp;
	if (t_2 <= -1.650857283112171e-274) {
		tmp = t_3;
	} else if (t_2 <= 0.0) {
		tmp = (((x * y) / z) + (t + ((t * a) / z))) - (((y * t) / z) + ((x * a) / z));
	} else if ((t_2 <= 4.122632137532037e-67) || !(t_2 <= 1.6527103431256226e+305)) {
		tmp = (((x * z) / (a - z)) + (x + ((y * t) / (a - z)))) - ((1.0 / ((a - z) / (x * y))) + ((z * t) / (a - z)));
	} else {
		tmp = t_3;
	}
	return tmp;
}

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 (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.650857283112171e-274 or 4.1226321375320367e-67 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.65271034312562259e305

    1. Initial program 5.1

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \]
    3. Applied add-cube-cbrt_binary646.1

      \[\leadsto \color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \cdot \sqrt[3]{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)}} \]
    4. Applied pow1/3_binary6438.7

      \[\leadsto \left(\sqrt[3]{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \cdot \sqrt[3]{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)}\right) \cdot \color{blue}{{\left(\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\right)}^{0.3333333333333333}} \]
    5. Applied pow1/3_binary6439.1

      \[\leadsto \left(\sqrt[3]{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)} \cdot \color{blue}{{\left(\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\right)}^{0.3333333333333333}}\right) \cdot {\left(\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\right)}^{0.3333333333333333} \]
    6. Applied pow1/3_binary6439.4

      \[\leadsto \left(\color{blue}{{\left(\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\right)}^{0.3333333333333333}} \cdot {\left(\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\right)}^{0.3333333333333333}\right) \cdot {\left(\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\right)}^{0.3333333333333333} \]
    7. Applied pow-sqr_binary6439.4

      \[\leadsto \color{blue}{{\left(\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\right)}^{\left(2 \cdot 0.3333333333333333\right)}} \cdot {\left(\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\right)}^{0.3333333333333333} \]
    8. Applied pow-prod-up_binary645.1

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

    if -1.650857283112171e-274 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0

    1. Initial program 60.2

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

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

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

    if 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 4.1226321375320367e-67 or 1.65271034312562259e305 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z))))

    1. Initial program 25.1

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq -1.650857283112171 \cdot 10^{-274}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\ \mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq 0:\\ \;\;\;\;\left(\frac{x \cdot y}{z} + \left(t + \frac{t \cdot a}{z}\right)\right) - \left(\frac{y \cdot t}{z} + \frac{x \cdot a}{z}\right)\\ \mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq 4.122632137532037 \cdot 10^{-67} \lor \neg \left(x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq 1.6527103431256226 \cdot 10^{+305}\right):\\ \;\;\;\;\left(\frac{x \cdot z}{a - z} + \left(x + \frac{y \cdot t}{a - z}\right)\right) - \left(\frac{1}{\frac{a - z}{x \cdot y}} + \frac{z \cdot t}{a - z}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\ \end{array} \]

Reproduce

herbie shell --seed 2022068 
(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)))))