Numeric.Signal:interpolate from hsignal-0.2.7.1

Percentage Accurate: 81.0% → 95.0%
Time: 13.3s
Alternatives: 16
Speedup: 0.3×

Specification

?
\[\begin{array}{l} \\ x + \left(y - z\right) \cdot \frac{t - x}{a - z} \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
	return x + ((y - z) * ((t - x) / (a - z)));
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = x + ((y - z) * ((t - x) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
	return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a):
	return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a)
	return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z))))
end
function tmp = code(x, y, z, t, a)
	tmp = x + ((y - z) * ((t - x) / (a - z)));
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]
\begin{array}{l}

\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 16 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 81.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \left(y - z\right) \cdot \frac{t - x}{a - z} \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
	return x + ((y - z) * ((t - x) / (a - z)));
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = x + ((y - z) * ((t - x) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
	return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a):
	return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a)
	return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z))))
end
function tmp = code(x, y, z, t, a)
	tmp = x + ((y - z) * ((t - x) / (a - z)));
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]
\begin{array}{l}

\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}

Alternative 1: 95.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\ t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{-305}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 0:\\ \;\;\;\;\mathsf{fma}\left(\frac{t - x}{z}, a - y, t\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (fma (/ (- y z) (- a z)) (- t x) x))
        (t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
   (if (<= t_2 -2e-305)
     t_1
     (if (<= t_2 0.0) (fma (/ (- t x) z) (- a y) t) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = fma(((y - z) / (a - z)), (t - x), x);
	double t_2 = x + ((y - z) * ((t - x) / (a - z)));
	double tmp;
	if (t_2 <= -2e-305) {
		tmp = t_1;
	} else if (t_2 <= 0.0) {
		tmp = fma(((t - x) / z), (a - y), t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = fma(Float64(Float64(y - z) / Float64(a - z)), Float64(t - x), x)
	t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z))))
	tmp = 0.0
	if (t_2 <= -2e-305)
		tmp = t_1;
	elseif (t_2 <= 0.0)
		tmp = fma(Float64(Float64(t - x) / z), Float64(a - y), t);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-305], t$95$1, If[LessEqual[t$95$2, 0.0], N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * N[(a - y), $MachinePrecision] + t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-305}:\\
\;\;\;\;t\_1\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.99999999999999999e-305 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z))))

    1. Initial program 91.2%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto x + \color{blue}{\left(y - z\right)} \cdot \frac{t - x}{a - z} \]
      2. lift--.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \frac{t - x}{\color{blue}{a - z}} \]
      3. lift--.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \frac{\color{blue}{t - x}}{a - z} \]
      4. div-invN/A

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

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t - x}{a - z}} \]
      6. lift-/.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t - x}{a - z}} \]
      7. lift-*.f64N/A

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

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

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

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

    1. Initial program 3.3%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{\left(t + -1 \cdot \frac{y \cdot \left(t - x\right)}{z}\right) - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{y \cdot \left(t - x\right)}{z} + t\right)} - -1 \cdot \frac{a \cdot \left(t - x\right)}{z} \]
      2. associate--l+N/A

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

        \[\leadsto -1 \cdot \frac{y \cdot \left(t - x\right)}{z} + \color{blue}{\left(t + \left(\mathsf{neg}\left(-1 \cdot \frac{a \cdot \left(t - x\right)}{z}\right)\right)\right)} \]
      4. mul-1-negN/A

        \[\leadsto -1 \cdot \frac{y \cdot \left(t - x\right)}{z} + \left(t + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{a \cdot \left(t - x\right)}{z}\right)\right)}\right)\right)\right) \]
      5. remove-double-negN/A

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

        \[\leadsto -1 \cdot \frac{y \cdot \left(t - x\right)}{z} + \color{blue}{\left(\frac{a \cdot \left(t - x\right)}{z} + t\right)} \]
      7. associate-+r+N/A

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{y \cdot \left(t - x\right)}{z} + \frac{a \cdot \left(t - x\right)}{z}\right) + t} \]
      8. associate-/l*N/A

        \[\leadsto \left(-1 \cdot \frac{y \cdot \left(t - x\right)}{z} + \color{blue}{a \cdot \frac{t - x}{z}}\right) + t \]
      9. associate-/l*N/A

        \[\leadsto \left(-1 \cdot \color{blue}{\left(y \cdot \frac{t - x}{z}\right)} + a \cdot \frac{t - x}{z}\right) + t \]
      10. associate-*r*N/A

        \[\leadsto \left(\color{blue}{\left(-1 \cdot y\right) \cdot \frac{t - x}{z}} + a \cdot \frac{t - x}{z}\right) + t \]
      11. distribute-rgt-outN/A

        \[\leadsto \color{blue}{\frac{t - x}{z} \cdot \left(-1 \cdot y + a\right)} + t \]
      12. lower-fma.f64N/A

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

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

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

Alternative 2: 77.2% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ t_2 := x + \left(y - z\right) \cdot \frac{t}{a - z}\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\frac{y \cdot \left(t - x\right)}{a - z}\\ \mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-184}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 0:\\ \;\;\;\;\mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+277}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{a - z}, t - x, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z)))))
        (t_2 (+ x (* (- y z) (/ t (- a z))))))
   (if (<= t_1 (- INFINITY))
     (/ (* y (- t x)) (- a z))
     (if (<= t_1 -2e-184)
       t_2
       (if (<= t_1 0.0)
         (fma a (/ (- t x) z) t)
         (if (<= t_1 2e+277) t_2 (fma (/ y (- a z)) (- t x) x)))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = x + ((y - z) * ((t - x) / (a - z)));
	double t_2 = x + ((y - z) * (t / (a - z)));
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = (y * (t - x)) / (a - z);
	} else if (t_1 <= -2e-184) {
		tmp = t_2;
	} else if (t_1 <= 0.0) {
		tmp = fma(a, ((t - x) / z), t);
	} else if (t_1 <= 2e+277) {
		tmp = t_2;
	} else {
		tmp = fma((y / (a - z)), (t - x), x);
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z))))
	t_2 = Float64(x + Float64(Float64(y - z) * Float64(t / Float64(a - z))))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(Float64(y * Float64(t - x)) / Float64(a - z));
	elseif (t_1 <= -2e-184)
		tmp = t_2;
	elseif (t_1 <= 0.0)
		tmp = fma(a, Float64(Float64(t - x) / z), t);
	elseif (t_1 <= 2e+277)
		tmp = t_2;
	else
		tmp = fma(Float64(y / Float64(a - z)), Float64(t - x), x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -2e-184], t$95$2, If[LessEqual[t$95$1, 0.0], N[(a * N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[t$95$1, 2e+277], t$95$2, N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
t_2 := x + \left(y - z\right) \cdot \frac{t}{a - z}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{y \cdot \left(t - x\right)}{a - z}\\

\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-184}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+277}:\\
\;\;\;\;t\_2\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a - z}, t - x, x\right)\\


