Average Error: 14.6 → 3.5
Time: 7.8s
Precision: binary64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
\[\begin{array}{l} t_1 := \frac{y}{a - z}\\ t_2 := \frac{a}{z} + -1\\ t_3 := \frac{t - x}{a - z}\\ t_4 := x + \left(y - z\right) \cdot t_3\\ \mathbf{if}\;t_4 \leq -1 \cdot 10^{-230}:\\ \;\;\;\;x + \mathsf{fma}\left(t_1, t - x, \frac{x - t}{t_2}\right)\\ \mathbf{elif}\;t_4 \leq 0:\\ \;\;\;\;\mathsf{fma}\left(t_3, y, \mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\right)\\ \mathbf{elif}\;t_4 \leq 2 \cdot 10^{+41}:\\ \;\;\;\;x \cdot \left(1 + \frac{z - y}{a - z}\right) + \frac{\left(y - z\right) \cdot t}{a - z}\\ \mathbf{elif}\;t_4 \leq 5 \cdot 10^{+279}:\\ \;\;\;\;\mathsf{fma}\left(t_3, y, x + \left(x - t\right) \cdot \frac{z}{a - z}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \mathsf{fma}\left(t_1, t - x, \frac{-t}{t_2}\right)\\ \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 (/ y (- a z)))
        (t_2 (+ (/ a z) -1.0))
        (t_3 (/ (- t x) (- a z)))
        (t_4 (+ x (* (- y z) t_3))))
   (if (<= t_4 -1e-230)
     (+ x (fma t_1 (- t x) (/ (- x t) t_2)))
     (if (<= t_4 0.0)
       (fma t_3 y (fma a (/ (- t x) z) t))
       (if (<= t_4 2e+41)
         (+ (* x (+ 1.0 (/ (- z y) (- a z)))) (/ (* (- y z) t) (- a z)))
         (if (<= t_4 5e+279)
           (fma t_3 y (+ x (* (- x t) (/ z (- a z)))))
           (+ x (fma t_1 (- t x) (/ (- t) t_2)))))))))
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 = y / (a - z);
	double t_2 = (a / z) + -1.0;
	double t_3 = (t - x) / (a - z);
	double t_4 = x + ((y - z) * t_3);
	double tmp;
	if (t_4 <= -1e-230) {
		tmp = x + fma(t_1, (t - x), ((x - t) / t_2));
	} else if (t_4 <= 0.0) {
		tmp = fma(t_3, y, fma(a, ((t - x) / z), t));
	} else if (t_4 <= 2e+41) {
		tmp = (x * (1.0 + ((z - y) / (a - z)))) + (((y - z) * t) / (a - z));
	} else if (t_4 <= 5e+279) {
		tmp = fma(t_3, y, (x + ((x - t) * (z / (a - z)))));
	} else {
		tmp = x + fma(t_1, (t - x), (-t / t_2));
	}
	return tmp;
}
function code(x, y, z, t, a)
	return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z))))
end
function code(x, y, z, t, a)
	t_1 = Float64(y / Float64(a - z))
	t_2 = Float64(Float64(a / z) + -1.0)
	t_3 = Float64(Float64(t - x) / Float64(a - z))
	t_4 = Float64(x + Float64(Float64(y - z) * t_3))
	tmp = 0.0
	if (t_4 <= -1e-230)
		tmp = Float64(x + fma(t_1, Float64(t - x), Float64(Float64(x - t) / t_2)));
	elseif (t_4 <= 0.0)
		tmp = fma(t_3, y, fma(a, Float64(Float64(t - x) / z), t));
	elseif (t_4 <= 2e+41)
		tmp = Float64(Float64(x * Float64(1.0 + Float64(Float64(z - y) / Float64(a - z)))) + Float64(Float64(Float64(y - z) * t) / Float64(a - z)));
	elseif (t_4 <= 5e+279)
		tmp = fma(t_3, y, Float64(x + Float64(Float64(x - t) * Float64(z / Float64(a - z)))));
	else
		tmp = Float64(x + fma(t_1, Float64(t - x), Float64(Float64(-t) / t_2)));
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a / z), $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(x + N[(N[(y - z), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -1e-230], N[(x + N[(t$95$1 * N[(t - x), $MachinePrecision] + N[(N[(x - t), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.0], N[(t$95$3 * y + N[(a * N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 2e+41], N[(N[(x * N[(1.0 + N[(N[(z - y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 5e+279], N[(t$95$3 * y + N[(x + N[(N[(x - t), $MachinePrecision] * N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$1 * N[(t - x), $MachinePrecision] + N[((-t) / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
t_1 := \frac{y}{a - z}\\
t_2 := \frac{a}{z} + -1\\
t_3 := \frac{t - x}{a - z}\\
t_4 := x + \left(y - z\right) \cdot t_3\\
\mathbf{if}\;t_4 \leq -1 \cdot 10^{-230}:\\
\;\;\;\;x + \mathsf{fma}\left(t_1, t - x, \frac{x - t}{t_2}\right)\\

\mathbf{elif}\;t_4 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(t_3, y, \mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\right)\\

\mathbf{elif}\;t_4 \leq 2 \cdot 10^{+41}:\\
\;\;\;\;x \cdot \left(1 + \frac{z - y}{a - z}\right) + \frac{\left(y - z\right) \cdot t}{a - z}\\

\mathbf{elif}\;t_4 \leq 5 \cdot 10^{+279}:\\
\;\;\;\;\mathsf{fma}\left(t_3, y, x + \left(x - t\right) \cdot \frac{z}{a - z}\right)\\

\mathbf{else}:\\
\;\;\;\;x + \mathsf{fma}\left(t_1, t - x, \frac{-t}{t_2}\right)\\


\end{array}

Error

Derivation

  1. Split input into 5 regimes
  2. if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.00000000000000005e-230

    1. Initial program 6.6

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

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

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

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

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

    1. Initial program 57.9

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{t - x}{a - z}, y, \color{blue}{\left(a \cdot \left(\frac{t}{z} - \frac{x}{z}\right) + x\right) - -1 \cdot \left(t - x\right)}\right) \]
    6. Simplified5.0

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

    if 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 2.00000000000000001e41

    1. Initial program 10.8

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

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

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

    if 2.00000000000000001e41 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 5.0000000000000002e279

    1. Initial program 2.3

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{t - x}{a - z}, y, x - \color{blue}{\left(-1 \cdot \frac{z \cdot x}{a - z} + \frac{t \cdot z}{a - z}\right)}\right) \]
    6. Simplified1.5

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

    if 5.0000000000000002e279 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z))))

    1. Initial program 22.2

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq -1 \cdot 10^{-230}:\\ \;\;\;\;x + \mathsf{fma}\left(\frac{y}{a - z}, t - x, \frac{x - t}{\frac{a}{z} + -1}\right)\\ \mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq 0:\\ \;\;\;\;\mathsf{fma}\left(\frac{t - x}{a - z}, y, \mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\right)\\ \mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq 2 \cdot 10^{+41}:\\ \;\;\;\;x \cdot \left(1 + \frac{z - y}{a - z}\right) + \frac{\left(y - z\right) \cdot t}{a - z}\\ \mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq 5 \cdot 10^{+279}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t - x}{a - z}, y, x + \left(x - t\right) \cdot \frac{z}{a - z}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \mathsf{fma}\left(\frac{y}{a - z}, t - x, \frac{-t}{\frac{a}{z} + -1}\right)\\ \end{array} \]

Reproduce

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