Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C

Percentage Accurate: 94.5% → 97.5%
Time: 10.9s
Alternatives: 13
Speedup: 0.3×

Specification

?
\[\begin{array}{l} \\ x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
	return x * ((y / z) - (t / (1.0 - z)));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
	return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t):
	return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t)
	return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))))
end
function tmp = code(x, y, z, t)
	tmp = x * ((y / z) - (t / (1.0 - z)));
end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\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 13 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: 94.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
	return x * ((y / z) - (t / (1.0 - z)));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
	return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t):
	return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t)
	return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))))
end
function tmp = code(x, y, z, t)
	tmp = x * ((y / z) - (t / (1.0 - z)));
end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 97.5% accurate, 0.3× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ \begin{array}{l} t_1 := y \cdot \left(1 - z\right) - z \cdot t\\ t_2 := x\_m \cdot \left(\frac{y}{z} + \frac{t}{z + -1}\right)\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;\frac{t\_1}{1 - z} \cdot \frac{x\_m}{z}\\ \mathbf{elif}\;t\_2 \leq 10^{+274}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\left(x\_m \cdot t\_1\right) \cdot \frac{1}{z \cdot \left(1 - z\right)}\\ \end{array} \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
 :precision binary64
 (let* ((t_1 (- (* y (- 1.0 z)) (* z t)))
        (t_2 (* x_m (+ (/ y z) (/ t (+ z -1.0))))))
   (*
    x_s
    (if (<= t_2 (- INFINITY))
      (* (/ t_1 (- 1.0 z)) (/ x_m z))
      (if (<= t_2 1e+274) t_2 (* (* x_m t_1) (/ 1.0 (* z (- 1.0 z)))))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = (y * (1.0 - z)) - (z * t);
	double t_2 = x_m * ((y / z) + (t / (z + -1.0)));
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = (t_1 / (1.0 - z)) * (x_m / z);
	} else if (t_2 <= 1e+274) {
		tmp = t_2;
	} else {
		tmp = (x_m * t_1) * (1.0 / (z * (1.0 - z)));
	}
	return x_s * tmp;
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = (y * (1.0 - z)) - (z * t);
	double t_2 = x_m * ((y / z) + (t / (z + -1.0)));
	double tmp;
	if (t_2 <= -Double.POSITIVE_INFINITY) {
		tmp = (t_1 / (1.0 - z)) * (x_m / z);
	} else if (t_2 <= 1e+274) {
		tmp = t_2;
	} else {
		tmp = (x_m * t_1) * (1.0 / (z * (1.0 - z)));
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z, t):
	t_1 = (y * (1.0 - z)) - (z * t)
	t_2 = x_m * ((y / z) + (t / (z + -1.0)))
	tmp = 0
	if t_2 <= -math.inf:
		tmp = (t_1 / (1.0 - z)) * (x_m / z)
	elif t_2 <= 1e+274:
		tmp = t_2
	else:
		tmp = (x_m * t_1) * (1.0 / (z * (1.0 - z)))
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	t_1 = Float64(Float64(y * Float64(1.0 - z)) - Float64(z * t))
	t_2 = Float64(x_m * Float64(Float64(y / z) + Float64(t / Float64(z + -1.0))))
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = Float64(Float64(t_1 / Float64(1.0 - z)) * Float64(x_m / z));
	elseif (t_2 <= 1e+274)
		tmp = t_2;
	else
		tmp = Float64(Float64(x_m * t_1) * Float64(1.0 / Float64(z * Float64(1.0 - z))));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z, t)
	t_1 = (y * (1.0 - z)) - (z * t);
	t_2 = x_m * ((y / z) + (t / (z + -1.0)));
	tmp = 0.0;
	if (t_2 <= -Inf)
		tmp = (t_1 / (1.0 - z)) * (x_m / z);
	elseif (t_2 <= 1e+274)
		tmp = t_2;
	else
		tmp = (x_m * t_1) * (1.0 / (z * (1.0 - z)));
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x$95$m * N[(N[(y / z), $MachinePrecision] + N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$2, (-Infinity)], N[(N[(t$95$1 / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+274], t$95$2, N[(N[(x$95$m * t$95$1), $MachinePrecision] * N[(1.0 / N[(z * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

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

\mathbf{elif}\;t\_2 \leq 10^{+274}:\\
\;\;\;\;t\_2\\

\mathbf{else}:\\
\;\;\;\;\left(x\_m \cdot t\_1\right) \cdot \frac{1}{z \cdot \left(1 - z\right)}\\


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

    1. Initial program 74.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(y \cdot \left(1 - z\right) - z \cdot t\right) \cdot x}{\color{blue}{\left(1 - z\right) \cdot z}} \]
      12. times-fracN/A

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

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

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

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

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

        \[\leadsto \frac{y \cdot \left(1 - z\right) - \color{blue}{z \cdot t}}{1 - z} \cdot \frac{x}{z} \]
      18. lower-/.f6499.9

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

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

    if -inf.0 < (*.f64 x (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z)))) < 9.99999999999999921e273

    1. Initial program 97.4%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing

    if 9.99999999999999921e273 < (*.f64 x (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))))

    1. Initial program 87.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(y \cdot \left(1 - z\right) - z \cdot t\right) \cdot x\right) \cdot \color{blue}{\frac{1}{z \cdot \left(1 - z\right)}} \]
      18. lower-*.f6497.5

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

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

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

Alternative 2: 97.9% accurate, 0.3× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ \begin{array}{l} t_1 := \frac{y}{z} + \frac{t}{z + -1}\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;y \cdot \frac{x\_m}{z}\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+291}:\\ \;\;\;\;x\_m \cdot t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x\_m \cdot y}{z}\\ \end{array} \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
 :precision binary64
 (let* ((t_1 (+ (/ y z) (/ t (+ z -1.0)))))
   (*
    x_s
    (if (<= t_1 (- INFINITY))
      (* y (/ x_m z))
      (if (<= t_1 2e+291) (* x_m t_1) (/ (* x_m y) z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = (y / z) + (t / (z + -1.0));
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = y * (x_m / z);
	} else if (t_1 <= 2e+291) {
		tmp = x_m * t_1;
	} else {
		tmp = (x_m * y) / z;
	}
	return x_s * tmp;
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = (y / z) + (t / (z + -1.0));
	double tmp;
	if (t_1 <= -Double.POSITIVE_INFINITY) {
		tmp = y * (x_m / z);
	} else if (t_1 <= 2e+291) {
		tmp = x_m * t_1;
	} else {
		tmp = (x_m * y) / z;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z, t):
	t_1 = (y / z) + (t / (z + -1.0))
	tmp = 0
	if t_1 <= -math.inf:
		tmp = y * (x_m / z)
	elif t_1 <= 2e+291:
		tmp = x_m * t_1
	else:
		tmp = (x_m * y) / z
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	t_1 = Float64(Float64(y / z) + Float64(t / Float64(z + -1.0)))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(y * Float64(x_m / z));
	elseif (t_1 <= 2e+291)
		tmp = Float64(x_m * t_1);
	else
		tmp = Float64(Float64(x_m * y) / z);
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z, t)
	t_1 = (y / z) + (t / (z + -1.0));
	tmp = 0.0;
	if (t_1 <= -Inf)
		tmp = y * (x_m / z);
	elseif (t_1 <= 2e+291)
		tmp = x_m * t_1;
	else
		tmp = (x_m * y) / z;
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] + N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$1, (-Infinity)], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+291], N[(x$95$m * t$95$1), $MachinePrecision], N[(N[(x$95$m * y), $MachinePrecision] / z), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
\begin{array}{l}
t_1 := \frac{y}{z} + \frac{t}{z + -1}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+291}:\\
\;\;\;\;x\_m \cdot t\_1\\

\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot y}{z}\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0

    1. Initial program 70.7%

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

      \[\leadsto x \cdot \color{blue}{\frac{y}{z}} \]
    4. Step-by-step derivation
      1. lower-/.f6470.7

        \[\leadsto x \cdot \color{blue}{\frac{y}{z}} \]
    5. Applied rewrites70.7%

      \[\leadsto x \cdot \color{blue}{\frac{y}{z}} \]
    6. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{z}{y}}} \]
      2. lift-/.f64N/A

        \[\leadsto x \cdot \frac{1}{\color{blue}{\frac{z}{y}}} \]
      3. un-div-invN/A

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
      4. lower-/.f6470.7

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    7. Applied rewrites70.7%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    8. Step-by-step derivation
      1. associate-/r/N/A

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

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    9. Applied rewrites99.9%

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

    if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 1.9999999999999999e291

    1. Initial program 97.8%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing

    if 1.9999999999999999e291 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z)))

    1. Initial program 56.9%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification98.1%

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

