Average Error: 14.9 → 6.8
Time: 15.3s
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\\ \mathbf{if}\;t_2 \leq -3.035420144102702 \cdot 10^{+82}:\\ \;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_3 := \left(\frac{x \cdot z}{a - z} + \left(x + \frac{y \cdot t}{a - z}\right)\right) - \left(\frac{x \cdot y}{a - z} + \frac{z \cdot t}{a - z}\right)\\ \mathbf{if}\;t_2 \leq -2.110158889505625 \cdot 10^{-259}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t_2 \leq -3.3183451206916025 \cdot 10^{-284}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{t}{a - z} - \frac{x}{a - z}, x\right)\\ \mathbf{elif}\;t_2 \leq 3.62678216224685 \cdot 10^{-275}:\\ \;\;\;\;\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 5.485606716490861 \cdot 10^{+304}:\\ \;\;\;\;\mathsf{fma}\left(y - z, t_1, x\right)\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array}\\ \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\\
\mathbf{if}\;t_2 \leq -3.035420144102702 \cdot 10^{+82}:\\
\;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := \left(\frac{x \cdot z}{a - z} + \left(x + \frac{y \cdot t}{a - z}\right)\right) - \left(\frac{x \cdot y}{a - z} + \frac{z \cdot t}{a - z}\right)\\
\mathbf{if}\;t_2 \leq -2.110158889505625 \cdot 10^{-259}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;t_2 \leq -3.3183451206916025 \cdot 10^{-284}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t}{a - z} - \frac{x}{a - z}, x\right)\\

\mathbf{elif}\;t_2 \leq 3.62678216224685 \cdot 10^{-275}:\\
\;\;\;\;\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 5.485606716490861 \cdot 10^{+304}:\\
\;\;\;\;\mathsf{fma}\left(y - z, t_1, x\right)\\

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


\end{array}\\


\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))))
   (if (<= t_2 -3.035420144102702e+82)
     (+ x (/ (- y z) (/ (- a z) (- t x))))
     (let* ((t_3
             (-
              (+ (/ (* x z) (- a z)) (+ x (/ (* y t) (- a z))))
              (+ (/ (* x y) (- a z)) (/ (* z t) (- a z))))))
       (if (<= t_2 -2.110158889505625e-259)
         t_3
         (if (<= t_2 -3.3183451206916025e-284)
           (fma (- y z) (- (/ t (- a z)) (/ x (- a z))) x)
           (if (<= t_2 3.62678216224685e-275)
             (-
              (+ (/ (* x y) z) (+ t (/ (* t a) z)))
              (+ (/ (* y t) z) (/ (* x a) z)))
             (if (<= t_2 5.485606716490861e+304)
               (fma (- y z) t_1 x)
               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 tmp;
	if (t_2 <= -3.035420144102702e+82) {
		tmp = x + ((y - z) / ((a - z) / (t - x)));
	} else {
		double t_3 = (((x * z) / (a - z)) + (x + ((y * t) / (a - z)))) - (((x * y) / (a - z)) + ((z * t) / (a - z)));
		double tmp_1;
		if (t_2 <= -2.110158889505625e-259) {
			tmp_1 = t_3;
		} else if (t_2 <= -3.3183451206916025e-284) {
			tmp_1 = fma((y - z), ((t / (a - z)) - (x / (a - z))), x);
		} else if (t_2 <= 3.62678216224685e-275) {
			tmp_1 = (((x * y) / z) + (t + ((t * a) / z))) - (((y * t) / z) + ((x * a) / z));
		} else if (t_2 <= 5.485606716490861e+304) {
			tmp_1 = fma((y - z), t_1, x);
		} else {
			tmp_1 = t_3;
		}
		tmp = tmp_1;
	}
	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 5 regimes
  2. if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -3.03542e82

    1. Initial program 6.2

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

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

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

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

      \[\leadsto \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} + x \]

    if -3.03542e82 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2.110158889505625e-259 or 5.4856067164908612e304 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z))))

    1. Initial program 11.4

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

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

      \[\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)} \]

    if -2.110158889505625e-259 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -3.31834512069160249e-284

    1. Initial program 27.6

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

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

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

      \[\leadsto \mathsf{fma}\left(y - z, \frac{\color{blue}{1 \cdot \left(t - x\right)}}{\left(\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}\right) \cdot \sqrt[3]{a - z}}, x\right) \]
    5. Applied times-frac_binary6427.7

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

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

    if -3.31834512069160249e-284 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 3.62678216224685e-275

    1. Initial program 60.2

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

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

      \[\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 3.62678216224685e-275 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 5.4856067164908612e304

    1. Initial program 5.4

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

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

      \[\leadsto \mathsf{fma}\left(y - z, \frac{t - x}{\color{blue}{\left(\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}\right) \cdot \sqrt[3]{a - z}}}, x\right) \]
    4. Applied *-un-lft-identity_binary646.1

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y - z, \color{blue}{{\left(\frac{1}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t - x}{\sqrt[3]{a - z}}\right)}^{1}}, x\right) \]
    9. Simplified5.4

      \[\leadsto \mathsf{fma}\left(y - z, {\color{blue}{\left(\frac{t - x}{a - z}\right)}}^{1}, x\right) \]
  3. Recombined 5 regimes into one program.
  4. Final simplification6.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq -3.035420144102702 \cdot 10^{+82}:\\ \;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\ \mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq -2.110158889505625 \cdot 10^{-259}:\\ \;\;\;\;\left(\frac{x \cdot z}{a - z} + \left(x + \frac{y \cdot t}{a - z}\right)\right) - \left(\frac{x \cdot y}{a - z} + \frac{z \cdot t}{a - z}\right)\\ \mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq -3.3183451206916025 \cdot 10^{-284}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{t}{a - z} - \frac{x}{a - z}, x\right)\\ \mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq 3.62678216224685 \cdot 10^{-275}:\\ \;\;\;\;\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 5.485606716490861 \cdot 10^{+304}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{x \cdot z}{a - z} + \left(x + \frac{y \cdot t}{a - z}\right)\right) - \left(\frac{x \cdot y}{a - z} + \frac{z \cdot t}{a - z}\right)\\ \end{array} \]

Reproduce

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