\end{array}
\end{array}
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 92.9%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf

      \[\leadsto \color{blue}{y \cdot \left(\frac{t}{a - z} - \frac{x}{a - z}\right)} \]
    4. Step-by-step derivation
      1. div-subN/A

        \[\leadsto y \cdot \color{blue}{\frac{t - x}{a - z}} \]
      2. associate-/l*N/A

        \[\leadsto \color{blue}{\frac{y \cdot \left(t - x\right)}{a - z}} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{y \cdot \left(t - x\right)}{a - z}} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{y \cdot \left(t - x\right)}}{a - z} \]
      5. lower--.f64N/A

        \[\leadsto \frac{y \cdot \color{blue}{\left(t - x\right)}}{a - z} \]
      6. lower--.f64100.0

        \[\leadsto \frac{y \cdot \left(t - x\right)}{\color{blue}{a - z}} \]
    5. Applied rewrites100.0%

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

    if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2.0000000000000001e-184 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 2.00000000000000001e277

    1. Initial program 94.5%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf

      \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t}{a - z}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

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

        \[\leadsto x + \left(y - z\right) \cdot \frac{t}{\color{blue}{a - z}} \]
    5. Applied rewrites79.9%

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

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

    1. Initial program 3.5%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto x + \color{blue}{\left(-1 \cdot z\right)} \cdot \frac{t - x}{a - z} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto x + \color{blue}{\left(\mathsf{neg}\left(z\right)\right)} \cdot \frac{t - x}{a - z} \]
      2. lower-neg.f643.5

        \[\leadsto x + \color{blue}{\left(-z\right)} \cdot \frac{t - x}{a - z} \]
    5. Applied rewrites3.5%

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

      \[\leadsto \color{blue}{t + \frac{a \cdot \left(t - x\right)}{z}} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{a \cdot \left(t - x\right)}{z} + t} \]
      2. associate-/l*N/A

        \[\leadsto \color{blue}{a \cdot \frac{t - x}{z}} + t \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{t - x}{z}, t\right)} \]
      4. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\frac{t - x}{z}}, t\right) \]
      5. lower--.f6476.8

        \[\leadsto \mathsf{fma}\left(a, \frac{\color{blue}{t - x}}{z}, t\right) \]
    8. Applied rewrites76.8%

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

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

    1. Initial program 82.7%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto x + \color{blue}{\left(y - z\right)} \cdot \frac{t - x}{a - z} \]
      2. lift--.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \frac{t - x}{\color{blue}{a - z}} \]
      3. lift--.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \frac{\color{blue}{t - x}}{a - z} \]
      4. div-invN/A

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

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t - x}{a - z}} \]
      6. lift-/.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t - x}{a - z}} \]
      7. lift-*.f64N/A

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

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{a - z}}, t - x, x\right) \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