Alternative 3: 80.3% accurate, 0.9× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -2.3 \cdot 10^{-106}:\\ \;\;\;\;\frac{x\_m \cdot \left(y + t\right)}{z}\\ \mathbf{elif}\;z \leq -1.02 \cdot 10^{-122}:\\ \;\;\;\;\mathsf{fma}\left(z, x\_m, x\_m\right) \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;y \cdot \frac{x\_m}{z}\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot \frac{y + t}{z}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= z -2.3e-106)
    (/ (* x_m (+ y t)) z)
    (if (<= z -1.02e-122)
      (* (fma z x_m x_m) (- t))
      (if (<= z 1.0) (* y (/ x_m z)) (* x_m (/ (+ y t) z)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (z <= -2.3e-106) {
		tmp = (x_m * (y + t)) / z;
	} else if (z <= -1.02e-122) {
		tmp = fma(z, x_m, x_m) * -t;
	} else if (z <= 1.0) {
		tmp = y * (x_m / z);
	} else {
		tmp = x_m * ((y + t) / z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (z <= -2.3e-106)
		tmp = Float64(Float64(x_m * Float64(y + t)) / z);
	elseif (z <= -1.02e-122)
		tmp = Float64(fma(z, x_m, x_m) * Float64(-t));
	elseif (z <= 1.0)
		tmp = Float64(y * Float64(x_m / z));
	else
		tmp = Float64(x_m * Float64(Float64(y + t) / z));
	end
	return Float64(x_s * tmp)
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -2.3e-106], N[(N[(x$95$m * N[(y + t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, -1.02e-122], N[(N[(z * x$95$m + x$95$m), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[z, 1.0], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{-106}:\\
\;\;\;\;\frac{x\_m \cdot \left(y + t\right)}{z}\\

\mathbf{elif}\;z \leq -1.02 \cdot 10^{-122}:\\
\;\;\;\;\mathsf{fma}\left(z, x\_m, x\_m\right) \cdot \left(-t\right)\\

\mathbf{elif}\;z \leq 1:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\

\mathbf{else}:\\
\;\;\;\;x\_m \cdot \frac{y + t}{z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -2.3000000000000001e-106

    1. Initial program 95.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.3000000000000001e-106 < z < -1.02000000000000002e-122

    1. Initial program 100.0%

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

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

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

        \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{\mathsf{fma}\left(z, z \cdot \left(t \cdot z - -1 \cdot t\right) - -1 \cdot t, t\right)}\right) \]
      3. cancel-sign-sub-invN/A

        \[\leadsto x \cdot \left(\frac{y}{z} - \mathsf{fma}\left(z, \color{blue}{z \cdot \left(t \cdot z - -1 \cdot t\right) + \left(\mathsf{neg}\left(-1\right)\right) \cdot t}, t\right)\right) \]
      4. cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\frac{y}{z} - \mathsf{fma}\left(z, \mathsf{fma}\left(z, \color{blue}{z \cdot t} + t, t\right), t\right)\right) \]
      13. lower-fma.f64100.0

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

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

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

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

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

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\color{blue}{\left(z \cdot \left(t + z \cdot \left(t + t \cdot z\right)\right) + t\right)}\right)\right) \]
      4. *-lft-identityN/A

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\left(z \cdot \left(\color{blue}{1 \cdot t} + z \cdot \left(t + t \cdot z\right)\right) + t\right)\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\left(z \cdot \left(1 \cdot t + z \cdot \left(t + \color{blue}{z \cdot t}\right)\right) + t\right)\right)\right) \]
      6. distribute-rgt1-inN/A

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

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

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

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\left(z \cdot \color{blue}{\left(t \cdot \left(1 + z \cdot \left(1 + z\right)\right)\right)} + t\right)\right)\right) \]
      10. *-commutativeN/A

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

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

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

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\color{blue}{\mathsf{fma}\left(t, z \cdot \left(1 + z \cdot \left(1 + z\right)\right), t\right)}\right)\right) \]
    8. Applied rewrites85.7%

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

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot x\right) + -1 \cdot \left(t \cdot \left(x \cdot z\right)\right)} \]
    10. Step-by-step derivation
      1. distribute-lft-outN/A

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

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

        \[\leadsto \color{blue}{\mathsf{neg}\left(\left(t \cdot x + t \cdot \left(x \cdot z\right)\right)\right)} \]
      4. distribute-lft-outN/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{t \cdot \left(x + x \cdot z\right)}\right) \]
      5. *-rgt-identityN/A

        \[\leadsto \mathsf{neg}\left(t \cdot \left(\color{blue}{x \cdot 1} + x \cdot z\right)\right) \]
      6. distribute-lft-inN/A

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

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

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

        \[\leadsto \mathsf{neg}\left(t \cdot \color{blue}{\left(z \cdot x + 1 \cdot x\right)}\right) \]
      10. *-lft-identityN/A

        \[\leadsto \mathsf{neg}\left(t \cdot \left(z \cdot x + \color{blue}{x}\right)\right) \]
      11. lower-fma.f6485.7

        \[\leadsto -t \cdot \color{blue}{\mathsf{fma}\left(z, x, x\right)} \]
    11. Applied rewrites85.7%

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

    if -1.02000000000000002e-122 < z < 1

    1. Initial program 87.8%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{y}{z}} \]
    5. Applied rewrites66.4%

      \[\leadsto x \cdot \color{blue}{\frac{y}{z}} \]
    6. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{z}{y}}} \]
      2. lift-/.f64N/A

        \[\leadsto x \cdot \frac{1}{\color{blue}{\frac{z}{y}}} \]
      3. un-div-invN/A

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
      4. lower-/.f6466.6

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    7. Applied rewrites66.6%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    8. Step-by-step derivation
      1. associate-/r/N/A

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

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    9. Applied rewrites77.5%

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

    if 1 < z

    1. Initial program 98.2%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{y - -1 \cdot t}{z}} \]
      2. cancel-sign-sub-invN/A

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

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

        \[\leadsto x \cdot \frac{y + \color{blue}{t}}{z} \]
      5. lower-+.f6498.2

        \[\leadsto x \cdot \frac{\color{blue}{y + t}}{z} \]
    5. Applied rewrites98.2%

      \[\leadsto x \cdot \color{blue}{\frac{y + t}{z}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification85.4%

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

Alternative 4: 82.3% accurate, 0.9× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ \begin{array}{l} t_1 := x\_m \cdot \frac{y + t}{z}\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -2.3 \cdot 10^{-106}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -1.02 \cdot 10^{-122}:\\ \;\;\;\;\mathsf{fma}\left(z, x\_m, x\_m\right) \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;y \cdot \frac{x\_m}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
 :precision binary64
 (let* ((t_1 (* x_m (/ (+ y t) z))))
   (*
    x_s
    (if (<= z -2.3e-106)
      t_1
      (if (<= z -1.02e-122)
        (* (fma z x_m x_m) (- t))
        (if (<= z 1.0) (* y (/ x_m z)) t_1))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = x_m * ((y + t) / z);
	double tmp;
	if (z <= -2.3e-106) {
		tmp = t_1;
	} else if (z <= -1.02e-122) {
		tmp = fma(z, x_m, x_m) * -t;
	} else if (z <= 1.0) {
		tmp = y * (x_m / z);
	} else {
		tmp = t_1;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	t_1 = Float64(x_m * Float64(Float64(y + t) / z))
	tmp = 0.0
	if (z <= -2.3e-106)
		tmp = t_1;
	elseif (z <= -1.02e-122)
		tmp = Float64(fma(z, x_m, x_m) * Float64(-t));
	elseif (z <= 1.0)
		tmp = Float64(y * Float64(x_m / z));
	else
		tmp = t_1;
	end
	return Float64(x_s * tmp)
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(x$95$m * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -2.3e-106], t$95$1, If[LessEqual[z, -1.02e-122], N[(N[(z * x$95$m + x$95$m), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[z, 1.0], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
\begin{array}{l}
t_1 := x\_m \cdot \frac{y + t}{z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{-106}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -1.02 \cdot 10^{-122}:\\
\;\;\;\;\mathsf{fma}\left(z, x\_m, x\_m\right) \cdot \left(-t\right)\\

\mathbf{elif}\;z \leq 1:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.3000000000000001e-106 or 1 < z

    1. Initial program 96.8%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{y - -1 \cdot t}{z}} \]
      2. cancel-sign-sub-invN/A

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

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

        \[\leadsto x \cdot \frac{y + \color{blue}{t}}{z} \]
      5. lower-+.f6490.4

        \[\leadsto x \cdot \frac{\color{blue}{y + t}}{z} \]
    5. Applied rewrites90.4%

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

    if -2.3000000000000001e-106 < z < -1.02000000000000002e-122

    1. Initial program 100.0%

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

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

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

        \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{\mathsf{fma}\left(z, z \cdot \left(t \cdot z - -1 \cdot t\right) - -1 \cdot t, t\right)}\right) \]
      3. cancel-sign-sub-invN/A

        \[\leadsto x \cdot \left(\frac{y}{z} - \mathsf{fma}\left(z, \color{blue}{z \cdot \left(t \cdot z - -1 \cdot t\right) + \left(\mathsf{neg}\left(-1\right)\right) \cdot t}, t\right)\right) \]
      4. cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\frac{y}{z} - \mathsf{fma}\left(z, \mathsf{fma}\left(z, \color{blue}{z \cdot t} + t, t\right), t\right)\right) \]
      13. lower-fma.f64100.0

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

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

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

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

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

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\color{blue}{\left(z \cdot \left(t + z \cdot \left(t + t \cdot z\right)\right) + t\right)}\right)\right) \]
      4. *-lft-identityN/A

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\left(z \cdot \left(\color{blue}{1 \cdot t} + z \cdot \left(t + t \cdot z\right)\right) + t\right)\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\left(z \cdot \left(1 \cdot t + z \cdot \left(t + \color{blue}{z \cdot t}\right)\right) + t\right)\right)\right) \]
      6. distribute-rgt1-inN/A

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

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

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

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\left(z \cdot \color{blue}{\left(t \cdot \left(1 + z \cdot \left(1 + z\right)\right)\right)} + t\right)\right)\right) \]
      10. *-commutativeN/A

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

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

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

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\color{blue}{\mathsf{fma}\left(t, z \cdot \left(1 + z \cdot \left(1 + z\right)\right), t\right)}\right)\right) \]
    8. Applied rewrites85.7%

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

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot x\right) + -1 \cdot \left(t \cdot \left(x \cdot z\right)\right)} \]
    10. Step-by-step derivation
      1. distribute-lft-outN/A

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

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

        \[\leadsto \color{blue}{\mathsf{neg}\left(\left(t \cdot x + t \cdot \left(x \cdot z\right)\right)\right)} \]
      4. distribute-lft-outN/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{t \cdot \left(x + x \cdot z\right)}\right) \]
      5. *-rgt-identityN/A

        \[\leadsto \mathsf{neg}\left(t \cdot \left(\color{blue}{x \cdot 1} + x \cdot z\right)\right) \]
      6. distribute-lft-inN/A

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

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

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

        \[\leadsto \mathsf{neg}\left(t \cdot \color{blue}{\left(z \cdot x + 1 \cdot x\right)}\right) \]
      10. *-lft-identityN/A

        \[\leadsto \mathsf{neg}\left(t \cdot \left(z \cdot x + \color{blue}{x}\right)\right) \]
      11. lower-fma.f6485.7

        \[\leadsto -t \cdot \color{blue}{\mathsf{fma}\left(z, x, x\right)} \]
    11. Applied rewrites85.7%

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

    if -1.02000000000000002e-122 < z < 1

    1. Initial program 87.8%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{y}{z}} \]
    5. Applied rewrites66.4%

      \[\leadsto x \cdot \color{blue}{\frac{y}{z}} \]
    6. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{z}{y}}} \]
      2. lift-/.f64N/A

        \[\leadsto x \cdot \frac{1}{\color{blue}{\frac{z}{y}}} \]
      3. un-div-invN/A

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
      4. lower-/.f6466.6

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    7. Applied rewrites66.6%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    8. Step-by-step derivation
      1. associate-/r/N/A

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

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    9. Applied rewrites77.5%

      \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification85.2%

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

