Average Error: 14.7 → 6.9
Time: 35.3s
Precision: binary64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
\[\begin{array}{l} t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;\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}\;t_1 \leq -1.2858461688292264 \cdot 10^{-254}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{x - t}{z - a}, x\right)\\ \mathbf{elif}\;t_1 \leq 4.153644965211153 \cdot 10^{-266}:\\ \;\;\;\;\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{else}:\\ \;\;\;\;t_1\\ \end{array} \]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\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}\;t_1 \leq -1.2858461688292264 \cdot 10^{-254}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{x - t}{z - a}, x\right)\\

\mathbf{elif}\;t_1 \leq 4.153644965211153 \cdot 10^{-266}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;t_1\\


\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 (+ x (* (- y z) (/ (- t x) (- a z))))))
   (if (<= t_1 (- INFINITY))
     (-
      (+ (/ (* x z) (- a z)) (+ x (/ (* y t) (- a z))))
      (+ (/ (* x y) (- a z)) (/ (* z t) (- a z))))
     (if (<= t_1 -1.2858461688292264e-254)
       (fma (- y z) (/ (- x t) (- z a)) x)
       (if (<= t_1 4.153644965211153e-266)
         (-
          (+ (/ (* x y) z) (+ t (/ (* t a) z)))
          (+ (/ (* y t) z) (/ (* x a) z)))
         t_1)))))
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 = x + ((y - z) * ((t - x) / (a - z)));
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = (((x * z) / (a - z)) + (x + ((y * t) / (a - z)))) - (((x * y) / (a - z)) + ((z * t) / (a - z)));
	} else if (t_1 <= -1.2858461688292264e-254) {
		tmp = fma((y - z), ((x - t) / (z - a)), x);
	} else if (t_1 <= 4.153644965211153e-266) {
		tmp = (((x * y) / z) + (t + ((t * a) / z))) - (((y * t) / z) + ((x * a) / z));
	} else {
		tmp = t_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 4 regimes
  2. if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0

    1. Initial program 64.0

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

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

      \[\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 -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.2858461688292264e-254

    1. Initial program 4.5

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

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

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

    if -1.2858461688292264e-254 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 4.15364496521115291e-266

    1. Initial program 58.4

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

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

      \[\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 4.15364496521115291e-266 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z))))

    1. Initial program 6.7

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq -\infty:\\ \;\;\;\;\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 -1.2858461688292264 \cdot 10^{-254}:\\ \;\;\;\;\mathsf{fma}\left(y - z, \frac{x - t}{z - a}, x\right)\\ \mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq 4.153644965211153 \cdot 10^{-266}:\\ \;\;\;\;\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{else}:\\ \;\;\;\;x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \end{array} \]

Reproduce

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