Alternative 3: 40.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;y \cdot \frac{t}{a}\\ \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-145}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;t\_1 \leq 0:\\ \;\;\;\;t + \left(x - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
   (if (<= t_1 (- INFINITY))
     (* y (/ t a))
     (if (<= t_1 -1e-145) (+ x t) (if (<= t_1 0.0) (+ t (- x x)) (+ x t))))))
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 = y * (t / a);
	} else if (t_1 <= -1e-145) {
		tmp = x + t;
	} else if (t_1 <= 0.0) {
		tmp = t + (x - x);
	} else {
		tmp = x + t;
	}
	return tmp;
}
public static 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.POSITIVE_INFINITY) {
		tmp = y * (t / a);
	} else if (t_1 <= -1e-145) {
		tmp = x + t;
	} else if (t_1 <= 0.0) {
		tmp = t + (x - x);
	} else {
		tmp = x + t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = x + ((y - z) * ((t - x) / (a - z)))
	tmp = 0
	if t_1 <= -math.inf:
		tmp = y * (t / a)
	elif t_1 <= -1e-145:
		tmp = x + t
	elif t_1 <= 0.0:
		tmp = t + (x - x)
	else:
		tmp = x + t
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z))))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(y * Float64(t / a));
	elseif (t_1 <= -1e-145)
		tmp = Float64(x + t);
	elseif (t_1 <= 0.0)
		tmp = Float64(t + Float64(x - x));
	else
		tmp = Float64(x + t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = x + ((y - z) * ((t - x) / (a - z)));
	tmp = 0.0;
	if (t_1 <= -Inf)
		tmp = y * (t / a);
	elseif (t_1 <= -1e-145)
		tmp = x + t;
	elseif (t_1 <= 0.0)
		tmp = t + (x - x);
	else
		tmp = x + t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -1e-145], N[(x + t), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(t + N[(x - x), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;y \cdot \frac{t}{a}\\

\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-145}:\\
\;\;\;\;x + t\\

\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t + \left(x - x\right)\\

\mathbf{else}:\\
\;\;\;\;x + t\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0

    1. Initial program 92.9%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{x + \frac{y \cdot \left(t - x\right)}{a}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{y \cdot \left(t - x\right)}{a} + x} \]
      2. associate-/l*N/A

        \[\leadsto \color{blue}{y \cdot \frac{t - x}{a}} + x \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)} \]
      4. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{t - x}{a}}, x\right) \]
      5. lower--.f6478.9

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{t - x}}{a}, x\right) \]
    5. Applied rewrites78.9%

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

      \[\leadsto \color{blue}{\frac{t \cdot y}{a}} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y \cdot t}}{a} \]
      2. associate-/l*N/A

        \[\leadsto \color{blue}{y \cdot \frac{t}{a}} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \frac{t}{a}} \]
      4. lower-/.f6457.5

        \[\leadsto y \cdot \color{blue}{\frac{t}{a}} \]
    8. Applied rewrites57.5%

      \[\leadsto \color{blue}{y \cdot \frac{t}{a}} \]

    if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -9.99999999999999915e-146 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z))))

    1. Initial program 93.2%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf

      \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t}{a - z}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

      \[\leadsto \color{blue}{t + x} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{x + t} \]
      2. lower-+.f6444.4

        \[\leadsto \color{blue}{x + t} \]
    8. Applied rewrites44.4%

      \[\leadsto \color{blue}{x + t} \]

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

    1. Initial program 8.2%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    4. Step-by-step derivation
      1. lower--.f6410.5

        \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    5. Applied rewrites10.5%

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    6. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto x + \color{blue}{\left(t - x\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(t - x\right) + x} \]
      3. lift--.f64N/A

        \[\leadsto \color{blue}{\left(t - x\right)} + x \]
      4. associate-+l-N/A

        \[\leadsto \color{blue}{t - \left(x - x\right)} \]
      5. lower--.f64N/A

        \[\leadsto \color{blue}{t - \left(x - x\right)} \]
      6. lower--.f6443.6

        \[\leadsto t - \color{blue}{\left(x - x\right)} \]
    7. Applied rewrites43.6%

      \[\leadsto \color{blue}{t - \left(x - x\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification45.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq -\infty:\\ \;\;\;\;y \cdot \frac{t}{a}\\ \mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq -1 \cdot 10^{-145}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq 0:\\ \;\;\;\;t + \left(x - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 37.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \mathbf{if}\;t\_1 \leq -1 \cdot 10^{-145}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;t\_1 \leq 10^{-270}:\\ \;\;\;\;t + \left(x - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
   (if (<= t_1 -1e-145) (+ x t) (if (<= t_1 1e-270) (+ t (- x x)) (+ x t)))))
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 <= -1e-145) {
		tmp = x + t;
	} else if (t_1 <= 1e-270) {
		tmp = t + (x - x);
	} else {
		tmp = x + t;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x + ((y - z) * ((t - x) / (a - z)))
    if (t_1 <= (-1d-145)) then
        tmp = x + t
    else if (t_1 <= 1d-270) then
        tmp = t + (x - x)
    else
        tmp = x + t
    end if
    code = tmp
end function
public static 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 <= -1e-145) {
		tmp = x + t;
	} else if (t_1 <= 1e-270) {
		tmp = t + (x - x);
	} else {
		tmp = x + t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = x + ((y - z) * ((t - x) / (a - z)))
	tmp = 0
	if t_1 <= -1e-145:
		tmp = x + t
	elif t_1 <= 1e-270:
		tmp = t + (x - x)
	else:
		tmp = x + t
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z))))
	tmp = 0.0
	if (t_1 <= -1e-145)
		tmp = Float64(x + t);
	elseif (t_1 <= 1e-270)
		tmp = Float64(t + Float64(x - x));
	else
		tmp = Float64(x + t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = x + ((y - z) * ((t - x) / (a - z)));
	tmp = 0.0;
	if (t_1 <= -1e-145)
		tmp = x + t;
	elseif (t_1 <= 1e-270)
		tmp = t + (x - x);
	else
		tmp = x + t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-145], N[(x + t), $MachinePrecision], If[LessEqual[t$95$1, 1e-270], N[(t + N[(x - x), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-145}:\\
\;\;\;\;x + t\\

\mathbf{elif}\;t\_1 \leq 10^{-270}:\\
\;\;\;\;t + \left(x - x\right)\\

\mathbf{else}:\\
\;\;\;\;x + t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -9.99999999999999915e-146 or 1e-270 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z))))

    1. Initial program 93.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf

      \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t}{a - z}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

      \[\leadsto \color{blue}{t + x} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{x + t} \]
      2. lower-+.f6441.8

        \[\leadsto \color{blue}{x + t} \]
    8. Applied rewrites41.8%

      \[\leadsto \color{blue}{x + t} \]

    if -9.99999999999999915e-146 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1e-270

    1. Initial program 10.4%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    4. Step-by-step derivation
      1. lower--.f6410.3

        \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    5. Applied rewrites10.3%

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    6. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto x + \color{blue}{\left(t - x\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(t - x\right) + x} \]
      3. lift--.f64N/A

        \[\leadsto \color{blue}{\left(t - x\right)} + x \]
      4. associate-+l-N/A

        \[\leadsto \color{blue}{t - \left(x - x\right)} \]
      5. lower--.f64N/A

        \[\leadsto \color{blue}{t - \left(x - x\right)} \]
      6. lower--.f6442.7

        \[\leadsto t - \color{blue}{\left(x - x\right)} \]
    7. Applied rewrites42.7%

      \[\leadsto \color{blue}{t - \left(x - x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification42.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq -1 \cdot 10^{-145}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq 10^{-270}:\\ \;\;\;\;t + \left(x - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 71.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(\frac{y}{a - z}, t - x, x\right)\\ t_2 := \mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\ \mathbf{if}\;z \leq -4 \cdot 10^{+145}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-41}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 3 \cdot 10^{+65}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{t}{a - z}\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{+101}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (fma (/ y (- a z)) (- t x) x)) (t_2 (fma a (/ (- t x) z) t)))
   (if (<= z -4e+145)
     t_2
     (if (<= z 1.25e-41)
       t_1
       (if (<= z 3e+65)
         (* (- y z) (/ t (- a z)))
         (if (<= z 2.6e+101) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = fma((y / (a - z)), (t - x), x);
	double t_2 = fma(a, ((t - x) / z), t);
	double tmp;
	if (z <= -4e+145) {
		tmp = t_2;
	} else if (z <= 1.25e-41) {
		tmp = t_1;
	} else if (z <= 3e+65) {
		tmp = (y - z) * (t / (a - z));
	} else if (z <= 2.6e+101) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = fma(Float64(y / Float64(a - z)), Float64(t - x), x)
	t_2 = fma(a, Float64(Float64(t - x) / z), t)
	tmp = 0.0
	if (z <= -4e+145)
		tmp = t_2;
	elseif (z <= 1.25e-41)
		tmp = t_1;
	elseif (z <= 3e+65)
		tmp = Float64(Float64(y - z) * Float64(t / Float64(a - z)));
	elseif (z <= 2.6e+101)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(a * N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -4e+145], t$95$2, If[LessEqual[z, 1.25e-41], t$95$1, If[LessEqual[z, 3e+65], N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.6e+101], t$95$1, t$95$2]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{a - z}, t - x, x\right)\\
t_2 := \mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\
\mathbf{if}\;z \leq -4 \cdot 10^{+145}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;z \leq 1.25 \cdot 10^{-41}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 3 \cdot 10^{+65}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{t}{a - z}\\

\mathbf{elif}\;z \leq 2.6 \cdot 10^{+101}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4e145 or 2.6e101 < z

    1. Initial program 55.8%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto x + \color{blue}{\left(-1 \cdot z\right)} \cdot \frac{t - x}{a - z} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto x + \color{blue}{\left(\mathsf{neg}\left(z\right)\right)} \cdot \frac{t - x}{a - z} \]
      2. lower-neg.f6447.4

        \[\leadsto x + \color{blue}{\left(-z\right)} \cdot \frac{t - x}{a - z} \]
    5. Applied rewrites47.4%

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

      \[\leadsto \color{blue}{t + \frac{a \cdot \left(t - x\right)}{z}} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{a \cdot \left(t - x\right)}{z} + t} \]
      2. associate-/l*N/A

        \[\leadsto \color{blue}{a \cdot \frac{t - x}{z}} + t \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{t - x}{z}, t\right)} \]
      4. lower-/.f64N/A

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

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

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

    if -4e145 < z < 1.2499999999999999e-41 or 3.0000000000000002e65 < z < 2.6e101

    1. Initial program 90.3%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto x + \color{blue}{\left(y - z\right)} \cdot \frac{t - x}{a - z} \]
      2. lift--.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \frac{t - x}{\color{blue}{a - z}} \]
      3. lift--.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \frac{\color{blue}{t - x}}{a - z} \]
      4. div-invN/A

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

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t - x}{a - z}} \]
      6. lift-/.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t - x}{a - z}} \]
      7. lift-*.f64N/A

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

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{a - z}}, t - x, x\right) \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

    if 1.2499999999999999e-41 < z < 3.0000000000000002e65

    1. Initial program 82.4%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{t \cdot \left(y - z\right)}}{a - z} \]
      3. lower--.f64N/A

        \[\leadsto \frac{t \cdot \color{blue}{\left(y - z\right)}}{a - z} \]
      4. lower--.f6475.0

        \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{a - z}} \]
    5. Applied rewrites75.0%

      \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
    6. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \frac{t \cdot \color{blue}{\left(y - z\right)}}{a - z} \]
      2. lift--.f64N/A

        \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{a - z}} \]
      3. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{t}{a - z} \cdot \left(y - z\right)} \]
      4. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{t}{a - z}} \cdot \left(y - z\right) \]
      5. lower-*.f6481.7

        \[\leadsto \color{blue}{\frac{t}{a - z} \cdot \left(y - z\right)} \]
    7. Applied rewrites81.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4 \cdot 10^{+145}:\\ \;\;\;\;\mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-41}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{a - z}, t - x, x\right)\\ \mathbf{elif}\;z \leq 3 \cdot 10^{+65}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{t}{a - z}\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{+101}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{a - z}, t - x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 65.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(y - z\right) \cdot \frac{t}{a - z}\\ t_2 := \mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\ \mathbf{if}\;z \leq -2.25 \cdot 10^{+163}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq -4 \cdot 10^{-12}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{-50}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{+149}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* (- y z) (/ t (- a z)))) (t_2 (fma a (/ (- t x) z) t)))
   (if (<= z -2.25e+163)
     t_2
     (if (<= z -4e-12)
       t_1
       (if (<= z 3.1e-50)
         (fma (/ y a) (- t x) x)
         (if (<= z 5.5e+149) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = (y - z) * (t / (a - z));
	double t_2 = fma(a, ((t - x) / z), t);
	double tmp;
	if (z <= -2.25e+163) {
		tmp = t_2;
	} else if (z <= -4e-12) {
		tmp = t_1;
	} else if (z <= 3.1e-50) {
		tmp = fma((y / a), (t - x), x);
	} else if (z <= 5.5e+149) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = Float64(Float64(y - z) * Float64(t / Float64(a - z)))
	t_2 = fma(a, Float64(Float64(t - x) / z), t)
	tmp = 0.0
	if (z <= -2.25e+163)
		tmp = t_2;
	elseif (z <= -4e-12)
		tmp = t_1;
	elseif (z <= 3.1e-50)
		tmp = fma(Float64(y / a), Float64(t - x), x);
	elseif (z <= 5.5e+149)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(a * N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -2.25e+163], t$95$2, If[LessEqual[z, -4e-12], t$95$1, If[LessEqual[z, 3.1e-50], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 5.5e+149], t$95$1, t$95$2]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \frac{t}{a - z}\\
t_2 := \mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\
\mathbf{if}\;z \leq -2.25 \cdot 10^{+163}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;z \leq -4 \cdot 10^{-12}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 5.5 \cdot 10^{+149}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.24999999999999994e163 or 5.49999999999999999e149 < z

    1. Initial program 48.6%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto x + \color{blue}{\left(-1 \cdot z\right)} \cdot \frac{t - x}{a - z} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto x + \color{blue}{\left(\mathsf{neg}\left(z\right)\right)} \cdot \frac{t - x}{a - z} \]
      2. lower-neg.f6441.4

        \[\leadsto x + \color{blue}{\left(-z\right)} \cdot \frac{t - x}{a - z} \]
    5. Applied rewrites41.4%

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

      \[\leadsto \color{blue}{t + \frac{a \cdot \left(t - x\right)}{z}} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{a \cdot \left(t - x\right)}{z} + t} \]
      2. associate-/l*N/A

        \[\leadsto \color{blue}{a \cdot \frac{t - x}{z}} + t \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{t - x}{z}, t\right)} \]
      4. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\frac{t - x}{z}}, t\right) \]
      5. lower--.f6473.9

        \[\leadsto \mathsf{fma}\left(a, \frac{\color{blue}{t - x}}{z}, t\right) \]
    8. Applied rewrites73.9%

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

    if -2.24999999999999994e163 < z < -3.99999999999999992e-12 or 3.1000000000000002e-50 < z < 5.49999999999999999e149

    1. Initial program 82.6%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{t \cdot \left(y - z\right)}}{a - z} \]
      3. lower--.f64N/A

        \[\leadsto \frac{t \cdot \color{blue}{\left(y - z\right)}}{a - z} \]
      4. lower--.f6457.6

        \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{a - z}} \]
    5. Applied rewrites57.6%

      \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
    6. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \frac{t \cdot \color{blue}{\left(y - z\right)}}{a - z} \]
      2. lift--.f64N/A

        \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{a - z}} \]
      3. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{t}{a - z} \cdot \left(y - z\right)} \]
      4. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{t}{a - z}} \cdot \left(y - z\right) \]
      5. lower-*.f6465.8

        \[\leadsto \color{blue}{\frac{t}{a - z} \cdot \left(y - z\right)} \]
    7. Applied rewrites65.8%

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

    if -3.99999999999999992e-12 < z < 3.1000000000000002e-50

    1. Initial program 93.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto x + \color{blue}{\left(y - z\right)} \cdot \frac{t - x}{a - z} \]
      2. lift--.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \frac{t - x}{\color{blue}{a - z}} \]
      3. lift--.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \frac{\color{blue}{t - x}}{a - z} \]
      4. div-invN/A

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

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t - x}{a - z}} \]
      6. lift-/.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t - x}{a - z}} \]
      7. lift-*.f64N/A

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

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{a}}, t - x, x\right) \]
    6. Step-by-step derivation
      1. lower-/.f6475.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.25 \cdot 10^{+163}:\\ \;\;\;\;\mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\ \mathbf{elif}\;z \leq -4 \cdot 10^{-12}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{t}{a - z}\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{-50}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{+149}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{t}{a - z}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 70.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\ \mathbf{if}\;z \leq -2.1 \cdot 10^{+145}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 9.8 \cdot 10^{-42}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a - z}, x\right)\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{+149}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{t}{a - z}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (fma a (/ (- t x) z) t)))
   (if (<= z -2.1e+145)
     t_1
     (if (<= z 9.8e-42)
       (fma y (/ (- t x) (- a z)) x)
       (if (<= z 5.5e+149) (* (- y z) (/ t (- a z))) t_1)))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = fma(a, ((t - x) / z), t);
	double tmp;
	if (z <= -2.1e+145) {
		tmp = t_1;
	} else if (z <= 9.8e-42) {
		tmp = fma(y, ((t - x) / (a - z)), x);
	} else if (z <= 5.5e+149) {
		tmp = (y - z) * (t / (a - z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = fma(a, Float64(Float64(t - x) / z), t)
	tmp = 0.0
	if (z <= -2.1e+145)
		tmp = t_1;
	elseif (z <= 9.8e-42)
		tmp = fma(y, Float64(Float64(t - x) / Float64(a - z)), x);
	elseif (z <= 5.5e+149)
		tmp = Float64(Float64(y - z) * Float64(t / Float64(a - z)));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -2.1e+145], t$95$1, If[LessEqual[z, 9.8e-42], N[(y * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 5.5e+149], N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\
\mathbf{if}\;z \leq -2.1 \cdot 10^{+145}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 5.5 \cdot 10^{+149}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{t}{a - z}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.09999999999999989e145 or 5.49999999999999999e149 < z

    1. Initial program 51.8%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto x + \color{blue}{\left(-1 \cdot z\right)} \cdot \frac{t - x}{a - z} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto x + \color{blue}{\left(\mathsf{neg}\left(z\right)\right)} \cdot \frac{t - x}{a - z} \]
      2. lower-neg.f6443.7

        \[\leadsto x + \color{blue}{\left(-z\right)} \cdot \frac{t - x}{a - z} \]
    5. Applied rewrites43.7%

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

      \[\leadsto \color{blue}{t + \frac{a \cdot \left(t - x\right)}{z}} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{a \cdot \left(t - x\right)}{z} + t} \]
      2. associate-/l*N/A

        \[\leadsto \color{blue}{a \cdot \frac{t - x}{z}} + t \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{t - x}{z}, t\right)} \]
      4. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\frac{t - x}{z}}, t\right) \]
      5. lower--.f6474.0

        \[\leadsto \mathsf{fma}\left(a, \frac{\color{blue}{t - x}}{z}, t\right) \]
    8. Applied rewrites74.0%

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

    if -2.09999999999999989e145 < z < 9.8000000000000001e-42

    1. Initial program 91.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto x + \color{blue}{\left(y - z\right)} \cdot \frac{t - x}{a - z} \]
      2. lift--.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \frac{t - x}{\color{blue}{a - z}} \]
      3. lift--.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \frac{\color{blue}{t - x}}{a - z} \]
      4. div-invN/A

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

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t - x}{a - z}} \]
      6. lift-/.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t - x}{a - z}} \]
      7. lift-*.f64N/A

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

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{a - z}}, t - x, x\right) \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{a - z}}, t - x, x\right) \]
    8. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \frac{y}{\color{blue}{a - z}} \cdot \left(t - x\right) + x \]
      2. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{y}{a - z}} \cdot \left(t - x\right) + x \]
      3. lift--.f64N/A

        \[\leadsto \frac{y}{a - z} \cdot \color{blue}{\left(t - x\right)} + x \]
      4. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{y}{a - z}} \cdot \left(t - x\right) + x \]
      5. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{y \cdot \left(t - x\right)}{a - z}} + x \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{y \cdot \frac{t - x}{a - z}} + x \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{t - x}{a - z}, x\right)} \]
      8. lower-/.f6479.7

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

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

    if 9.8000000000000001e-42 < z < 5.49999999999999999e149

    1. Initial program 80.8%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{t \cdot \left(y - z\right)}}{a - z} \]
      3. lower--.f64N/A

        \[\leadsto \frac{t \cdot \color{blue}{\left(y - z\right)}}{a - z} \]
      4. lower--.f6459.8

        \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{a - z}} \]
    5. Applied rewrites59.8%

      \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
    6. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \frac{t \cdot \color{blue}{\left(y - z\right)}}{a - z} \]
      2. lift--.f64N/A

        \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{a - z}} \]
      3. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{t}{a - z} \cdot \left(y - z\right)} \]
      4. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{t}{a - z}} \cdot \left(y - z\right) \]
      5. lower-*.f6467.8

        \[\leadsto \color{blue}{\frac{t}{a - z} \cdot \left(y - z\right)} \]
    7. Applied rewrites67.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.1 \cdot 10^{+145}:\\ \;\;\;\;\mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\ \mathbf{elif}\;z \leq 9.8 \cdot 10^{-42}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a - z}, x\right)\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{+149}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{t}{a - z}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 63.3% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\ \mathbf{if}\;z \leq -4.9 \cdot 10^{+104}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 9.8 \cdot 10^{-42}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{+148}:\\ \;\;\;\;\mathsf{fma}\left(t, \frac{y}{-z}, t\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (fma a (/ (- t x) z) t)))
   (if (<= z -4.9e+104)
     t_1
     (if (<= z 9.8e-42)
       (fma (/ y a) (- t x) x)
       (if (<= z 7.2e+148) (fma t (/ y (- z)) t) t_1)))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = fma(a, ((t - x) / z), t);
	double tmp;
	if (z <= -4.9e+104) {
		tmp = t_1;
	} else if (z <= 9.8e-42) {
		tmp = fma((y / a), (t - x), x);
	} else if (z <= 7.2e+148) {
		tmp = fma(t, (y / -z), t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = fma(a, Float64(Float64(t - x) / z), t)
	tmp = 0.0
	if (z <= -4.9e+104)
		tmp = t_1;
	elseif (z <= 9.8e-42)
		tmp = fma(Float64(y / a), Float64(t - x), x);
	elseif (z <= 7.2e+148)
		tmp = fma(t, Float64(y / Float64(-z)), t);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -4.9e+104], t$95$1, If[LessEqual[z, 9.8e-42], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 7.2e+148], N[(t * N[(y / (-z)), $MachinePrecision] + t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, \frac{t - x}{z}, t\right)\\
\mathbf{if}\;z \leq -4.9 \cdot 10^{+104}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 7.2 \cdot 10^{+148}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y}{-z}, t\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.89999999999999985e104 or 7.20000000000000013e148 < z

    1. Initial program 57.7%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto x + \color{blue}{\left(-1 \cdot z\right)} \cdot \frac{t - x}{a - z} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto x + \color{blue}{\left(\mathsf{neg}\left(z\right)\right)} \cdot \frac{t - x}{a - z} \]
      2. lower-neg.f6442.6

        \[\leadsto x + \color{blue}{\left(-z\right)} \cdot \frac{t - x}{a - z} \]
    5. Applied rewrites42.6%

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

      \[\leadsto \color{blue}{t + \frac{a \cdot \left(t - x\right)}{z}} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{a \cdot \left(t - x\right)}{z} + t} \]
      2. associate-/l*N/A

        \[\leadsto \color{blue}{a \cdot \frac{t - x}{z}} + t \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{t - x}{z}, t\right)} \]
      4. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\frac{t - x}{z}}, t\right) \]
      5. lower--.f6465.7

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

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

    if -4.89999999999999985e104 < z < 9.8000000000000001e-42

    1. Initial program 92.3%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto x + \color{blue}{\left(y - z\right)} \cdot \frac{t - x}{a - z} \]
      2. lift--.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \frac{t - x}{\color{blue}{a - z}} \]
      3. lift--.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \frac{\color{blue}{t - x}}{a - z} \]
      4. div-invN/A

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

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t - x}{a - z}} \]
      6. lift-/.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t - x}{a - z}} \]
      7. lift-*.f64N/A

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

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{a}}, t - x, x\right) \]
    6. Step-by-step derivation
      1. lower-/.f6472.1

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

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

    if 9.8000000000000001e-42 < z < 7.20000000000000013e148

    1. Initial program 80.8%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{t \cdot \left(y - z\right)}}{a - z} \]
      3. lower--.f64N/A

        \[\leadsto \frac{t \cdot \color{blue}{\left(y - z\right)}}{a - z} \]
      4. lower--.f6459.8

        \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{a - z}} \]
    5. Applied rewrites59.8%

      \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
    6. Taylor expanded in a around 0

      \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{-1 \cdot z}} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{\mathsf{neg}\left(z\right)}} \]
      2. lower-neg.f6448.5

        \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{-z}} \]
    8. Applied rewrites48.5%

      \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{-z}} \]
    9. Taylor expanded in y around 0

      \[\leadsto \color{blue}{t + -1 \cdot \frac{t \cdot y}{z}} \]
    10. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{z} + t} \]
      2. mul-1-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{t \cdot y}{z}\right)\right)} + t \]
      3. associate-/l*N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{t \cdot \frac{y}{z}}\right)\right) + t \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{t \cdot \left(\mathsf{neg}\left(\frac{y}{z}\right)\right)} + t \]
      5. mul-1-negN/A

        \[\leadsto t \cdot \color{blue}{\left(-1 \cdot \frac{y}{z}\right)} + t \]
      6. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, -1 \cdot \frac{y}{z}, t\right)} \]
      7. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\mathsf{neg}\left(\frac{y}{z}\right)}, t\right) \]
      8. distribute-neg-frac2N/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\frac{y}{\mathsf{neg}\left(z\right)}}, t\right) \]
      9. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\frac{y}{\mathsf{neg}\left(z\right)}}, t\right) \]
      10. lower-neg.f6458.6

        \[\leadsto \mathsf{fma}\left(t, \frac{y}{\color{blue}{-z}}, t\right) \]
    11. Applied rewrites58.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(t, \frac{y}{-z}, t\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 9: 60.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\ \mathbf{if}\;a \leq -8000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 2 \cdot 10^{-47}:\\ \;\;\;\;\mathsf{fma}\left(t, \frac{y}{-z}, t\right)\\ \mathbf{elif}\;a \leq 4.7 \cdot 10^{+139}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, \frac{y - z}{a}, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (fma y (/ (- t x) a) x)))
   (if (<= a -8000.0)
     t_1
     (if (<= a 2e-47)
       (fma t (/ y (- z)) t)
       (if (<= a 4.7e+139) t_1 (fma t (/ (- y z) a) x))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = fma(y, ((t - x) / a), x);
	double tmp;
	if (a <= -8000.0) {
		tmp = t_1;
	} else if (a <= 2e-47) {
		tmp = fma(t, (y / -z), t);
	} else if (a <= 4.7e+139) {
		tmp = t_1;
	} else {
		tmp = fma(t, ((y - z) / a), x);
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = fma(y, Float64(Float64(t - x) / a), x)
	tmp = 0.0
	if (a <= -8000.0)
		tmp = t_1;
	elseif (a <= 2e-47)
		tmp = fma(t, Float64(y / Float64(-z)), t);
	elseif (a <= 4.7e+139)
		tmp = t_1;
	else
		tmp = fma(t, Float64(Float64(y - z) / a), x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -8000.0], t$95$1, If[LessEqual[a, 2e-47], N[(t * N[(y / (-z)), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[a, 4.7e+139], t$95$1, N[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;a \leq -8000:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;a \leq 4.7 \cdot 10^{+139}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y - z}{a}, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -8e3 or 1.9999999999999999e-47 < a < 4.7000000000000001e139

    1. Initial program 84.4%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{x + \frac{y \cdot \left(t - x\right)}{a}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{y \cdot \left(t - x\right)}{a} + x} \]
      2. associate-/l*N/A

        \[\leadsto \color{blue}{y \cdot \frac{t - x}{a}} + x \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)} \]
      4. lower-/.f64N/A

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

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

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

    if -8e3 < a < 1.9999999999999999e-47

    1. Initial program 72.2%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{t \cdot \left(y - z\right)}}{a - z} \]
      3. lower--.f64N/A

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

        \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{a - z}} \]
    5. Applied rewrites59.1%

      \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
    6. Taylor expanded in a around 0

      \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{-1 \cdot z}} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{\mathsf{neg}\left(z\right)}} \]
      2. lower-neg.f6450.5

        \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{-z}} \]
    8. Applied rewrites50.5%

      \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{-z}} \]
    9. Taylor expanded in y around 0

      \[\leadsto \color{blue}{t + -1 \cdot \frac{t \cdot y}{z}} \]
    10. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{z} + t} \]
      2. mul-1-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{t \cdot y}{z}\right)\right)} + t \]
      3. associate-/l*N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{t \cdot \frac{y}{z}}\right)\right) + t \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{t \cdot \left(\mathsf{neg}\left(\frac{y}{z}\right)\right)} + t \]
      5. mul-1-negN/A

        \[\leadsto t \cdot \color{blue}{\left(-1 \cdot \frac{y}{z}\right)} + t \]
      6. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, -1 \cdot \frac{y}{z}, t\right)} \]
      7. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\mathsf{neg}\left(\frac{y}{z}\right)}, t\right) \]
      8. distribute-neg-frac2N/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\frac{y}{\mathsf{neg}\left(z\right)}}, t\right) \]
      9. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\frac{y}{\mathsf{neg}\left(z\right)}}, t\right) \]
      10. lower-neg.f6463.8

        \[\leadsto \mathsf{fma}\left(t, \frac{y}{\color{blue}{-z}}, t\right) \]
    11. Applied rewrites63.8%

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

    if 4.7000000000000001e139 < a

    1. Initial program 91.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf

      \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t}{a - z}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

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

        \[\leadsto x + \left(y - z\right) \cdot \frac{t}{\color{blue}{a - z}} \]
    5. Applied rewrites87.9%

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

      \[\leadsto \color{blue}{x + \frac{t \cdot \left(y - z\right)}{a}} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a} + x} \]
      2. associate-/l*N/A

        \[\leadsto \color{blue}{t \cdot \frac{y - z}{a}} + x \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, \frac{y - z}{a}, x\right)} \]
      4. lower-/.f64N/A

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

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

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