Alternative 5: 92.7% accurate, 0.9× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -14500000:\\ \;\;\;\;\frac{x\_m \cdot \left(y + t\right)}{z}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{x\_m \cdot \left(y - z \cdot t\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot \frac{y + t}{z}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= z -14500000.0)
    (/ (* x_m (+ y t)) z)
    (if (<= z 1.0) (/ (* x_m (- y (* z t))) z) (* x_m (/ (+ y t) z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (z <= -14500000.0) {
		tmp = (x_m * (y + t)) / z;
	} else if (z <= 1.0) {
		tmp = (x_m * (y - (z * t))) / z;
	} else {
		tmp = x_m * ((y + t) / z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (z <= (-14500000.0d0)) then
        tmp = (x_m * (y + t)) / z
    else if (z <= 1.0d0) then
        tmp = (x_m * (y - (z * t))) / z
    else
        tmp = x_m * ((y + t) / z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (z <= -14500000.0) {
		tmp = (x_m * (y + t)) / z;
	} else if (z <= 1.0) {
		tmp = (x_m * (y - (z * t))) / z;
	} else {
		tmp = x_m * ((y + t) / z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z, t):
	tmp = 0
	if z <= -14500000.0:
		tmp = (x_m * (y + t)) / z
	elif z <= 1.0:
		tmp = (x_m * (y - (z * t))) / z
	else:
		tmp = x_m * ((y + t) / z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (z <= -14500000.0)
		tmp = Float64(Float64(x_m * Float64(y + t)) / z);
	elseif (z <= 1.0)
		tmp = Float64(Float64(x_m * Float64(y - Float64(z * t))) / z);
	else
		tmp = Float64(x_m * Float64(Float64(y + t) / z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if (z <= -14500000.0)
		tmp = (x_m * (y + t)) / z;
	elseif (z <= 1.0)
		tmp = (x_m * (y - (z * t))) / z;
	else
		tmp = x_m * ((y + t) / z);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -14500000.0], N[(N[(x$95$m * N[(y + t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 1.0], N[(N[(x$95$m * N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(x$95$m * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -14500000:\\
\;\;\;\;\frac{x\_m \cdot \left(y + t\right)}{z}\\

\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{x\_m \cdot \left(y - z \cdot t\right)}{z}\\

\mathbf{else}:\\
\;\;\;\;x\_m \cdot \frac{y + t}{z}\\


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

    1. Initial program 94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.45e7 < z < 1

    1. Initial program 90.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \mathsf{fma}\left(t, \frac{1}{-1 + \color{blue}{z}}, \frac{y}{z}\right) \]
      16. lower-+.f6490.9

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot \left(y - \color{blue}{z \cdot t}\right)}{z} \]
      14. lower-*.f6492.9

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

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

    if 1 < z

    1. Initial program 98.2%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{y - -1 \cdot t}{z}} \]
      2. cancel-sign-sub-invN/A

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

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

        \[\leadsto x \cdot \frac{y + \color{blue}{t}}{z} \]
      5. lower-+.f6498.2

        \[\leadsto x \cdot \frac{\color{blue}{y + t}}{z} \]
    5. Applied rewrites98.2%

      \[\leadsto x \cdot \color{blue}{\frac{y + t}{z}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 65.6% accurate, 1.0× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ \begin{array}{l} t_1 := t \cdot \frac{x\_m}{z}\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t \leq -5 \cdot 10^{+94}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 4.4 \cdot 10^{+75}:\\ \;\;\;\;x\_m \cdot \frac{y}{z}\\ \mathbf{elif}\;t \leq 2.5 \cdot 10^{+207}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot \left(-t\right)\\ \end{array} \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
 :precision binary64
 (let* ((t_1 (* t (/ x_m z))))
   (*
    x_s
    (if (<= t -5e+94)
      t_1
      (if (<= t 4.4e+75)
        (* x_m (/ y z))
        (if (<= t 2.5e+207) t_1 (* x_m (- t))))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = t * (x_m / z);
	double tmp;
	if (t <= -5e+94) {
		tmp = t_1;
	} else if (t <= 4.4e+75) {
		tmp = x_m * (y / z);
	} else if (t <= 2.5e+207) {
		tmp = t_1;
	} else {
		tmp = x_m * -t;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = t * (x_m / z)
    if (t <= (-5d+94)) then
        tmp = t_1
    else if (t <= 4.4d+75) then
        tmp = x_m * (y / z)
    else if (t <= 2.5d+207) then
        tmp = t_1
    else
        tmp = x_m * -t
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = t * (x_m / z);
	double tmp;
	if (t <= -5e+94) {
		tmp = t_1;
	} else if (t <= 4.4e+75) {
		tmp = x_m * (y / z);
	} else if (t <= 2.5e+207) {
		tmp = t_1;
	} else {
		tmp = x_m * -t;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z, t):
	t_1 = t * (x_m / z)
	tmp = 0
	if t <= -5e+94:
		tmp = t_1
	elif t <= 4.4e+75:
		tmp = x_m * (y / z)
	elif t <= 2.5e+207:
		tmp = t_1
	else:
		tmp = x_m * -t
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	t_1 = Float64(t * Float64(x_m / z))
	tmp = 0.0
	if (t <= -5e+94)
		tmp = t_1;
	elseif (t <= 4.4e+75)
		tmp = Float64(x_m * Float64(y / z));
	elseif (t <= 2.5e+207)
		tmp = t_1;
	else
		tmp = Float64(x_m * Float64(-t));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z, t)
	t_1 = t * (x_m / z);
	tmp = 0.0;
	if (t <= -5e+94)
		tmp = t_1;
	elseif (t <= 4.4e+75)
		tmp = x_m * (y / z);
	elseif (t <= 2.5e+207)
		tmp = t_1;
	else
		tmp = x_m * -t;
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t, -5e+94], t$95$1, If[LessEqual[t, 4.4e+75], N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.5e+207], t$95$1, N[(x$95$m * (-t)), $MachinePrecision]]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
\begin{array}{l}
t_1 := t \cdot \frac{x\_m}{z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{+94}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 4.4 \cdot 10^{+75}:\\
\;\;\;\;x\_m \cdot \frac{y}{z}\\

\mathbf{elif}\;t \leq 2.5 \cdot 10^{+207}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;x\_m \cdot \left(-t\right)\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -5.0000000000000001e94 or 4.40000000000000024e75 < t < 2.5e207

    1. Initial program 93.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x \cdot t}}{z} \]
      3. lower-*.f6451.2

        \[\leadsto \frac{\color{blue}{x \cdot t}}{z} \]
    8. Applied rewrites51.2%

      \[\leadsto \color{blue}{\frac{x \cdot t}{z}} \]
    9. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \color{blue}{t \cdot \frac{x}{z}} \]
      3. lift-/.f64N/A

        \[\leadsto t \cdot \color{blue}{\frac{x}{z}} \]
      4. lower-*.f6451.4

        \[\leadsto \color{blue}{t \cdot \frac{x}{z}} \]
    10. Applied rewrites51.4%

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

    if -5.0000000000000001e94 < t < 4.40000000000000024e75

    1. Initial program 92.9%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{y}{z}} \]
    5. Applied rewrites78.1%

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

    if 2.5e207 < t

    1. Initial program 96.0%

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

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

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

        \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{\mathsf{fma}\left(z, z \cdot \left(t \cdot z - -1 \cdot t\right) - -1 \cdot t, t\right)}\right) \]
      3. cancel-sign-sub-invN/A

        \[\leadsto x \cdot \left(\frac{y}{z} - \mathsf{fma}\left(z, \color{blue}{z \cdot \left(t \cdot z - -1 \cdot t\right) + \left(\mathsf{neg}\left(-1\right)\right) \cdot t}, t\right)\right) \]
      4. cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\frac{y}{z} - \mathsf{fma}\left(z, \mathsf{fma}\left(z, \color{blue}{z \cdot t} + t, t\right), t\right)\right) \]
      13. lower-fma.f6464.4

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

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

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

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

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

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\color{blue}{\left(z \cdot \left(t + z \cdot \left(t + t \cdot z\right)\right) + t\right)}\right)\right) \]
      4. *-lft-identityN/A

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\left(z \cdot \left(\color{blue}{1 \cdot t} + z \cdot \left(t + t \cdot z\right)\right) + t\right)\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\left(z \cdot \left(1 \cdot t + z \cdot \left(t + \color{blue}{z \cdot t}\right)\right) + t\right)\right)\right) \]
      6. distribute-rgt1-inN/A

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

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

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

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\left(z \cdot \color{blue}{\left(t \cdot \left(1 + z \cdot \left(1 + z\right)\right)\right)} + t\right)\right)\right) \]
      10. *-commutativeN/A

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

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

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

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\color{blue}{\mathsf{fma}\left(t, z \cdot \left(1 + z \cdot \left(1 + z\right)\right), t\right)}\right)\right) \]
    8. Applied rewrites48.9%

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

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot x\right)} \]
    10. Step-by-step derivation
      1. associate-*r*N/A

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

        \[\leadsto \color{blue}{\left(-1 \cdot t\right) \cdot x} \]
      3. mul-1-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(t\right)\right)} \cdot x \]
      4. lower-neg.f6453.4

        \[\leadsto \color{blue}{\left(-t\right)} \cdot x \]
    11. Applied rewrites53.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5 \cdot 10^{+94}:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \mathbf{elif}\;t \leq 4.4 \cdot 10^{+75}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;t \leq 2.5 \cdot 10^{+207}:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 91.2% accurate, 1.0× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -3.8 \cdot 10^{-15}:\\ \;\;\;\;\frac{x\_m \cdot \left(y + t\right)}{z}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;x\_m \cdot \mathsf{fma}\left(t, -1, \frac{y}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot \frac{y + t}{z}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= z -3.8e-15)
    (/ (* x_m (+ y t)) z)
    (if (<= z 1.0) (* x_m (fma t -1.0 (/ y z))) (* x_m (/ (+ y t) z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (z <= -3.8e-15) {
		tmp = (x_m * (y + t)) / z;
	} else if (z <= 1.0) {
		tmp = x_m * fma(t, -1.0, (y / z));
	} else {
		tmp = x_m * ((y + t) / z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (z <= -3.8e-15)
		tmp = Float64(Float64(x_m * Float64(y + t)) / z);
	elseif (z <= 1.0)
		tmp = Float64(x_m * fma(t, -1.0, Float64(y / z)));
	else
		tmp = Float64(x_m * Float64(Float64(y + t) / z));
	end
	return Float64(x_s * tmp)
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -3.8e-15], N[(N[(x$95$m * N[(y + t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 1.0], N[(x$95$m * N[(t * -1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-15}:\\
\;\;\;\;\frac{x\_m \cdot \left(y + t\right)}{z}\\

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

\mathbf{else}:\\
\;\;\;\;x\_m \cdot \frac{y + t}{z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.8000000000000002e-15

    1. Initial program 94.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.8000000000000002e-15 < z < 1

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot \mathsf{fma}\left(t, \color{blue}{-1}, \frac{y}{z}\right) \]
    6. Step-by-step derivation
      1. Applied rewrites89.3%

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

      if 1 < z

      1. Initial program 98.2%

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

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

          \[\leadsto x \cdot \color{blue}{\frac{y - -1 \cdot t}{z}} \]
        2. cancel-sign-sub-invN/A

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

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

          \[\leadsto x \cdot \frac{y + \color{blue}{t}}{z} \]
        5. lower-+.f6498.2

          \[\leadsto x \cdot \frac{\color{blue}{y + t}}{z} \]
      5. Applied rewrites98.2%

        \[\leadsto x \cdot \color{blue}{\frac{y + t}{z}} \]
    7. Recombined 3 regimes into one program.
    8. Add Preprocessing

    Alternative 8: 71.3% accurate, 1.1× speedup?

    \[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ \begin{array}{l} t_1 := \frac{x\_m \cdot y}{z}\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -4.7 \cdot 10^{-148}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+59}:\\ \;\;\;\;x\_m \cdot \frac{t}{z + -1}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \end{array} \]
    x\_m = (fabs.f64 x)
    x\_s = (copysign.f64 #s(literal 1 binary64) x)
    (FPCore (x_s x_m y z t)
     :precision binary64
     (let* ((t_1 (/ (* x_m y) z)))
       (*
        x_s
        (if (<= y -4.7e-148)
          t_1
          (if (<= y 1.4e+59) (* x_m (/ t (+ z -1.0))) t_1)))))
    x\_m = fabs(x);
    x\_s = copysign(1.0, x);
    double code(double x_s, double x_m, double y, double z, double t) {
    	double t_1 = (x_m * y) / z;
    	double tmp;
    	if (y <= -4.7e-148) {
    		tmp = t_1;
    	} else if (y <= 1.4e+59) {
    		tmp = x_m * (t / (z + -1.0));
    	} else {
    		tmp = t_1;
    	}
    	return x_s * tmp;
    }
    
    x\_m = abs(x)
    x\_s = copysign(1.0d0, x)
    real(8) function code(x_s, x_m, y, z, t)
        real(8), intent (in) :: x_s
        real(8), intent (in) :: x_m
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: t
        real(8) :: t_1
        real(8) :: tmp
        t_1 = (x_m * y) / z
        if (y <= (-4.7d-148)) then
            tmp = t_1
        else if (y <= 1.4d+59) then
            tmp = x_m * (t / (z + (-1.0d0)))
        else
            tmp = t_1
        end if
        code = x_s * tmp
    end function
    
    x\_m = Math.abs(x);
    x\_s = Math.copySign(1.0, x);
    public static double code(double x_s, double x_m, double y, double z, double t) {
    	double t_1 = (x_m * y) / z;
    	double tmp;
    	if (y <= -4.7e-148) {
    		tmp = t_1;
    	} else if (y <= 1.4e+59) {
    		tmp = x_m * (t / (z + -1.0));
    	} else {
    		tmp = t_1;
    	}
    	return x_s * tmp;
    }
    
    x\_m = math.fabs(x)
    x\_s = math.copysign(1.0, x)
    def code(x_s, x_m, y, z, t):
    	t_1 = (x_m * y) / z
    	tmp = 0
    	if y <= -4.7e-148:
    		tmp = t_1
    	elif y <= 1.4e+59:
    		tmp = x_m * (t / (z + -1.0))
    	else:
    		tmp = t_1
    	return x_s * tmp
    
    x\_m = abs(x)
    x\_s = copysign(1.0, x)
    function code(x_s, x_m, y, z, t)
    	t_1 = Float64(Float64(x_m * y) / z)
    	tmp = 0.0
    	if (y <= -4.7e-148)
    		tmp = t_1;
    	elseif (y <= 1.4e+59)
    		tmp = Float64(x_m * Float64(t / Float64(z + -1.0)));
    	else
    		tmp = t_1;
    	end
    	return Float64(x_s * tmp)
    end
    
    x\_m = abs(x);
    x\_s = sign(x) * abs(1.0);
    function tmp_2 = code(x_s, x_m, y, z, t)
    	t_1 = (x_m * y) / z;
    	tmp = 0.0;
    	if (y <= -4.7e-148)
    		tmp = t_1;
    	elseif (y <= 1.4e+59)
    		tmp = x_m * (t / (z + -1.0));
    	else
    		tmp = t_1;
    	end
    	tmp_2 = x_s * tmp;
    end
    
    x\_m = N[Abs[x], $MachinePrecision]
    x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
    code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x$95$m * y), $MachinePrecision] / z), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -4.7e-148], t$95$1, If[LessEqual[y, 1.4e+59], N[(x$95$m * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]), $MachinePrecision]]
    
    \begin{array}{l}
    x\_m = \left|x\right|
    \\
    x\_s = \mathsf{copysign}\left(1, x\right)
    
    \\
    \begin{array}{l}
    t_1 := \frac{x\_m \cdot y}{z}\\
    x\_s \cdot \begin{array}{l}
    \mathbf{if}\;y \leq -4.7 \cdot 10^{-148}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;y \leq 1.4 \cdot 10^{+59}:\\
    \;\;\;\;x\_m \cdot \frac{t}{z + -1}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < -4.69999999999999975e-148 or 1.3999999999999999e59 < y

      1. Initial program 90.7%

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

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

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

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

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

      if -4.69999999999999975e-148 < y < 1.3999999999999999e59

      1. Initial program 96.8%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{1 - z}} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto x \cdot \frac{t}{\color{blue}{z} + \left(\mathsf{neg}\left(1\right)\right)} \]
        16. metadata-evalN/A

          \[\leadsto x \cdot \frac{t}{z + \color{blue}{-1}} \]
        17. lower-+.f6478.2

          \[\leadsto x \cdot \frac{t}{\color{blue}{z + -1}} \]
      5. Applied rewrites78.2%

        \[\leadsto \color{blue}{x \cdot \frac{t}{z + -1}} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 9: 68.2% accurate, 1.2× speedup?

    \[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ \begin{array}{l} t_1 := x\_m \cdot \frac{t}{z}\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t \leq -2.1 \cdot 10^{+94}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 4.4 \cdot 10^{+75}:\\ \;\;\;\;\frac{x\_m \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \end{array} \]
    x\_m = (fabs.f64 x)
    x\_s = (copysign.f64 #s(literal 1 binary64) x)
    (FPCore (x_s x_m y z t)
     :precision binary64
     (let* ((t_1 (* x_m (/ t z))))
       (* x_s (if (<= t -2.1e+94) t_1 (if (<= t 4.4e+75) (/ (* x_m y) z) t_1)))))
    x\_m = fabs(x);
    x\_s = copysign(1.0, x);
    double code(double x_s, double x_m, double y, double z, double t) {
    	double t_1 = x_m * (t / z);
    	double tmp;
    	if (t <= -2.1e+94) {
    		tmp = t_1;
    	} else if (t <= 4.4e+75) {
    		tmp = (x_m * y) / z;
    	} else {
    		tmp = t_1;
    	}
    	return x_s * tmp;
    }
    
    x\_m = abs(x)
    x\_s = copysign(1.0d0, x)
    real(8) function code(x_s, x_m, y, z, t)
        real(8), intent (in) :: x_s
        real(8), intent (in) :: x_m
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: t
        real(8) :: t_1
        real(8) :: tmp
        t_1 = x_m * (t / z)
        if (t <= (-2.1d+94)) then
            tmp = t_1
        else if (t <= 4.4d+75) then
            tmp = (x_m * y) / z
        else
            tmp = t_1
        end if
        code = x_s * tmp
    end function
    
    x\_m = Math.abs(x);
    x\_s = Math.copySign(1.0, x);
    public static double code(double x_s, double x_m, double y, double z, double t) {
    	double t_1 = x_m * (t / z);
    	double tmp;
    	if (t <= -2.1e+94) {
    		tmp = t_1;
    	} else if (t <= 4.4e+75) {
    		tmp = (x_m * y) / z;
    	} else {
    		tmp = t_1;
    	}
    	return x_s * tmp;
    }
    
    x\_m = math.fabs(x)
    x\_s = math.copysign(1.0, x)
    def code(x_s, x_m, y, z, t):
    	t_1 = x_m * (t / z)
    	tmp = 0
    	if t <= -2.1e+94:
    		tmp = t_1
    	elif t <= 4.4e+75:
    		tmp = (x_m * y) / z
    	else:
    		tmp = t_1
    	return x_s * tmp
    
    x\_m = abs(x)
    x\_s = copysign(1.0, x)
    function code(x_s, x_m, y, z, t)
    	t_1 = Float64(x_m * Float64(t / z))
    	tmp = 0.0
    	if (t <= -2.1e+94)
    		tmp = t_1;
    	elseif (t <= 4.4e+75)
    		tmp = Float64(Float64(x_m * y) / z);
    	else
    		tmp = t_1;
    	end
    	return Float64(x_s * tmp)
    end
    
    x\_m = abs(x);
    x\_s = sign(x) * abs(1.0);
    function tmp_2 = code(x_s, x_m, y, z, t)
    	t_1 = x_m * (t / z);
    	tmp = 0.0;
    	if (t <= -2.1e+94)
    		tmp = t_1;
    	elseif (t <= 4.4e+75)
    		tmp = (x_m * y) / z;
    	else
    		tmp = t_1;
    	end
    	tmp_2 = x_s * tmp;
    end
    
    x\_m = N[Abs[x], $MachinePrecision]
    x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
    code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(x$95$m * N[(t / z), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t, -2.1e+94], t$95$1, If[LessEqual[t, 4.4e+75], N[(N[(x$95$m * y), $MachinePrecision] / z), $MachinePrecision], t$95$1]]), $MachinePrecision]]
    
    \begin{array}{l}
    x\_m = \left|x\right|
    \\
    x\_s = \mathsf{copysign}\left(1, x\right)
    
    \\
    \begin{array}{l}
    t_1 := x\_m \cdot \frac{t}{z}\\
    x\_s \cdot \begin{array}{l}
    \mathbf{if}\;t \leq -2.1 \cdot 10^{+94}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;t \leq 4.4 \cdot 10^{+75}:\\
    \;\;\;\;\frac{x\_m \cdot y}{z}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if t < -2.09999999999999989e94 or 4.40000000000000024e75 < t

      1. Initial program 94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{x \cdot t}}{z} \]
        3. lower-*.f6450.7

          \[\leadsto \frac{\color{blue}{x \cdot t}}{z} \]
      8. Applied rewrites50.7%

        \[\leadsto \color{blue}{\frac{x \cdot t}{z}} \]
      9. Step-by-step derivation
        1. associate-/l*N/A

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

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

          \[\leadsto \color{blue}{\frac{t}{z} \cdot x} \]
        4. lower-/.f6454.3

          \[\leadsto \color{blue}{\frac{t}{z}} \cdot x \]
      10. Applied rewrites54.3%

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

      if -2.09999999999999989e94 < t < 4.40000000000000024e75

      1. Initial program 92.9%

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

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification69.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.1 \cdot 10^{+94}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{elif}\;t \leq 4.4 \cdot 10^{+75}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 10: 67.9% accurate, 1.2× speedup?

    \[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ \begin{array}{l} t_1 := x\_m \cdot \frac{t}{z}\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t \leq -9 \cdot 10^{+89}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 4.4 \cdot 10^{+75}:\\ \;\;\;\;y \cdot \frac{x\_m}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \end{array} \]
    x\_m = (fabs.f64 x)
    x\_s = (copysign.f64 #s(literal 1 binary64) x)
    (FPCore (x_s x_m y z t)
     :precision binary64
     (let* ((t_1 (* x_m (/ t z))))
       (* x_s (if (<= t -9e+89) t_1 (if (<= t 4.4e+75) (* y (/ x_m z)) t_1)))))
    x\_m = fabs(x);
    x\_s = copysign(1.0, x);
    double code(double x_s, double x_m, double y, double z, double t) {
    	double t_1 = x_m * (t / z);
    	double tmp;
    	if (t <= -9e+89) {
    		tmp = t_1;
    	} else if (t <= 4.4e+75) {
    		tmp = y * (x_m / z);
    	} else {
    		tmp = t_1;
    	}
    	return x_s * tmp;
    }
    
    x\_m = abs(x)
    x\_s = copysign(1.0d0, x)
    real(8) function code(x_s, x_m, y, z, t)
        real(8), intent (in) :: x_s
        real(8), intent (in) :: x_m
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: t
        real(8) :: t_1
        real(8) :: tmp
        t_1 = x_m * (t / z)
        if (t <= (-9d+89)) then
            tmp = t_1
        else if (t <= 4.4d+75) then
            tmp = y * (x_m / z)
        else
            tmp = t_1
        end if
        code = x_s * tmp
    end function
    
    x\_m = Math.abs(x);
    x\_s = Math.copySign(1.0, x);
    public static double code(double x_s, double x_m, double y, double z, double t) {
    	double t_1 = x_m * (t / z);
    	double tmp;
    	if (t <= -9e+89) {
    		tmp = t_1;
    	} else if (t <= 4.4e+75) {
    		tmp = y * (x_m / z);
    	} else {
    		tmp = t_1;
    	}
    	return x_s * tmp;
    }
    
    x\_m = math.fabs(x)
    x\_s = math.copysign(1.0, x)
    def code(x_s, x_m, y, z, t):
    	t_1 = x_m * (t / z)
    	tmp = 0
    	if t <= -9e+89:
    		tmp = t_1
    	elif t <= 4.4e+75:
    		tmp = y * (x_m / z)
    	else:
    		tmp = t_1
    	return x_s * tmp
    
    x\_m = abs(x)
    x\_s = copysign(1.0, x)
    function code(x_s, x_m, y, z, t)
    	t_1 = Float64(x_m * Float64(t / z))
    	tmp = 0.0
    	if (t <= -9e+89)
    		tmp = t_1;
    	elseif (t <= 4.4e+75)
    		tmp = Float64(y * Float64(x_m / z));
    	else
    		tmp = t_1;
    	end
    	return Float64(x_s * tmp)
    end
    
    x\_m = abs(x);
    x\_s = sign(x) * abs(1.0);
    function tmp_2 = code(x_s, x_m, y, z, t)
    	t_1 = x_m * (t / z);
    	tmp = 0.0;
    	if (t <= -9e+89)
    		tmp = t_1;
    	elseif (t <= 4.4e+75)
    		tmp = y * (x_m / z);
    	else
    		tmp = t_1;
    	end
    	tmp_2 = x_s * tmp;
    end
    
    x\_m = N[Abs[x], $MachinePrecision]
    x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
    code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(x$95$m * N[(t / z), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t, -9e+89], t$95$1, If[LessEqual[t, 4.4e+75], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], t$95$1]]), $MachinePrecision]]
    
    \begin{array}{l}
    x\_m = \left|x\right|
    \\
    x\_s = \mathsf{copysign}\left(1, x\right)
    
    \\
    \begin{array}{l}
    t_1 := x\_m \cdot \frac{t}{z}\\
    x\_s \cdot \begin{array}{l}
    \mathbf{if}\;t \leq -9 \cdot 10^{+89}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;t \leq 4.4 \cdot 10^{+75}:\\
    \;\;\;\;y \cdot \frac{x\_m}{z}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if t < -9e89 or 4.40000000000000024e75 < t

      1. Initial program 94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{x \cdot t}}{z} \]
        3. lower-*.f6450.7

          \[\leadsto \frac{\color{blue}{x \cdot t}}{z} \]
      8. Applied rewrites50.7%

        \[\leadsto \color{blue}{\frac{x \cdot t}{z}} \]
      9. Step-by-step derivation
        1. associate-/l*N/A

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

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

          \[\leadsto \color{blue}{\frac{t}{z} \cdot x} \]
        4. lower-/.f6454.3

          \[\leadsto \color{blue}{\frac{t}{z}} \cdot x \]
      10. Applied rewrites54.3%

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

      if -9e89 < t < 4.40000000000000024e75

      1. Initial program 92.9%

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

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

          \[\leadsto x \cdot \color{blue}{\frac{y}{z}} \]
      5. Applied rewrites78.1%

        \[\leadsto x \cdot \color{blue}{\frac{y}{z}} \]
      6. Step-by-step derivation
        1. clear-numN/A

          \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{z}{y}}} \]
        2. lift-/.f64N/A

          \[\leadsto x \cdot \frac{1}{\color{blue}{\frac{z}{y}}} \]
        3. un-div-invN/A

          \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
        4. lower-/.f6478.2

          \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
      7. Applied rewrites78.2%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
      8. Step-by-step derivation
        1. associate-/r/N/A

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

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

          \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
      9. Applied rewrites79.1%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification69.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -9 \cdot 10^{+89}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{elif}\;t \leq 4.4 \cdot 10^{+75}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 11: 69.0% accurate, 1.2× speedup?

    \[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ \begin{array}{l} t_1 := x\_m \cdot \frac{t}{z}\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t \leq -2 \cdot 10^{+94}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 4.4 \cdot 10^{+75}:\\ \;\;\;\;x\_m \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \end{array} \]
    x\_m = (fabs.f64 x)
    x\_s = (copysign.f64 #s(literal 1 binary64) x)
    (FPCore (x_s x_m y z t)
     :precision binary64
     (let* ((t_1 (* x_m (/ t z))))
       (* x_s (if (<= t -2e+94) t_1 (if (<= t 4.4e+75) (* x_m (/ y z)) t_1)))))
    x\_m = fabs(x);
    x\_s = copysign(1.0, x);
    double code(double x_s, double x_m, double y, double z, double t) {
    	double t_1 = x_m * (t / z);
    	double tmp;
    	if (t <= -2e+94) {
    		tmp = t_1;
    	} else if (t <= 4.4e+75) {
    		tmp = x_m * (y / z);
    	} else {
    		tmp = t_1;
    	}
    	return x_s * tmp;
    }
    
    x\_m = abs(x)
    x\_s = copysign(1.0d0, x)
    real(8) function code(x_s, x_m, y, z, t)
        real(8), intent (in) :: x_s
        real(8), intent (in) :: x_m
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: t
        real(8) :: t_1
        real(8) :: tmp
        t_1 = x_m * (t / z)
        if (t <= (-2d+94)) then
            tmp = t_1
        else if (t <= 4.4d+75) then
            tmp = x_m * (y / z)
        else
            tmp = t_1
        end if
        code = x_s * tmp
    end function
    
    x\_m = Math.abs(x);
    x\_s = Math.copySign(1.0, x);
    public static double code(double x_s, double x_m, double y, double z, double t) {
    	double t_1 = x_m * (t / z);
    	double tmp;
    	if (t <= -2e+94) {
    		tmp = t_1;
    	} else if (t <= 4.4e+75) {
    		tmp = x_m * (y / z);
    	} else {
    		tmp = t_1;
    	}
    	return x_s * tmp;
    }
    
    x\_m = math.fabs(x)
    x\_s = math.copysign(1.0, x)
    def code(x_s, x_m, y, z, t):
    	t_1 = x_m * (t / z)
    	tmp = 0
    	if t <= -2e+94:
    		tmp = t_1
    	elif t <= 4.4e+75:
    		tmp = x_m * (y / z)
    	else:
    		tmp = t_1
    	return x_s * tmp
    
    x\_m = abs(x)
    x\_s = copysign(1.0, x)
    function code(x_s, x_m, y, z, t)
    	t_1 = Float64(x_m * Float64(t / z))
    	tmp = 0.0
    	if (t <= -2e+94)
    		tmp = t_1;
    	elseif (t <= 4.4e+75)
    		tmp = Float64(x_m * Float64(y / z));
    	else
    		tmp = t_1;
    	end
    	return Float64(x_s * tmp)
    end
    
    x\_m = abs(x);
    x\_s = sign(x) * abs(1.0);
    function tmp_2 = code(x_s, x_m, y, z, t)
    	t_1 = x_m * (t / z);
    	tmp = 0.0;
    	if (t <= -2e+94)
    		tmp = t_1;
    	elseif (t <= 4.4e+75)
    		tmp = x_m * (y / z);
    	else
    		tmp = t_1;
    	end
    	tmp_2 = x_s * tmp;
    end
    
    x\_m = N[Abs[x], $MachinePrecision]
    x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
    code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(x$95$m * N[(t / z), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t, -2e+94], t$95$1, If[LessEqual[t, 4.4e+75], N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision], t$95$1]]), $MachinePrecision]]
    
    \begin{array}{l}
    x\_m = \left|x\right|
    \\
    x\_s = \mathsf{copysign}\left(1, x\right)
    
    \\
    \begin{array}{l}
    t_1 := x\_m \cdot \frac{t}{z}\\
    x\_s \cdot \begin{array}{l}
    \mathbf{if}\;t \leq -2 \cdot 10^{+94}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;t \leq 4.4 \cdot 10^{+75}:\\
    \;\;\;\;x\_m \cdot \frac{y}{z}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if t < -2e94 or 4.40000000000000024e75 < t

      1. Initial program 94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{x \cdot t}}{z} \]
        3. lower-*.f6450.7

          \[\leadsto \frac{\color{blue}{x \cdot t}}{z} \]
      8. Applied rewrites50.7%

        \[\leadsto \color{blue}{\frac{x \cdot t}{z}} \]
      9. Step-by-step derivation
        1. associate-/l*N/A

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

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

          \[\leadsto \color{blue}{\frac{t}{z} \cdot x} \]
        4. lower-/.f6454.3

          \[\leadsto \color{blue}{\frac{t}{z}} \cdot x \]
      10. Applied rewrites54.3%

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

      if -2e94 < t < 4.40000000000000024e75

      1. Initial program 92.9%

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

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

          \[\leadsto x \cdot \color{blue}{\frac{y}{z}} \]
      5. Applied rewrites78.1%

        \[\leadsto x \cdot \color{blue}{\frac{y}{z}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification68.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2 \cdot 10^{+94}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{elif}\;t \leq 4.4 \cdot 10^{+75}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 12: 41.3% accurate, 1.2× speedup?

    \[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ \begin{array}{l} t_1 := t \cdot \frac{x\_m}{z}\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -2.2 \cdot 10^{-14}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{+16}:\\ \;\;\;\;\mathsf{fma}\left(z, x\_m, x\_m\right) \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \end{array} \]
    x\_m = (fabs.f64 x)
    x\_s = (copysign.f64 #s(literal 1 binary64) x)
    (FPCore (x_s x_m y z t)
     :precision binary64
     (let* ((t_1 (* t (/ x_m z))))
       (*
        x_s
        (if (<= z -2.2e-14)
          t_1
          (if (<= z 5.2e+16) (* (fma z x_m x_m) (- t)) t_1)))))
    x\_m = fabs(x);
    x\_s = copysign(1.0, x);
    double code(double x_s, double x_m, double y, double z, double t) {
    	double t_1 = t * (x_m / z);
    	double tmp;
    	if (z <= -2.2e-14) {
    		tmp = t_1;
    	} else if (z <= 5.2e+16) {
    		tmp = fma(z, x_m, x_m) * -t;
    	} else {
    		tmp = t_1;
    	}
    	return x_s * tmp;
    }
    
    x\_m = abs(x)
    x\_s = copysign(1.0, x)
    function code(x_s, x_m, y, z, t)
    	t_1 = Float64(t * Float64(x_m / z))
    	tmp = 0.0
    	if (z <= -2.2e-14)
    		tmp = t_1;
    	elseif (z <= 5.2e+16)
    		tmp = Float64(fma(z, x_m, x_m) * Float64(-t));
    	else
    		tmp = t_1;
    	end
    	return Float64(x_s * tmp)
    end
    
    x\_m = N[Abs[x], $MachinePrecision]
    x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
    code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -2.2e-14], t$95$1, If[LessEqual[z, 5.2e+16], N[(N[(z * x$95$m + x$95$m), $MachinePrecision] * (-t)), $MachinePrecision], t$95$1]]), $MachinePrecision]]
    
    \begin{array}{l}
    x\_m = \left|x\right|
    \\
    x\_s = \mathsf{copysign}\left(1, x\right)
    
    \\
    \begin{array}{l}
    t_1 := t \cdot \frac{x\_m}{z}\\
    x\_s \cdot \begin{array}{l}
    \mathbf{if}\;z \leq -2.2 \cdot 10^{-14}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;z \leq 5.2 \cdot 10^{+16}:\\
    \;\;\;\;\mathsf{fma}\left(z, x\_m, x\_m\right) \cdot \left(-t\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if z < -2.2000000000000001e-14 or 5.2e16 < z

      1. Initial program 96.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{x \cdot t}}{z} \]
        3. lower-*.f6459.6

          \[\leadsto \frac{\color{blue}{x \cdot t}}{z} \]
      8. Applied rewrites59.6%

        \[\leadsto \color{blue}{\frac{x \cdot t}{z}} \]
      9. Step-by-step derivation
        1. *-commutativeN/A

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

          \[\leadsto \color{blue}{t \cdot \frac{x}{z}} \]
        3. lift-/.f64N/A

          \[\leadsto t \cdot \color{blue}{\frac{x}{z}} \]
        4. lower-*.f6455.8

          \[\leadsto \color{blue}{t \cdot \frac{x}{z}} \]
      10. Applied rewrites55.8%

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

      if -2.2000000000000001e-14 < z < 5.2e16

      1. Initial program 90.9%

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

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

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

          \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{\mathsf{fma}\left(z, z \cdot \left(t \cdot z - -1 \cdot t\right) - -1 \cdot t, t\right)}\right) \]
        3. cancel-sign-sub-invN/A

          \[\leadsto x \cdot \left(\frac{y}{z} - \mathsf{fma}\left(z, \color{blue}{z \cdot \left(t \cdot z - -1 \cdot t\right) + \left(\mathsf{neg}\left(-1\right)\right) \cdot t}, t\right)\right) \]
        4. cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto x \cdot \left(\mathsf{neg}\left(\color{blue}{\left(z \cdot \left(t + z \cdot \left(t + t \cdot z\right)\right) + t\right)}\right)\right) \]
        4. *-lft-identityN/A

          \[\leadsto x \cdot \left(\mathsf{neg}\left(\left(z \cdot \left(\color{blue}{1 \cdot t} + z \cdot \left(t + t \cdot z\right)\right) + t\right)\right)\right) \]
        5. *-commutativeN/A

          \[\leadsto x \cdot \left(\mathsf{neg}\left(\left(z \cdot \left(1 \cdot t + z \cdot \left(t + \color{blue}{z \cdot t}\right)\right) + t\right)\right)\right) \]
        6. distribute-rgt1-inN/A

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

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

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

          \[\leadsto x \cdot \left(\mathsf{neg}\left(\left(z \cdot \color{blue}{\left(t \cdot \left(1 + z \cdot \left(1 + z\right)\right)\right)} + t\right)\right)\right) \]
        10. *-commutativeN/A

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

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

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

          \[\leadsto x \cdot \left(\mathsf{neg}\left(\color{blue}{\mathsf{fma}\left(t, z \cdot \left(1 + z \cdot \left(1 + z\right)\right), t\right)}\right)\right) \]
      8. Applied rewrites38.7%

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

        \[\leadsto \color{blue}{-1 \cdot \left(t \cdot x\right) + -1 \cdot \left(t \cdot \left(x \cdot z\right)\right)} \]
      10. Step-by-step derivation
        1. distribute-lft-outN/A

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

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

          \[\leadsto \color{blue}{\mathsf{neg}\left(\left(t \cdot x + t \cdot \left(x \cdot z\right)\right)\right)} \]
        4. distribute-lft-outN/A

          \[\leadsto \mathsf{neg}\left(\color{blue}{t \cdot \left(x + x \cdot z\right)}\right) \]
        5. *-rgt-identityN/A

          \[\leadsto \mathsf{neg}\left(t \cdot \left(\color{blue}{x \cdot 1} + x \cdot z\right)\right) \]
        6. distribute-lft-inN/A

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

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

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

          \[\leadsto \mathsf{neg}\left(t \cdot \color{blue}{\left(z \cdot x + 1 \cdot x\right)}\right) \]
        10. *-lft-identityN/A

          \[\leadsto \mathsf{neg}\left(t \cdot \left(z \cdot x + \color{blue}{x}\right)\right) \]
        11. lower-fma.f6438.2

          \[\leadsto -t \cdot \color{blue}{\mathsf{fma}\left(z, x, x\right)} \]
      11. Applied rewrites38.2%

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

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

    Alternative 13: 22.7% accurate, 4.3× speedup?

    \[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \left(x\_m \cdot \left(-t\right)\right) \end{array} \]
    x\_m = (fabs.f64 x)
    x\_s = (copysign.f64 #s(literal 1 binary64) x)
    (FPCore (x_s x_m y z t) :precision binary64 (* x_s (* x_m (- t))))
    x\_m = fabs(x);
    x\_s = copysign(1.0, x);
    double code(double x_s, double x_m, double y, double z, double t) {
    	return x_s * (x_m * -t);
    }
    
    x\_m = abs(x)
    x\_s = copysign(1.0d0, x)
    real(8) function code(x_s, x_m, y, z, t)
        real(8), intent (in) :: x_s
        real(8), intent (in) :: x_m
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: t
        code = x_s * (x_m * -t)
    end function
    
    x\_m = Math.abs(x);
    x\_s = Math.copySign(1.0, x);
    public static double code(double x_s, double x_m, double y, double z, double t) {
    	return x_s * (x_m * -t);
    }
    
    x\_m = math.fabs(x)
    x\_s = math.copysign(1.0, x)
    def code(x_s, x_m, y, z, t):
    	return x_s * (x_m * -t)
    
    x\_m = abs(x)
    x\_s = copysign(1.0, x)
    function code(x_s, x_m, y, z, t)
    	return Float64(x_s * Float64(x_m * Float64(-t)))
    end
    
    x\_m = abs(x);
    x\_s = sign(x) * abs(1.0);
    function tmp = code(x_s, x_m, y, z, t)
    	tmp = x_s * (x_m * -t);
    end
    
    x\_m = N[Abs[x], $MachinePrecision]
    x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
    code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(x$95$m * (-t)), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    x\_m = \left|x\right|
    \\
    x\_s = \mathsf{copysign}\left(1, x\right)
    
    \\
    x\_s \cdot \left(x\_m \cdot \left(-t\right)\right)
    \end{array}
    
    Derivation
    1. Initial program 93.4%

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

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

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

        \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{\mathsf{fma}\left(z, z \cdot \left(t \cdot z - -1 \cdot t\right) - -1 \cdot t, t\right)}\right) \]
      3. cancel-sign-sub-invN/A

        \[\leadsto x \cdot \left(\frac{y}{z} - \mathsf{fma}\left(z, \color{blue}{z \cdot \left(t \cdot z - -1 \cdot t\right) + \left(\mathsf{neg}\left(-1\right)\right) \cdot t}, t\right)\right) \]
      4. cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\frac{y}{z} - \mathsf{fma}\left(z, \mathsf{fma}\left(z, \color{blue}{z \cdot t} + t, t\right), t\right)\right) \]
      13. lower-fma.f6452.1

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

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

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

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

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

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\color{blue}{\left(z \cdot \left(t + z \cdot \left(t + t \cdot z\right)\right) + t\right)}\right)\right) \]
      4. *-lft-identityN/A

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\left(z \cdot \left(\color{blue}{1 \cdot t} + z \cdot \left(t + t \cdot z\right)\right) + t\right)\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\left(z \cdot \left(1 \cdot t + z \cdot \left(t + \color{blue}{z \cdot t}\right)\right) + t\right)\right)\right) \]
      6. distribute-rgt1-inN/A

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

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

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

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\left(z \cdot \color{blue}{\left(t \cdot \left(1 + z \cdot \left(1 + z\right)\right)\right)} + t\right)\right)\right) \]
      10. *-commutativeN/A

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

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

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

        \[\leadsto x \cdot \left(\mathsf{neg}\left(\color{blue}{\mathsf{fma}\left(t, z \cdot \left(1 + z \cdot \left(1 + z\right)\right), t\right)}\right)\right) \]
    8. Applied rewrites21.6%

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

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot x\right)} \]
    10. Step-by-step derivation
      1. associate-*r*N/A

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

        \[\leadsto \color{blue}{\left(-1 \cdot t\right) \cdot x} \]
      3. mul-1-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(t\right)\right)} \cdot x \]
      4. lower-neg.f6427.1

        \[\leadsto \color{blue}{\left(-t\right)} \cdot x \]
    11. Applied rewrites27.1%

      \[\leadsto \color{blue}{\left(-t\right) \cdot x} \]
    12. Final simplification27.1%

      \[\leadsto x \cdot \left(-t\right) \]
    13. Add Preprocessing

    Developer Target 1: 94.9% accurate, 0.3× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\ t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\ \mathbf{if}\;t\_2 < -7.623226303312042 \cdot 10^{-196}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 < 1.4133944927702302 \cdot 10^{-211}:\\ \;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (x y z t)
     :precision binary64
     (let* ((t_1 (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))))
            (t_2 (* x (- (/ y z) (/ t (- 1.0 z))))))
       (if (< t_2 -7.623226303312042e-196)
         t_1
         (if (< t_2 1.4133944927702302e-211)
           (+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z))))
           t_1))))
    double code(double x, double y, double z, double t) {
    	double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
    	double t_2 = x * ((y / z) - (t / (1.0 - z)));
    	double tmp;
    	if (t_2 < -7.623226303312042e-196) {
    		tmp = t_1;
    	} else if (t_2 < 1.4133944927702302e-211) {
    		tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    real(8) function code(x, y, z, t)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: t
        real(8) :: t_1
        real(8) :: t_2
        real(8) :: tmp
        t_1 = x * ((y / z) - (t * (1.0d0 / (1.0d0 - z))))
        t_2 = x * ((y / z) - (t / (1.0d0 - z)))
        if (t_2 < (-7.623226303312042d-196)) then
            tmp = t_1
        else if (t_2 < 1.4133944927702302d-211) then
            tmp = ((y * x) / z) + -((t * x) / (1.0d0 - z))
        else
            tmp = t_1
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z, double t) {
    	double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
    	double t_2 = x * ((y / z) - (t / (1.0 - z)));
    	double tmp;
    	if (t_2 < -7.623226303312042e-196) {
    		tmp = t_1;
    	} else if (t_2 < 1.4133944927702302e-211) {
    		tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t):
    	t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))))
    	t_2 = x * ((y / z) - (t / (1.0 - z)))
    	tmp = 0
    	if t_2 < -7.623226303312042e-196:
    		tmp = t_1
    	elif t_2 < 1.4133944927702302e-211:
    		tmp = ((y * x) / z) + -((t * x) / (1.0 - z))
    	else:
    		tmp = t_1
    	return tmp
    
    function code(x, y, z, t)
    	t_1 = Float64(x * Float64(Float64(y / z) - Float64(t * Float64(1.0 / Float64(1.0 - z)))))
    	t_2 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))))
    	tmp = 0.0
    	if (t_2 < -7.623226303312042e-196)
    		tmp = t_1;
    	elseif (t_2 < 1.4133944927702302e-211)
    		tmp = Float64(Float64(Float64(y * x) / z) + Float64(-Float64(Float64(t * x) / Float64(1.0 - z))));
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t)
    	t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
    	t_2 = x * ((y / z) - (t / (1.0 - z)));
    	tmp = 0.0;
    	if (t_2 < -7.623226303312042e-196)
    		tmp = t_1;
    	elseif (t_2 < 1.4133944927702302e-211)
    		tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
    	else
    		tmp = t_1;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t * N[(1.0 / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -7.623226303312042e-196], t$95$1, If[Less[t$95$2, 1.4133944927702302e-211], N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] + (-N[(N[(t * x), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], t$95$1]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\
    t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
    \mathbf{if}\;t\_2 < -7.623226303312042 \cdot 10^{-196}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;t\_2 < 1.4133944927702302 \cdot 10^{-211}:\\
    \;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    

    Reproduce

    ?
    herbie shell --seed 2024219 
    (FPCore (x y z t)
      :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
      :precision binary64
    
      :alt
      (! :herbie-platform default (if (< (* x (- (/ y z) (/ t (- 1 z)))) -3811613151656021/5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* x (- (/ y z) (* t (/ 1 (- 1 z))))) (if (< (* x (- (/ y z) (/ t (- 1 z)))) 7066972463851151/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (/ (* y x) z) (- (/ (* t x) (- 1 z)))) (* x (- (/ y z) (* t (/ 1 (- 1 z))))))))
    
      (* x (- (/ y z) (/ t (- 1.0 z)))))