Numeric.Signal:interpolate from hsignal-0.2.7.1

Percentage Accurate: 79.8% → 93.9%
Time: 14.1s
Alternatives: 19
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 19 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: 79.8% 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: 93.9% 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 -1 \cdot 10^{-285}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-259}:\\ \;\;\;\;t + \frac{t - x}{z} \cdot \left(a - y\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 -1e-285)
     t_1
     (if (<= t_2 2e-259) (+ t (* (/ (- t x) z) (- a y))) 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 <= -1e-285) {
		tmp = t_1;
	} else if (t_2 <= 2e-259) {
		tmp = t + (((t - x) / z) * (a - y));
	} 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 <= -1e-285)
		tmp = t_1;
	elseif (t_2 <= 2e-259)
		tmp = Float64(t + Float64(Float64(Float64(t - x) / z) * Float64(a - y)));
	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, -1e-285], t$95$1, If[LessEqual[t$95$2, 2e-259], N[(t + N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * N[(a - y), $MachinePrecision]), $MachinePrecision]), $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 -1 \cdot 10^{-285}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-259}:\\
\;\;\;\;t + \frac{t - x}{z} \cdot \left(a - y\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.00000000000000007e-285 or 2.0000000000000001e-259 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z))))

    1. Initial program 91.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 rewrites95.0%

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

    if -1.00000000000000007e-285 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 2.0000000000000001e-259

    1. Initial program 4.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-/.f644.4

        \[\leadsto x + \frac{y - z}{\color{blue}{\frac{a - z}{t - x}}} \]
    4. Applied rewrites4.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. div-subN/A

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq -1 \cdot 10^{-285}:\\ \;\;\;\;\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 2 \cdot 10^{-259}:\\ \;\;\;\;t + \frac{t - x}{z} \cdot \left(a - y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 62.4% accurate, 0.7× speedup?

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

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

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

\mathbf{elif}\;z \leq 1.25 \cdot 10^{+131}:\\
\;\;\;\;x \cdot \frac{y - a}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -4.6000000000000001e51

    1. Initial program 58.8%

      \[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 rewrites78.5%

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

      \[\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. div-subN/A

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

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

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

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

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

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

    if -4.6000000000000001e51 < z < 2.6000000000000001e-8

    1. Initial program 93.4%

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

    if 2.6000000000000001e-8 < z < 1.24999999999999999e131

    1. Initial program 67.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 rewrites79.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(t - x, \color{blue}{\frac{1}{z} \cdot \left(\left(\mathsf{neg}\left(y\right)\right) + a\right)}, t\right) \]
      10. lower-/.f6478.8

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

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

        \[\leadsto \mathsf{fma}\left(t - x, \frac{1}{z} \cdot \color{blue}{\left(a + \left(\mathsf{neg}\left(y\right)\right)\right)}, t\right) \]
      13. lift-neg.f64N/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{neg}\left(x \cdot \color{blue}{\frac{a - y}{z}}\right) \]
      6. lower--.f6451.5

        \[\leadsto -x \cdot \frac{\color{blue}{a - y}}{z} \]
    10. Applied rewrites51.5%

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

    if 1.24999999999999999e131 < z

    1. Initial program 53.4%

      \[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 rewrites88.7%

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

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

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

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

        \[\leadsto \color{blue}{t \cdot 1 + t \cdot \frac{a - y}{z}} \]
      4. *-rgt-identityN/A

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

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

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

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

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

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

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

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

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

Alternative 3: 62.5% accurate, 0.8× speedup?

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

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

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

\mathbf{elif}\;z \leq 7.2 \cdot 10^{+123}:\\
\;\;\;\;\left(y - a\right) \cdot \frac{x}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -4.6000000000000001e51

    1. Initial program 58.8%

      \[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 rewrites78.5%

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

      \[\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. div-subN/A

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

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

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

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

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

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

    if -4.6000000000000001e51 < z < 2.6000000000000001e-8

    1. Initial program 93.4%

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

    if 2.6000000000000001e-8 < z < 7.19999999999999996e123

    1. Initial program 65.4%

      \[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 rewrites83.3%

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

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

        \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{x \cdot \left(a - y\right)}{z}\right)} \]
      2. distribute-neg-frac2N/A

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

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

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

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

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

        \[\leadsto \frac{x \cdot \left(a - y\right)}{\color{blue}{\mathsf{neg}\left(z\right)}} \]
      8. lower-neg.f6448.8

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

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

        \[\leadsto \frac{x \cdot \color{blue}{\left(a - y\right)}}{\mathsf{neg}\left(z\right)} \]
      2. *-commutativeN/A

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

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

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

        \[\leadsto \color{blue}{\left(a - y\right) \cdot \frac{x}{\mathsf{neg}\left(z\right)}} \]
      6. lower-/.f6454.1

        \[\leadsto \left(a - y\right) \cdot \color{blue}{\frac{x}{-z}} \]
    10. Applied rewrites54.1%

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

    if 7.19999999999999996e123 < z

    1. Initial program 54.5%

      \[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.6%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{t \cdot \left(-1 \cdot \frac{y}{z}\right) + t \cdot 1} \]
      3. *-rgt-identityN/A

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

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

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

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

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

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

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

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

Alternative 4: 76.5% 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 -2.22 \cdot 10^{-48}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{-8}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y - z}{a}, 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 -2.22e-48)
     t_1
     (if (<= z 1.15e-8) (fma (/ (- y z) a) (- 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 <= -2.22e-48) {
		tmp = t_1;
	} else if (z <= 1.15e-8) {
		tmp = fma(((y - z) / a), (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 <= -2.22e-48)
		tmp = t_1;
	elseif (z <= 1.15e-8)
		tmp = fma(Float64(Float64(y - z) / a), 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, -2.22e-48], t$95$1, If[LessEqual[z, 1.15e-8], N[(N[(N[(y - z), $MachinePrecision] / a), $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 -2.22 \cdot 10^{-48}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.22000000000000005e-48 or 1.15e-8 < z

    1. Initial program 61.5%

      \[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 rewrites80.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.22000000000000005e-48 < z < 1.15e-8

    1. Initial program 93.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 rewrites95.4%

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

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

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

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

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

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

Alternative 5: 76.5% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.22000000000000005e-48 or 1.15e-8 < z

    1. Initial program 61.5%

      \[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 rewrites80.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.22000000000000005e-48 < z < 1.15e-8

    1. Initial program 93.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 rewrites95.4%

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

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

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

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

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

Alternative 6: 75.6% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.22000000000000005e-48 or 1.15e-8 < z

    1. Initial program 61.5%

      \[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 rewrites80.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.22000000000000005e-48 < z < 1.15e-8

    1. Initial program 93.9%

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

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

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

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

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

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

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

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

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

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

Alternative 7: 70.8% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.19999999999999977e-48 or 1.28000000000000005e-8 < z

    1. Initial program 61.5%

      \[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 rewrites80.3%

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

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

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

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

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

    if -4.19999999999999977e-48 < z < 1.28000000000000005e-8

    1. Initial program 93.9%

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

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

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

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

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

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

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

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

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

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

Alternative 8: 35.2% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := t + \left(x - x\right)\\
\mathbf{if}\;z \leq -6.2 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -1.02 \cdot 10^{-82}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

\mathbf{elif}\;z \leq 5.6 \cdot 10^{+54}:\\
\;\;\;\;y \cdot \frac{t}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.20000000000000022e51 or 5.6000000000000003e54 < z

    1. Initial program 57.9%

      \[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--.f6433.3

        \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    5. Applied rewrites33.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--.f6447.6

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

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

    if -6.20000000000000022e51 < z < -1.02000000000000007e-82

    1. Initial program 84.9%

      \[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 rewrites56.1%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
    10. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z} \]
      3. lower-*.f6433.8

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z} \]
    11. Applied rewrites33.8%

      \[\leadsto \color{blue}{\frac{y \cdot x}{z}} \]

    if -1.02000000000000007e-82 < z < 5.6000000000000003e54

    1. Initial program 92.8%

      \[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--.f6479.0

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

      \[\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-/.f6433.9

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

      \[\leadsto \color{blue}{y \cdot \frac{t}{a}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification39.6%

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

Alternative 9: 69.4% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.12e-82 or 1.25000000000000005e-11 < z

    1. Initial program 62.6%

      \[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 rewrites78.0%

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

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

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

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

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

    if -1.12e-82 < z < 1.25000000000000005e-11

    1. Initial program 95.0%

      \[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.7%

      \[\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-/.f6483.2

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

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

Alternative 10: 64.7% accurate, 0.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.12e-82 or 1.28000000000000005e-8 < z

    1. Initial program 62.6%

      \[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 rewrites78.0%

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

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

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

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

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

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

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

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

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

    if -1.12e-82 < z < 1.28000000000000005e-8

    1. Initial program 95.0%

      \[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.7%

      \[\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-/.f6483.2

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

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

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

Alternative 11: 63.8% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 58.8%

      \[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 rewrites78.5%

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

      \[\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. div-subN/A

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

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

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

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

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

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

    if -4.6000000000000001e51 < z < 2.6000000000000001e-8

    1. Initial program 93.4%

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

    if 2.6000000000000001e-8 < z

    1. Initial program 57.8%

      \[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 rewrites85.6%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{t \cdot \left(-1 \cdot \frac{y}{z}\right) + t \cdot 1} \]
      3. *-rgt-identityN/A

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

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

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

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

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

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

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

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

Alternative 12: 62.9% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 58.8%

      \[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 rewrites78.5%

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

      \[\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. div-subN/A

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

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

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

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

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

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

    if -1.6000000000000001e51 < z < 2.6000000000000001e-8

    1. Initial program 93.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--.f6475.5

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

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

    if 2.6000000000000001e-8 < z

    1. Initial program 57.8%

      \[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 rewrites85.6%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{t \cdot \left(-1 \cdot \frac{y}{z}\right) + t \cdot 1} \]
      3. *-rgt-identityN/A

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

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

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

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

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

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

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

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

Alternative 13: 56.0% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 58.8%

      \[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 rewrites78.5%

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

      \[\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. div-subN/A

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

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

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

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

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

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

    if -1.6000000000000001e51 < z < 2.6000000000000001e-8

    1. Initial program 93.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--.f6475.5

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

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

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

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

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

    if 2.6000000000000001e-8 < z

    1. Initial program 57.8%

      \[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 rewrites85.6%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{t \cdot \left(-1 \cdot \frac{y}{z}\right) + t \cdot 1} \]
      3. *-rgt-identityN/A

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

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

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

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

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

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

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

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

Alternative 14: 55.8% accurate, 0.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.7999999999999997e77 or 2.6000000000000001e-8 < z

    1. Initial program 58.9%

      \[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 rewrites82.5%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{t \cdot \left(-1 \cdot \frac{y}{z}\right) + t \cdot 1} \]
      3. *-rgt-identityN/A

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

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

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

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

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

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

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

    if -4.7999999999999997e77 < z < 2.6000000000000001e-8

    1. Initial program 92.2%

      \[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--.f6474.6

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

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

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

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

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

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

Alternative 15: 52.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := t + \left(x - x\right)\\
\mathbf{if}\;z \leq -1.2 \cdot 10^{+143}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.1999999999999999e143 or 1.47999999999999993e65 < z

    1. Initial program 54.8%

      \[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--.f6436.8

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

      \[\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--.f6451.1

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

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

    if -1.1999999999999999e143 < z < 1.47999999999999993e65

    1. Initial program 89.2%

      \[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--.f6467.9

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

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

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

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

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

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

Alternative 16: 35.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := t + \left(x - x\right)\\
\mathbf{if}\;z \leq -1.1 \cdot 10^{-73}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 5.6 \cdot 10^{+54}:\\
\;\;\;\;y \cdot \frac{t}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.1e-73 or 5.6000000000000003e54 < z

    1. Initial program 62.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--.f6429.5

        \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    5. Applied rewrites29.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--.f6441.7

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

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

    if -1.1e-73 < z < 5.6000000000000003e54

    1. Initial program 92.2%

      \[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.0

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

      \[\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-/.f6433.3

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

      \[\leadsto \color{blue}{y \cdot \frac{t}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification37.4%

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

Alternative 17: 25.7% accurate, 4.1× speedup?

\[\begin{array}{l} \\ t + \left(x - x\right) \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ t (- x x)))
double code(double x, double y, double z, double t, double a) {
	return t + (x - x);
}
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 = t + (x - x)
end function
public static double code(double x, double y, double z, double t, double a) {
	return t + (x - x);
}
def code(x, y, z, t, a):
	return t + (x - x)
function code(x, y, z, t, a)
	return Float64(t + Float64(x - x))
end
function tmp = code(x, y, z, t, a)
	tmp = t + (x - x);
end
code[x_, y_, z_, t_, a_] := N[(t + N[(x - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
t + \left(x - x\right)
\end{array}
Derivation
  1. Initial program 77.7%

    \[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--.f6417.6

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

    \[\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--.f6424.1

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

    \[\leadsto \color{blue}{t - \left(x - x\right)} \]
  8. Final simplification24.1%

    \[\leadsto t + \left(x - x\right) \]
  9. Add Preprocessing

Alternative 18: 19.5% accurate, 4.1× speedup?

\[\begin{array}{l} \\ x + \left(t - x\right) \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x (- t x)))
double code(double x, double y, double z, double t, double a) {
	return x + (t - x);
}
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 - x)
end function
public static double code(double x, double y, double z, double t, double a) {
	return x + (t - x);
}
def code(x, y, z, t, a):
	return x + (t - x)
function code(x, y, z, t, a)
	return Float64(x + Float64(t - x))
end
function tmp = code(x, y, z, t, a)
	tmp = x + (t - x);
end
code[x_, y_, z_, t_, a_] := N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(t - x\right)
\end{array}
Derivation
  1. Initial program 77.7%

    \[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--.f6417.6

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

    \[\leadsto x + \color{blue}{\left(t - x\right)} \]
  6. Add Preprocessing

Alternative 19: 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 77.7%

    \[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--.f6417.6

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

    \[\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.9

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

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

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

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

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

Reproduce

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