Alternative 10: 80.0% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.9 \cdot 10^{+104}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t - x}{z}, a - y, t\right)\\ \mathbf{elif}\;z \leq 0.025:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{a - z}, t - x, x\right)\\ \mathbf{else}:\\ \;\;\;\;t + \left(t - x\right) \cdot \frac{a - y}{z}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -4.9e+104)
   (fma (/ (- t x) z) (- a y) t)
   (if (<= z 0.025)
     (fma (/ y (- a z)) (- t x) x)
     (+ t (* (- t x) (/ (- a y) z))))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -4.9e+104) {
		tmp = fma(((t - x) / z), (a - y), t);
	} else if (z <= 0.025) {
		tmp = fma((y / (a - z)), (t - x), x);
	} else {
		tmp = t + ((t - x) * ((a - y) / z));
	}
	return tmp;
}
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -4.9e+104)
		tmp = fma(Float64(Float64(t - x) / z), Float64(a - y), t);
	elseif (z <= 0.025)
		tmp = fma(Float64(y / Float64(a - z)), Float64(t - x), x);
	else
		tmp = Float64(t + Float64(Float64(t - x) * Float64(Float64(a - y) / z)));
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.9e+104], N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * N[(a - y), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[z, 0.025], N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], N[(t + N[(N[(t - x), $MachinePrecision] * N[(N[(a - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.9 \cdot 10^{+104}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{z}, a - y, t\right)\\

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

\mathbf{else}:\\
\;\;\;\;t + \left(t - x\right) \cdot \frac{a - y}{z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.89999999999999985e104

    1. Initial program 56.3%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{\left(t + -1 \cdot \frac{y \cdot \left(t - x\right)}{z}\right) - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{y \cdot \left(t - x\right)}{z} + t\right)} - -1 \cdot \frac{a \cdot \left(t - x\right)}{z} \]
      2. associate--l+N/A

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

        \[\leadsto -1 \cdot \frac{y \cdot \left(t - x\right)}{z} + \color{blue}{\left(t + \left(\mathsf{neg}\left(-1 \cdot \frac{a \cdot \left(t - x\right)}{z}\right)\right)\right)} \]
      4. mul-1-negN/A

        \[\leadsto -1 \cdot \frac{y \cdot \left(t - x\right)}{z} + \left(t + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{a \cdot \left(t - x\right)}{z}\right)\right)}\right)\right)\right) \]
      5. remove-double-negN/A

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

        \[\leadsto -1 \cdot \frac{y \cdot \left(t - x\right)}{z} + \color{blue}{\left(\frac{a \cdot \left(t - x\right)}{z} + t\right)} \]
      7. associate-+r+N/A

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{y \cdot \left(t - x\right)}{z} + \frac{a \cdot \left(t - x\right)}{z}\right) + t} \]
      8. associate-/l*N/A

        \[\leadsto \left(-1 \cdot \frac{y \cdot \left(t - x\right)}{z} + \color{blue}{a \cdot \frac{t - x}{z}}\right) + t \]
      9. associate-/l*N/A

        \[\leadsto \left(-1 \cdot \color{blue}{\left(y \cdot \frac{t - x}{z}\right)} + a \cdot \frac{t - x}{z}\right) + t \]
      10. associate-*r*N/A

        \[\leadsto \left(\color{blue}{\left(-1 \cdot y\right) \cdot \frac{t - x}{z}} + a \cdot \frac{t - x}{z}\right) + t \]
      11. distribute-rgt-outN/A

        \[\leadsto \color{blue}{\frac{t - x}{z} \cdot \left(-1 \cdot y + a\right)} + t \]
      12. lower-fma.f64N/A

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

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

    if -4.89999999999999985e104 < z < 0.025000000000000001

    1. Initial program 92.9%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto x + \color{blue}{\left(y - z\right)} \cdot \frac{t - x}{a - z} \]
      2. lift--.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \frac{t - x}{\color{blue}{a - z}} \]
      3. lift--.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \frac{\color{blue}{t - x}}{a - z} \]
      4. div-invN/A

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

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t - x}{a - z}} \]
      6. lift-/.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t - x}{a - z}} \]
      7. lift-*.f64N/A

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

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{a - z}}, t - x, x\right) \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

    if 0.025000000000000001 < z

    1. Initial program 68.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto x + \color{blue}{\left(y - z\right)} \cdot \frac{t - x}{a - z} \]
      2. lift--.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \frac{t - x}{\color{blue}{a - z}} \]
      3. lift--.f64N/A

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

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{1}{\frac{a - z}{t - x}}} \]
      5. un-div-invN/A

        \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
      6. lower-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
      7. lower-/.f6468.4

        \[\leadsto x + \frac{y - z}{\color{blue}{\frac{a - z}{t - x}}} \]
    4. Applied rewrites68.4%

      \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    5. Taylor expanded in z around inf

      \[\leadsto \color{blue}{\left(t + -1 \cdot \frac{y \cdot \left(t - x\right)}{z}\right) - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}} \]
    6. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \color{blue}{t + \left(-1 \cdot \frac{y \cdot \left(t - x\right)}{z} - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}\right)} \]
      2. distribute-lft-out--N/A

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

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

        \[\leadsto t + \color{blue}{\left(\mathsf{neg}\left(\frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\right)\right)} \]
      5. unsub-negN/A

        \[\leadsto \color{blue}{t - \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}} \]
      6. lower--.f64N/A

        \[\leadsto \color{blue}{t - \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}} \]
      7. distribute-rgt-out--N/A

        \[\leadsto t - \frac{\color{blue}{\left(t - x\right) \cdot \left(y - a\right)}}{z} \]
      8. associate-/l*N/A

        \[\leadsto t - \color{blue}{\left(t - x\right) \cdot \frac{y - a}{z}} \]
      9. lower-*.f64N/A

        \[\leadsto t - \color{blue}{\left(t - x\right) \cdot \frac{y - a}{z}} \]
      10. lower--.f64N/A

        \[\leadsto t - \color{blue}{\left(t - x\right)} \cdot \frac{y - a}{z} \]
      11. lower-/.f64N/A

        \[\leadsto t - \left(t - x\right) \cdot \color{blue}{\frac{y - a}{z}} \]
      12. lower--.f6477.7

        \[\leadsto t - \left(t - x\right) \cdot \frac{\color{blue}{y - a}}{z} \]
    7. Applied rewrites77.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.9 \cdot 10^{+104}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t - x}{z}, a - y, t\right)\\ \mathbf{elif}\;z \leq 0.025:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{a - z}, t - x, x\right)\\ \mathbf{else}:\\ \;\;\;\;t + \left(t - x\right) \cdot \frac{a - y}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 80.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t + \left(t - x\right) \cdot \frac{a - y}{z}\\ \mathbf{if}\;z \leq -4.9 \cdot 10^{+104}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 0.025:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{a - z}, t - x, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ t (* (- t x) (/ (- a y) z)))))
   (if (<= z -4.9e+104)
     t_1
     (if (<= z 0.025) (fma (/ y (- a z)) (- t x) x) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = t + ((t - x) * ((a - y) / z));
	double tmp;
	if (z <= -4.9e+104) {
		tmp = t_1;
	} else if (z <= 0.025) {
		tmp = fma((y / (a - z)), (t - x), x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = Float64(t + Float64(Float64(t - x) * Float64(Float64(a - y) / z)))
	tmp = 0.0
	if (z <= -4.9e+104)
		tmp = t_1;
	elseif (z <= 0.025)
		tmp = fma(Float64(y / Float64(a - z)), Float64(t - x), x);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t + N[(N[(t - x), $MachinePrecision] * N[(N[(a - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.9e+104], t$95$1, If[LessEqual[z, 0.025], N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := t + \left(t - x\right) \cdot \frac{a - y}{z}\\
\mathbf{if}\;z \leq -4.9 \cdot 10^{+104}:\\
\;\;\;\;t\_1\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.89999999999999985e104 or 0.025000000000000001 < z

    1. Initial program 62.9%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto x + \color{blue}{\left(y - z\right)} \cdot \frac{t - x}{a - z} \]
      2. lift--.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \frac{t - x}{\color{blue}{a - z}} \]
      3. lift--.f64N/A

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

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{1}{\frac{a - z}{t - x}}} \]
      5. un-div-invN/A

        \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
      6. lower-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
      7. lower-/.f6462.6

        \[\leadsto x + \frac{y - z}{\color{blue}{\frac{a - z}{t - x}}} \]
    4. Applied rewrites62.6%

      \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} \]
    5. Taylor expanded in z around inf

      \[\leadsto \color{blue}{\left(t + -1 \cdot \frac{y \cdot \left(t - x\right)}{z}\right) - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}} \]
    6. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \color{blue}{t + \left(-1 \cdot \frac{y \cdot \left(t - x\right)}{z} - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}\right)} \]
      2. distribute-lft-out--N/A

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

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

        \[\leadsto t + \color{blue}{\left(\mathsf{neg}\left(\frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\right)\right)} \]
      5. unsub-negN/A

        \[\leadsto \color{blue}{t - \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}} \]
      6. lower--.f64N/A

        \[\leadsto \color{blue}{t - \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}} \]
      7. distribute-rgt-out--N/A

        \[\leadsto t - \frac{\color{blue}{\left(t - x\right) \cdot \left(y - a\right)}}{z} \]
      8. associate-/l*N/A

        \[\leadsto t - \color{blue}{\left(t - x\right) \cdot \frac{y - a}{z}} \]
      9. lower-*.f64N/A

        \[\leadsto t - \color{blue}{\left(t - x\right) \cdot \frac{y - a}{z}} \]
      10. lower--.f64N/A

        \[\leadsto t - \color{blue}{\left(t - x\right)} \cdot \frac{y - a}{z} \]
      11. lower-/.f64N/A

        \[\leadsto t - \left(t - x\right) \cdot \color{blue}{\frac{y - a}{z}} \]
      12. lower--.f6481.4

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

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

    if -4.89999999999999985e104 < z < 0.025000000000000001

    1. Initial program 92.9%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto x + \color{blue}{\left(y - z\right)} \cdot \frac{t - x}{a - z} \]
      2. lift--.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \frac{t - x}{\color{blue}{a - z}} \]
      3. lift--.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \frac{\color{blue}{t - x}}{a - z} \]
      4. div-invN/A

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

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t - x}{a - z}} \]
      6. lift-/.f64N/A

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t - x}{a - z}} \]
      7. lift-*.f64N/A

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

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{a - z}}, t - x, x\right) \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.9 \cdot 10^{+104}:\\ \;\;\;\;t + \left(t - x\right) \cdot \frac{a - y}{z}\\ \mathbf{elif}\;z \leq 0.025:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{a - z}, t - x, x\right)\\ \mathbf{else}:\\ \;\;\;\;t + \left(t - x\right) \cdot \frac{a - y}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 59.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(t, \frac{y - z}{a}, x\right)\\ \mathbf{if}\;a \leq -100000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 1.22 \cdot 10^{-33}:\\ \;\;\;\;\mathsf{fma}\left(t, \frac{y}{-z}, t\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (fma t (/ (- y z) a) x)))
   (if (<= a -100000.0) t_1 (if (<= a 1.22e-33) (fma t (/ y (- z)) t) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = fma(t, ((y - z) / a), x);
	double tmp;
	if (a <= -100000.0) {
		tmp = t_1;
	} else if (a <= 1.22e-33) {
		tmp = fma(t, (y / -z), t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = fma(t, Float64(Float64(y - z) / a), x)
	tmp = 0.0
	if (a <= -100000.0)
		tmp = t_1;
	elseif (a <= 1.22e-33)
		tmp = fma(t, Float64(y / Float64(-z)), t);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -100000.0], t$95$1, If[LessEqual[a, 1.22e-33], N[(t * N[(y / (-z)), $MachinePrecision] + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, \frac{y - z}{a}, x\right)\\
\mathbf{if}\;a \leq -100000:\\
\;\;\;\;t\_1\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1e5 or 1.22e-33 < a

    1. Initial program 85.7%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf

      \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t}{a - z}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

      \[\leadsto \color{blue}{x + \frac{t \cdot \left(y - z\right)}{a}} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a} + x} \]
      2. associate-/l*N/A

        \[\leadsto \color{blue}{t \cdot \frac{y - z}{a}} + x \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, \frac{y - z}{a}, x\right)} \]
      4. lower-/.f64N/A

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

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

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

    if -1e5 < a < 1.22e-33

    1. Initial program 73.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{t \cdot \left(y - z\right)}}{a - z} \]
      3. lower--.f64N/A

        \[\leadsto \frac{t \cdot \color{blue}{\left(y - z\right)}}{a - z} \]
      4. lower--.f6457.3

        \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{a - z}} \]
    5. Applied rewrites57.3%

      \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
    6. Taylor expanded in a around 0

      \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{-1 \cdot z}} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{\mathsf{neg}\left(z\right)}} \]
      2. lower-neg.f6449.0

        \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{-z}} \]
    8. Applied rewrites49.0%

      \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{-z}} \]
    9. Taylor expanded in y around 0

      \[\leadsto \color{blue}{t + -1 \cdot \frac{t \cdot y}{z}} \]
    10. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{z} + t} \]
      2. mul-1-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{t \cdot y}{z}\right)\right)} + t \]
      3. associate-/l*N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{t \cdot \frac{y}{z}}\right)\right) + t \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{t \cdot \left(\mathsf{neg}\left(\frac{y}{z}\right)\right)} + t \]
      5. mul-1-negN/A

        \[\leadsto t \cdot \color{blue}{\left(-1 \cdot \frac{y}{z}\right)} + t \]
      6. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, -1 \cdot \frac{y}{z}, t\right)} \]
      7. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\mathsf{neg}\left(\frac{y}{z}\right)}, t\right) \]
      8. distribute-neg-frac2N/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\frac{y}{\mathsf{neg}\left(z\right)}}, t\right) \]
      9. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\frac{y}{\mathsf{neg}\left(z\right)}}, t\right) \]
      10. lower-neg.f6462.6

        \[\leadsto \mathsf{fma}\left(t, \frac{y}{\color{blue}{-z}}, t\right) \]
    11. Applied rewrites62.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(t, \frac{y}{-z}, t\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 13: 55.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(t, \frac{y}{a}, x\right)\\ \mathbf{if}\;a \leq -29500000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 1.8 \cdot 10^{-28}:\\ \;\;\;\;\mathsf{fma}\left(t, \frac{y}{-z}, t\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (fma t (/ y a) x)))
   (if (<= a -29500000.0) t_1 (if (<= a 1.8e-28) (fma t (/ y (- z)) t) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = fma(t, (y / a), x);
	double tmp;
	if (a <= -29500000.0) {
		tmp = t_1;
	} else if (a <= 1.8e-28) {
		tmp = fma(t, (y / -z), t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = fma(t, Float64(y / a), x)
	tmp = 0.0
	if (a <= -29500000.0)
		tmp = t_1;
	elseif (a <= 1.8e-28)
		tmp = fma(t, Float64(y / Float64(-z)), t);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(y / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -29500000.0], t$95$1, If[LessEqual[a, 1.8e-28], N[(t * N[(y / (-z)), $MachinePrecision] + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, \frac{y}{a}, x\right)\\
\mathbf{if}\;a \leq -29500000:\\
\;\;\;\;t\_1\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.95e7 or 1.7999999999999999e-28 < a

    1. Initial program 85.7%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf

      \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t}{a - z}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

      \[\leadsto \color{blue}{x + \frac{t \cdot y}{a}} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{t \cdot y}{a} + x} \]
      2. associate-/l*N/A

        \[\leadsto \color{blue}{t \cdot \frac{y}{a}} + x \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, \frac{y}{a}, x\right)} \]
      4. lower-/.f6458.3

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\frac{y}{a}}, x\right) \]
    8. Applied rewrites58.3%

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

    if -2.95e7 < a < 1.7999999999999999e-28

    1. Initial program 73.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{t \cdot \left(y - z\right)}}{a - z} \]
      3. lower--.f64N/A

        \[\leadsto \frac{t \cdot \color{blue}{\left(y - z\right)}}{a - z} \]
      4. lower--.f6457.3

        \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{a - z}} \]
    5. Applied rewrites57.3%

      \[\leadsto \color{blue}{\frac{t \cdot \left(y - z\right)}{a - z}} \]
    6. Taylor expanded in a around 0

      \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{-1 \cdot z}} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{\mathsf{neg}\left(z\right)}} \]
      2. lower-neg.f6449.0

        \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{-z}} \]
    8. Applied rewrites49.0%

      \[\leadsto \frac{t \cdot \left(y - z\right)}{\color{blue}{-z}} \]
    9. Taylor expanded in y around 0

      \[\leadsto \color{blue}{t + -1 \cdot \frac{t \cdot y}{z}} \]
    10. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{z} + t} \]
      2. mul-1-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{t \cdot y}{z}\right)\right)} + t \]
      3. associate-/l*N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{t \cdot \frac{y}{z}}\right)\right) + t \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{t \cdot \left(\mathsf{neg}\left(\frac{y}{z}\right)\right)} + t \]
      5. mul-1-negN/A

        \[\leadsto t \cdot \color{blue}{\left(-1 \cdot \frac{y}{z}\right)} + t \]
      6. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, -1 \cdot \frac{y}{z}, t\right)} \]
      7. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\mathsf{neg}\left(\frac{y}{z}\right)}, t\right) \]
      8. distribute-neg-frac2N/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\frac{y}{\mathsf{neg}\left(z\right)}}, t\right) \]
      9. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\frac{y}{\mathsf{neg}\left(z\right)}}, t\right) \]
      10. lower-neg.f6462.6

        \[\leadsto \mathsf{fma}\left(t, \frac{y}{\color{blue}{-z}}, t\right) \]
    11. Applied rewrites62.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(t, \frac{y}{-z}, t\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 14: 52.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.9 \cdot 10^{+104}:\\ \;\;\;\;t + \left(x - x\right)\\ \mathbf{elif}\;z \leq 9 \cdot 10^{-23}:\\ \;\;\;\;\mathsf{fma}\left(t, \frac{y}{a}, x\right)\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -4.9e+104)
   (+ t (- x x))
   (if (<= z 9e-23) (fma t (/ y a) x) (+ x t))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -4.9e+104) {
		tmp = t + (x - x);
	} else if (z <= 9e-23) {
		tmp = fma(t, (y / a), x);
	} else {
		tmp = x + t;
	}
	return tmp;
}
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -4.9e+104)
		tmp = Float64(t + Float64(x - x));
	elseif (z <= 9e-23)
		tmp = fma(t, Float64(y / a), x);
	else
		tmp = Float64(x + t);
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.9e+104], N[(t + N[(x - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9e-23], N[(t * N[(y / a), $MachinePrecision] + x), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.9 \cdot 10^{+104}:\\
\;\;\;\;t + \left(x - x\right)\\

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

\mathbf{else}:\\
\;\;\;\;x + t\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.89999999999999985e104

    1. Initial program 56.3%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    4. Step-by-step derivation
      1. lower--.f6437.4

        \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    5. Applied rewrites37.4%

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    6. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto x + \color{blue}{\left(t - x\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(t - x\right) + x} \]
      3. lift--.f64N/A

        \[\leadsto \color{blue}{\left(t - x\right)} + x \]
      4. associate-+l-N/A

        \[\leadsto \color{blue}{t - \left(x - x\right)} \]
      5. lower--.f64N/A

        \[\leadsto \color{blue}{t - \left(x - x\right)} \]
      6. lower--.f6453.1

        \[\leadsto t - \color{blue}{\left(x - x\right)} \]
    7. Applied rewrites53.1%

      \[\leadsto \color{blue}{t - \left(x - x\right)} \]

    if -4.89999999999999985e104 < z < 8.9999999999999995e-23

    1. Initial program 92.8%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf

      \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t}{a - z}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

      \[\leadsto \color{blue}{x + \frac{t \cdot y}{a}} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{t \cdot y}{a} + x} \]
      2. associate-/l*N/A

        \[\leadsto \color{blue}{t \cdot \frac{y}{a}} + x \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(t, \frac{y}{a}, x\right)} \]
      4. lower-/.f6458.1

        \[\leadsto \mathsf{fma}\left(t, \color{blue}{\frac{y}{a}}, x\right) \]
    8. Applied rewrites58.1%

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

    if 8.9999999999999995e-23 < z

    1. Initial program 69.5%

      \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf

      \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t}{a - z}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

      \[\leadsto \color{blue}{t + x} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{x + t} \]
      2. lower-+.f6444.7

        \[\leadsto \color{blue}{x + t} \]
    8. Applied rewrites44.7%

      \[\leadsto \color{blue}{x + t} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification53.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.9 \cdot 10^{+104}:\\ \;\;\;\;t + \left(x - x\right)\\ \mathbf{elif}\;z \leq 9 \cdot 10^{-23}:\\ \;\;\;\;\mathsf{fma}\left(t, \frac{y}{a}, x\right)\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 33.7% accurate, 7.3× speedup?

\[\begin{array}{l} \\ x + t \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x t))
double code(double x, double y, double z, double t, double a) {
	return x + t;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = x + t
end function
public static double code(double x, double y, double z, double t, double a) {
	return x + t;
}
def code(x, y, z, t, a):
	return x + t
function code(x, y, z, t, a)
	return Float64(x + t)
end
function tmp = code(x, y, z, t, a)
	tmp = x + t;
end
code[x_, y_, z_, t_, a_] := N[(x + t), $MachinePrecision]
\begin{array}{l}

\\
x + t
\end{array}
Derivation
  1. Initial program 79.6%

    \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
  2. Add Preprocessing
  3. Taylor expanded in t around inf

    \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{t}{a - z}} \]
  4. Step-by-step derivation
    1. lower-/.f64N/A

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

      \[\leadsto x + \left(y - z\right) \cdot \frac{t}{\color{blue}{a - z}} \]
  5. Applied rewrites66.2%

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

    \[\leadsto \color{blue}{t + x} \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{x + t} \]
    2. lower-+.f6436.7

      \[\leadsto \color{blue}{x + t} \]
  8. Applied rewrites36.7%

    \[\leadsto \color{blue}{x + t} \]
  9. Add Preprocessing

Alternative 16: 2.8% accurate, 29.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (x y z t a) :precision binary64 0.0)
double code(double x, double y, double z, double t, double a) {
	return 0.0;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = 0.0d0
end function
public static double code(double x, double y, double z, double t, double a) {
	return 0.0;
}
def code(x, y, z, t, a):
	return 0.0
function code(x, y, z, t, a)
	return 0.0
end
function tmp = code(x, y, z, t, a)
	tmp = 0.0;
end
code[x_, y_, z_, t_, a_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 79.6%

    \[x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
  2. Add Preprocessing
  3. Taylor expanded in z around inf

    \[\leadsto x + \color{blue}{\left(t - x\right)} \]
  4. Step-by-step derivation
    1. lower--.f6421.0

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
  5. Applied rewrites21.0%

    \[\leadsto x + \color{blue}{\left(t - x\right)} \]
  6. Taylor expanded in t around 0

    \[\leadsto x + \color{blue}{-1 \cdot x} \]
  7. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto x + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)} \]
    2. lower-neg.f642.8

      \[\leadsto x + \color{blue}{\left(-x\right)} \]
  8. Applied rewrites2.8%

    \[\leadsto x + \color{blue}{\left(-x\right)} \]
  9. Step-by-step derivation
    1. unsub-negN/A

      \[\leadsto \color{blue}{x - x} \]
    2. +-inverses2.8

      \[\leadsto \color{blue}{0} \]
  10. Applied rewrites2.8%

    \[\leadsto \color{blue}{0} \]
  11. Add Preprocessing

Reproduce

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