Linear.Projection:infinitePerspective from linear-1.19.1.3, A

Percentage Accurate: 89.8% → 97.6%
Time: 11.0s
Alternatives: 10
Speedup: 1.2×

Specification

?
\[\begin{array}{l} \\ \frac{x \cdot 2}{y \cdot z - t \cdot z} \end{array} \]
(FPCore (x y z t) :precision binary64 (/ (* x 2.0) (- (* y z) (* t z))))
double code(double x, double y, double z, double t) {
	return (x * 2.0) / ((y * z) - (t * 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 * 2.0d0) / ((y * z) - (t * z))
end function
public static double code(double x, double y, double z, double t) {
	return (x * 2.0) / ((y * z) - (t * z));
}
def code(x, y, z, t):
	return (x * 2.0) / ((y * z) - (t * z))
function code(x, y, z, t)
	return Float64(Float64(x * 2.0) / Float64(Float64(y * z) - Float64(t * z)))
end
function tmp = code(x, y, z, t)
	tmp = (x * 2.0) / ((y * z) - (t * z));
end
code[x_, y_, z_, t_] := N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 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: 89.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x \cdot 2}{y \cdot z - t \cdot z} \end{array} \]
(FPCore (x y z t) :precision binary64 (/ (* x 2.0) (- (* y z) (* t z))))
double code(double x, double y, double z, double t) {
	return (x * 2.0) / ((y * z) - (t * 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 * 2.0d0) / ((y * z) - (t * z))
end function
public static double code(double x, double y, double z, double t) {
	return (x * 2.0) / ((y * z) - (t * z));
}
def code(x, y, z, t):
	return (x * 2.0) / ((y * z) - (t * z))
function code(x, y, z, t)
	return Float64(Float64(x * 2.0) / Float64(Float64(y * z) - Float64(t * z)))
end
function tmp = code(x, y, z, t)
	tmp = (x * 2.0) / ((y * z) - (t * z));
end
code[x_, y_, z_, t_] := N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\end{array}

Alternative 1: 97.6% accurate, 0.3× speedup?

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

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

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

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


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

    1. Initial program 58.4%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--58.4%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
    3. Simplified58.4%

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. times-frac99.9%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{2}{y - t}} \]
    6. Applied egg-rr99.9%

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

    if -inf.0 < (-.f64 (*.f64 y z) (*.f64 t z)) < 9.99999999999999921e273

    1. Initial program 98.3%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Add Preprocessing

    if 9.99999999999999921e273 < (-.f64 (*.f64 y z) (*.f64 t z))

    1. Initial program 64.4%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--79.2%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
    3. Simplified79.2%

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-out--64.4%

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

        \[\leadsto \color{blue}{x \cdot \frac{2}{y \cdot z - t \cdot z}} \]
      3. *-commutative64.4%

        \[\leadsto \color{blue}{\frac{2}{y \cdot z - t \cdot z} \cdot x} \]
      4. distribute-rgt-out--79.2%

        \[\leadsto \frac{2}{\color{blue}{z \cdot \left(y - t\right)}} \cdot x \]
    6. Applied egg-rr79.2%

      \[\leadsto \color{blue}{\frac{2}{z \cdot \left(y - t\right)} \cdot x} \]
    7. Step-by-step derivation
      1. associate-*l/79.2%

        \[\leadsto \color{blue}{\frac{2 \cdot x}{z \cdot \left(y - t\right)}} \]
      2. frac-times99.8%

        \[\leadsto \color{blue}{\frac{2}{z} \cdot \frac{x}{y - t}} \]
      3. frac-2neg99.8%

        \[\leadsto \frac{2}{z} \cdot \color{blue}{\frac{-x}{-\left(y - t\right)}} \]
      4. associate-*r/99.9%

        \[\leadsto \color{blue}{\frac{\frac{2}{z} \cdot \left(-x\right)}{-\left(y - t\right)}} \]
      5. sub-neg99.9%

        \[\leadsto \frac{\frac{2}{z} \cdot \left(-x\right)}{-\color{blue}{\left(y + \left(-t\right)\right)}} \]
      6. distribute-neg-in99.9%

        \[\leadsto \frac{\frac{2}{z} \cdot \left(-x\right)}{\color{blue}{\left(-y\right) + \left(-\left(-t\right)\right)}} \]
      7. add-sqr-sqrt40.7%

        \[\leadsto \frac{\frac{2}{z} \cdot \left(-x\right)}{\left(-y\right) + \left(-\color{blue}{\sqrt{-t} \cdot \sqrt{-t}}\right)} \]
      8. sqrt-unprod79.1%

        \[\leadsto \frac{\frac{2}{z} \cdot \left(-x\right)}{\left(-y\right) + \left(-\color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}\right)} \]
      9. sqr-neg79.1%

        \[\leadsto \frac{\frac{2}{z} \cdot \left(-x\right)}{\left(-y\right) + \left(-\sqrt{\color{blue}{t \cdot t}}\right)} \]
      10. sqrt-unprod45.2%

        \[\leadsto \frac{\frac{2}{z} \cdot \left(-x\right)}{\left(-y\right) + \left(-\color{blue}{\sqrt{t} \cdot \sqrt{t}}\right)} \]
      11. add-sqr-sqrt75.2%

        \[\leadsto \frac{\frac{2}{z} \cdot \left(-x\right)}{\left(-y\right) + \left(-\color{blue}{t}\right)} \]
      12. add-sqr-sqrt30.1%

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

        \[\leadsto \frac{\frac{2}{z} \cdot \left(-x\right)}{\left(-y\right) + \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}} \]
      14. sqr-neg82.4%

        \[\leadsto \frac{\frac{2}{z} \cdot \left(-x\right)}{\left(-y\right) + \sqrt{\color{blue}{t \cdot t}}} \]
      15. sqrt-unprod59.2%

        \[\leadsto \frac{\frac{2}{z} \cdot \left(-x\right)}{\left(-y\right) + \color{blue}{\sqrt{t} \cdot \sqrt{t}}} \]
      16. add-sqr-sqrt99.9%

        \[\leadsto \frac{\frac{2}{z} \cdot \left(-x\right)}{\left(-y\right) + \color{blue}{t}} \]
    8. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{\frac{2}{z} \cdot \left(-x\right)}{\left(-y\right) + t}} \]
    9. Step-by-step derivation
      1. frac-2neg99.9%

        \[\leadsto \color{blue}{\frac{-\frac{2}{z} \cdot \left(-x\right)}{-\left(\left(-y\right) + t\right)}} \]
      2. div-inv99.8%

        \[\leadsto \color{blue}{\left(-\frac{2}{z} \cdot \left(-x\right)\right) \cdot \frac{1}{-\left(\left(-y\right) + t\right)}} \]
      3. distribute-rgt-neg-out99.8%

        \[\leadsto \left(-\color{blue}{\left(-\frac{2}{z} \cdot x\right)}\right) \cdot \frac{1}{-\left(\left(-y\right) + t\right)} \]
      4. remove-double-neg99.8%

        \[\leadsto \color{blue}{\left(\frac{2}{z} \cdot x\right)} \cdot \frac{1}{-\left(\left(-y\right) + t\right)} \]
      5. distribute-neg-in99.8%

        \[\leadsto \left(\frac{2}{z} \cdot x\right) \cdot \frac{1}{\color{blue}{\left(-\left(-y\right)\right) + \left(-t\right)}} \]
      6. add-sqr-sqrt44.4%

        \[\leadsto \left(\frac{2}{z} \cdot x\right) \cdot \frac{1}{\left(-\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}\right) + \left(-t\right)} \]
      7. sqrt-unprod92.8%

        \[\leadsto \left(\frac{2}{z} \cdot x\right) \cdot \frac{1}{\left(-\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}\right) + \left(-t\right)} \]
      8. sqr-neg92.8%

        \[\leadsto \left(\frac{2}{z} \cdot x\right) \cdot \frac{1}{\left(-\sqrt{\color{blue}{y \cdot y}}\right) + \left(-t\right)} \]
      9. sqrt-unprod51.8%

        \[\leadsto \left(\frac{2}{z} \cdot x\right) \cdot \frac{1}{\left(-\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right) + \left(-t\right)} \]
      10. add-sqr-sqrt92.7%

        \[\leadsto \left(\frac{2}{z} \cdot x\right) \cdot \frac{1}{\left(-\color{blue}{y}\right) + \left(-t\right)} \]
      11. sub-neg92.7%

        \[\leadsto \left(\frac{2}{z} \cdot x\right) \cdot \frac{1}{\color{blue}{\left(-y\right) - t}} \]
      12. add-sqr-sqrt40.9%

        \[\leadsto \left(\frac{2}{z} \cdot x\right) \cdot \frac{1}{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}} - t} \]
      13. sqrt-unprod96.3%

        \[\leadsto \left(\frac{2}{z} \cdot x\right) \cdot \frac{1}{\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}} - t} \]
      14. sqr-neg96.3%

        \[\leadsto \left(\frac{2}{z} \cdot x\right) \cdot \frac{1}{\sqrt{\color{blue}{y \cdot y}} - t} \]
      15. sqrt-unprod55.4%

        \[\leadsto \left(\frac{2}{z} \cdot x\right) \cdot \frac{1}{\color{blue}{\sqrt{y} \cdot \sqrt{y}} - t} \]
      16. add-sqr-sqrt99.8%

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

      \[\leadsto \color{blue}{\left(\frac{2}{z} \cdot x\right) \cdot \frac{1}{y - t}} \]
    11. Step-by-step derivation
      1. associate-*r/99.9%

        \[\leadsto \color{blue}{\frac{\left(\frac{2}{z} \cdot x\right) \cdot 1}{y - t}} \]
      2. *-rgt-identity99.9%

        \[\leadsto \frac{\color{blue}{\frac{2}{z} \cdot x}}{y - t} \]
      3. *-commutative99.9%

        \[\leadsto \frac{\color{blue}{x \cdot \frac{2}{z}}}{y - t} \]
    12. Simplified99.9%

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

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

Alternative 2: 74.5% accurate, 0.6× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -3.5 \cdot 10^{-52} \lor \neg \left(y \leq 1.15 \cdot 10^{+15}\right):\\ \;\;\;\;x \cdot \frac{\frac{2}{z\_m}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(z\_m \cdot t\right) \cdot -0.5}\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m t)
 :precision binary64
 (*
  z_s
  (if (or (<= y -3.5e-52) (not (<= y 1.15e+15)))
    (* x (/ (/ 2.0 z_m) y))
    (/ x (* (* z_m t) -0.5)))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
	double tmp;
	if ((y <= -3.5e-52) || !(y <= 1.15e+15)) {
		tmp = x * ((2.0 / z_m) / y);
	} else {
		tmp = x / ((z_m * t) * -0.5);
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((y <= (-3.5d-52)) .or. (.not. (y <= 1.15d+15))) then
        tmp = x * ((2.0d0 / z_m) / y)
    else
        tmp = x / ((z_m * t) * (-0.5d0))
    end if
    code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
	double tmp;
	if ((y <= -3.5e-52) || !(y <= 1.15e+15)) {
		tmp = x * ((2.0 / z_m) / y);
	} else {
		tmp = x / ((z_m * t) * -0.5);
	}
	return z_s * tmp;
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
def code(z_s, x, y, z_m, t):
	tmp = 0
	if (y <= -3.5e-52) or not (y <= 1.15e+15):
		tmp = x * ((2.0 / z_m) / y)
	else:
		tmp = x / ((z_m * t) * -0.5)
	return z_s * tmp
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m, t)
	tmp = 0.0
	if ((y <= -3.5e-52) || !(y <= 1.15e+15))
		tmp = Float64(x * Float64(Float64(2.0 / z_m) / y));
	else
		tmp = Float64(x / Float64(Float64(z_m * t) * -0.5));
	end
	return Float64(z_s * tmp)
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
function tmp_2 = code(z_s, x, y, z_m, t)
	tmp = 0.0;
	if ((y <= -3.5e-52) || ~((y <= 1.15e+15)))
		tmp = x * ((2.0 / z_m) / y);
	else
		tmp = x / ((z_m * t) * -0.5);
	end
	tmp_2 = z_s * tmp;
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[Or[LessEqual[y, -3.5e-52], N[Not[LessEqual[y, 1.15e+15]], $MachinePrecision]], N[(x * N[(N[(2.0 / z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(z$95$m * t), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{-52} \lor \neg \left(y \leq 1.15 \cdot 10^{+15}\right):\\
\;\;\;\;x \cdot \frac{\frac{2}{z\_m}}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.5e-52 or 1.15e15 < y

    1. Initial program 91.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--94.8%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
    3. Simplified94.8%

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-out--91.5%

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

        \[\leadsto \color{blue}{x \cdot \frac{2}{y \cdot z - t \cdot z}} \]
      3. *-commutative91.4%

        \[\leadsto \color{blue}{\frac{2}{y \cdot z - t \cdot z} \cdot x} \]
      4. distribute-rgt-out--94.7%

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

      \[\leadsto \color{blue}{\frac{2}{z \cdot \left(y - t\right)} \cdot x} \]
    7. Taylor expanded in y around inf 81.8%

      \[\leadsto \color{blue}{\frac{2}{y \cdot z}} \cdot x \]
    8. Step-by-step derivation
      1. *-commutative81.8%

        \[\leadsto \frac{2}{\color{blue}{z \cdot y}} \cdot x \]
    9. Simplified81.8%

      \[\leadsto \color{blue}{\frac{2}{z \cdot y}} \cdot x \]
    10. Taylor expanded in z around 0 81.8%

      \[\leadsto \color{blue}{\frac{2}{y \cdot z}} \cdot x \]
    11. Step-by-step derivation
      1. associate-/l/83.0%

        \[\leadsto \color{blue}{\frac{\frac{2}{z}}{y}} \cdot x \]
    12. Simplified83.0%

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

    if -3.5e-52 < y < 1.15e15

    1. Initial program 91.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--92.2%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
    3. Simplified92.2%

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 72.5%

      \[\leadsto \frac{x \cdot 2}{\color{blue}{-1 \cdot \left(t \cdot z\right)}} \]
    6. Step-by-step derivation
      1. associate-*r*72.5%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{\left(-1 \cdot t\right) \cdot z}} \]
      2. neg-mul-172.5%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{\left(-t\right)} \cdot z} \]
      3. *-commutative72.5%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(-t\right)}} \]
    7. Simplified72.5%

      \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(-t\right)}} \]
    8. Step-by-step derivation
      1. distribute-rgt-neg-out72.5%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{-z \cdot t}} \]
      2. distribute-frac-neg272.5%

        \[\leadsto \color{blue}{-\frac{x \cdot 2}{z \cdot t}} \]
      3. distribute-frac-neg72.5%

        \[\leadsto \color{blue}{\frac{-x \cdot 2}{z \cdot t}} \]
      4. *-commutative72.5%

        \[\leadsto \frac{-\color{blue}{2 \cdot x}}{z \cdot t} \]
      5. distribute-lft-neg-in72.5%

        \[\leadsto \frac{\color{blue}{\left(-2\right) \cdot x}}{z \cdot t} \]
      6. metadata-eval72.5%

        \[\leadsto \frac{\color{blue}{-2} \cdot x}{z \cdot t} \]
      7. times-frac70.9%

        \[\leadsto \color{blue}{\frac{-2}{z} \cdot \frac{x}{t}} \]
    9. Applied egg-rr70.9%

      \[\leadsto \color{blue}{\frac{-2}{z} \cdot \frac{x}{t}} \]
    10. Step-by-step derivation
      1. clear-num70.9%

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{-2}}} \cdot \frac{x}{t} \]
      2. frac-2neg70.9%

        \[\leadsto \frac{1}{\frac{z}{-2}} \cdot \color{blue}{\frac{-x}{-t}} \]
      3. frac-times72.5%

        \[\leadsto \color{blue}{\frac{1 \cdot \left(-x\right)}{\frac{z}{-2} \cdot \left(-t\right)}} \]
      4. *-un-lft-identity72.5%

        \[\leadsto \frac{\color{blue}{-x}}{\frac{z}{-2} \cdot \left(-t\right)} \]
      5. add-sqr-sqrt42.3%

        \[\leadsto \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{\frac{z}{-2} \cdot \left(-t\right)} \]
      6. sqrt-unprod35.8%

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{\frac{z}{-2} \cdot \left(-t\right)} \]
      7. sqr-neg35.8%

        \[\leadsto \frac{\sqrt{\color{blue}{x \cdot x}}}{\frac{z}{-2} \cdot \left(-t\right)} \]
      8. sqrt-unprod8.2%

        \[\leadsto \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{\frac{z}{-2} \cdot \left(-t\right)} \]
      9. add-sqr-sqrt15.5%

        \[\leadsto \frac{\color{blue}{x}}{\frac{z}{-2} \cdot \left(-t\right)} \]
      10. clear-num15.5%

        \[\leadsto \frac{x}{\color{blue}{\frac{1}{\frac{-2}{z}}} \cdot \left(-t\right)} \]
      11. add-sqr-sqrt8.6%

        \[\leadsto \frac{x}{\frac{1}{\color{blue}{\sqrt{\frac{-2}{z}} \cdot \sqrt{\frac{-2}{z}}}} \cdot \left(-t\right)} \]
      12. sqrt-unprod30.4%

        \[\leadsto \frac{x}{\frac{1}{\color{blue}{\sqrt{\frac{-2}{z} \cdot \frac{-2}{z}}}} \cdot \left(-t\right)} \]
      13. frac-times30.4%

        \[\leadsto \frac{x}{\frac{1}{\sqrt{\color{blue}{\frac{-2 \cdot -2}{z \cdot z}}}} \cdot \left(-t\right)} \]
      14. metadata-eval30.4%

        \[\leadsto \frac{x}{\frac{1}{\sqrt{\frac{\color{blue}{4}}{z \cdot z}}} \cdot \left(-t\right)} \]
      15. metadata-eval30.4%

        \[\leadsto \frac{x}{\frac{1}{\sqrt{\frac{\color{blue}{2 \cdot 2}}{z \cdot z}}} \cdot \left(-t\right)} \]
      16. frac-times30.4%

        \[\leadsto \frac{x}{\frac{1}{\sqrt{\color{blue}{\frac{2}{z} \cdot \frac{2}{z}}}} \cdot \left(-t\right)} \]
      17. sqrt-unprod31.4%

        \[\leadsto \frac{x}{\frac{1}{\color{blue}{\sqrt{\frac{2}{z}} \cdot \sqrt{\frac{2}{z}}}} \cdot \left(-t\right)} \]
      18. add-sqr-sqrt72.4%

        \[\leadsto \frac{x}{\frac{1}{\color{blue}{\frac{2}{z}}} \cdot \left(-t\right)} \]
      19. clear-num72.5%

        \[\leadsto \frac{x}{\color{blue}{\frac{z}{2}} \cdot \left(-t\right)} \]
      20. div-inv72.5%

        \[\leadsto \frac{x}{\color{blue}{\left(z \cdot \frac{1}{2}\right)} \cdot \left(-t\right)} \]
      21. metadata-eval72.5%

        \[\leadsto \frac{x}{\left(z \cdot \color{blue}{0.5}\right) \cdot \left(-t\right)} \]
    11. Applied egg-rr72.5%

      \[\leadsto \color{blue}{\frac{x}{\left(z \cdot 0.5\right) \cdot \left(-t\right)}} \]
    12. Step-by-step derivation
      1. *-commutative72.5%

        \[\leadsto \frac{x}{\color{blue}{\left(-t\right) \cdot \left(z \cdot 0.5\right)}} \]
      2. distribute-lft-neg-out72.5%

        \[\leadsto \frac{x}{\color{blue}{-t \cdot \left(z \cdot 0.5\right)}} \]
      3. associate-*r*72.5%

        \[\leadsto \frac{x}{-\color{blue}{\left(t \cdot z\right) \cdot 0.5}} \]
      4. *-commutative72.5%

        \[\leadsto \frac{x}{-\color{blue}{\left(z \cdot t\right)} \cdot 0.5} \]
      5. distribute-rgt-neg-in72.5%

        \[\leadsto \frac{x}{\color{blue}{\left(z \cdot t\right) \cdot \left(-0.5\right)}} \]
      6. metadata-eval72.5%

        \[\leadsto \frac{x}{\left(z \cdot t\right) \cdot \color{blue}{-0.5}} \]
    13. Simplified72.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.5 \cdot 10^{-52} \lor \neg \left(y \leq 1.15 \cdot 10^{+15}\right):\\ \;\;\;\;x \cdot \frac{\frac{2}{z}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(z \cdot t\right) \cdot -0.5}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 74.5% accurate, 0.6× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -1.2 \cdot 10^{-51} \lor \neg \left(y \leq 6.2 \cdot 10^{+14}\right):\\ \;\;\;\;x \cdot \frac{\frac{2}{z\_m}}{y}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{x}{z\_m \cdot t}\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m t)
 :precision binary64
 (*
  z_s
  (if (or (<= y -1.2e-51) (not (<= y 6.2e+14)))
    (* x (/ (/ 2.0 z_m) y))
    (* -2.0 (/ x (* z_m t))))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
	double tmp;
	if ((y <= -1.2e-51) || !(y <= 6.2e+14)) {
		tmp = x * ((2.0 / z_m) / y);
	} else {
		tmp = -2.0 * (x / (z_m * t));
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((y <= (-1.2d-51)) .or. (.not. (y <= 6.2d+14))) then
        tmp = x * ((2.0d0 / z_m) / y)
    else
        tmp = (-2.0d0) * (x / (z_m * t))
    end if
    code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
	double tmp;
	if ((y <= -1.2e-51) || !(y <= 6.2e+14)) {
		tmp = x * ((2.0 / z_m) / y);
	} else {
		tmp = -2.0 * (x / (z_m * t));
	}
	return z_s * tmp;
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
def code(z_s, x, y, z_m, t):
	tmp = 0
	if (y <= -1.2e-51) or not (y <= 6.2e+14):
		tmp = x * ((2.0 / z_m) / y)
	else:
		tmp = -2.0 * (x / (z_m * t))
	return z_s * tmp
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m, t)
	tmp = 0.0
	if ((y <= -1.2e-51) || !(y <= 6.2e+14))
		tmp = Float64(x * Float64(Float64(2.0 / z_m) / y));
	else
		tmp = Float64(-2.0 * Float64(x / Float64(z_m * t)));
	end
	return Float64(z_s * tmp)
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
function tmp_2 = code(z_s, x, y, z_m, t)
	tmp = 0.0;
	if ((y <= -1.2e-51) || ~((y <= 6.2e+14)))
		tmp = x * ((2.0 / z_m) / y);
	else
		tmp = -2.0 * (x / (z_m * t));
	end
	tmp_2 = z_s * tmp;
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[Or[LessEqual[y, -1.2e-51], N[Not[LessEqual[y, 6.2e+14]], $MachinePrecision]], N[(x * N[(N[(2.0 / z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(x / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{-51} \lor \neg \left(y \leq 6.2 \cdot 10^{+14}\right):\\
\;\;\;\;x \cdot \frac{\frac{2}{z\_m}}{y}\\

\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{x}{z\_m \cdot t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.2e-51 or 6.2e14 < y

    1. Initial program 91.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--94.8%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
    3. Simplified94.8%

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-out--91.5%

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

        \[\leadsto \color{blue}{x \cdot \frac{2}{y \cdot z - t \cdot z}} \]
      3. *-commutative91.4%

        \[\leadsto \color{blue}{\frac{2}{y \cdot z - t \cdot z} \cdot x} \]
      4. distribute-rgt-out--94.7%

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

      \[\leadsto \color{blue}{\frac{2}{z \cdot \left(y - t\right)} \cdot x} \]
    7. Taylor expanded in y around inf 81.8%

      \[\leadsto \color{blue}{\frac{2}{y \cdot z}} \cdot x \]
    8. Step-by-step derivation
      1. *-commutative81.8%

        \[\leadsto \frac{2}{\color{blue}{z \cdot y}} \cdot x \]
    9. Simplified81.8%

      \[\leadsto \color{blue}{\frac{2}{z \cdot y}} \cdot x \]
    10. Taylor expanded in z around 0 81.8%

      \[\leadsto \color{blue}{\frac{2}{y \cdot z}} \cdot x \]
    11. Step-by-step derivation
      1. associate-/l/83.0%

        \[\leadsto \color{blue}{\frac{\frac{2}{z}}{y}} \cdot x \]
    12. Simplified83.0%

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

    if -1.2e-51 < y < 6.2e14

    1. Initial program 91.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--92.2%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
    3. Simplified92.2%

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 72.5%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative72.5%

        \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
    7. Simplified72.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.2 \cdot 10^{-51} \lor \neg \left(y \leq 6.2 \cdot 10^{+14}\right):\\ \;\;\;\;x \cdot \frac{\frac{2}{z}}{y}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{x}{z \cdot t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 74.3% accurate, 0.6× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -1.04 \cdot 10^{-51} \lor \neg \left(y \leq 6.4 \cdot 10^{+14}\right):\\ \;\;\;\;x \cdot \frac{2}{y \cdot z\_m}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{x}{z\_m \cdot t}\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m t)
 :precision binary64
 (*
  z_s
  (if (or (<= y -1.04e-51) (not (<= y 6.4e+14)))
    (* x (/ 2.0 (* y z_m)))
    (* -2.0 (/ x (* z_m t))))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m, double t) {
	double tmp;
	if ((y <= -1.04e-51) || !(y <= 6.4e+14)) {
		tmp = x * (2.0 / (y * z_m));
	} else {
		tmp = -2.0 * (x / (z_m * t));
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
real(8) function code(z_s, x, y, z_m, t)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((y <= (-1.04d-51)) .or. (.not. (y <= 6.4d+14))) then
        tmp = x * (2.0d0 / (y * z_m))
    else
        tmp = (-2.0d0) * (x / (z_m * t))
    end if
    code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m, double t) {
	double tmp;
	if ((y <= -1.04e-51) || !(y <= 6.4e+14)) {
		tmp = x * (2.0 / (y * z_m));
	} else {
		tmp = -2.0 * (x / (z_m * t));
	}
	return z_s * tmp;
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
def code(z_s, x, y, z_m, t):
	tmp = 0
	if (y <= -1.04e-51) or not (y <= 6.4e+14):
		tmp = x * (2.0 / (y * z_m))
	else:
		tmp = -2.0 * (x / (z_m * t))
	return z_s * tmp
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m, t)
	tmp = 0.0
	if ((y <= -1.04e-51) || !(y <= 6.4e+14))
		tmp = Float64(x * Float64(2.0 / Float64(y * z_m)));
	else
		tmp = Float64(-2.0 * Float64(x / Float64(z_m * t)));
	end
	return Float64(z_s * tmp)
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
function tmp_2 = code(z_s, x, y, z_m, t)
	tmp = 0.0;
	if ((y <= -1.04e-51) || ~((y <= 6.4e+14)))
		tmp = x * (2.0 / (y * z_m));
	else
		tmp = -2.0 * (x / (z_m * t));
	end
	tmp_2 = z_s * tmp;
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_, t_] := N[(z$95$s * If[Or[LessEqual[y, -1.04e-51], N[Not[LessEqual[y, 6.4e+14]], $MachinePrecision]], N[(x * N[(2.0 / N[(y * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(x / N[(z$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1.04 \cdot 10^{-51} \lor \neg \left(y \leq 6.4 \cdot 10^{+14}\right):\\
\;\;\;\;x \cdot \frac{2}{y \cdot z\_m}\\

\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{x}{z\_m \cdot t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.0399999999999999e-51 or 6.4e14 < y

    1. Initial program 91.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--94.8%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
    3. Simplified94.8%

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-out--91.5%

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

        \[\leadsto \color{blue}{x \cdot \frac{2}{y \cdot z - t \cdot z}} \]
      3. *-commutative91.4%

        \[\leadsto \color{blue}{\frac{2}{y \cdot z - t \cdot z} \cdot x} \]
      4. distribute-rgt-out--94.7%

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

      \[\leadsto \color{blue}{\frac{2}{z \cdot \left(y - t\right)} \cdot x} \]
    7. Taylor expanded in y around inf 81.8%

      \[\leadsto \color{blue}{\frac{2}{y \cdot z}} \cdot x \]
    8. Step-by-step derivation
      1. *-commutative81.8%

        \[\leadsto \frac{2}{\color{blue}{z \cdot y}} \cdot x \]
    9. Simplified81.8%

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

    if -1.0399999999999999e-51 < y < 6.4e14

    1. Initial program 91.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--92.2%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
    3. Simplified92.2%

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 72.5%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative72.5%

        \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
    7. Simplified72.5%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{z \cdot t}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.04 \cdot 10^{-51} \lor \neg \left(y \leq 6.4 \cdot 10^{+14}\right):\\ \;\;\;\;x \cdot \frac{2}{y \cdot z}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{x}{z \cdot t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 94.5% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x #s(literal 2 binary64)) < 1.00000000000000006e-9

    1. Initial program 91.2%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--93.3%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
    3. Simplified93.3%

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

    if 1.00000000000000006e-9 < (*.f64 x #s(literal 2 binary64))

    1. Initial program 92.3%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--93.9%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
    3. Simplified93.9%

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative93.9%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{\left(y - t\right) \cdot z}} \]
      2. times-frac92.3%

        \[\leadsto \color{blue}{\frac{x}{y - t} \cdot \frac{2}{z}} \]
    6. Applied egg-rr92.3%

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

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

Alternative 6: 94.3% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x #s(literal 2 binary64)) < 1.00000000000000006e-9

    1. Initial program 91.2%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--93.3%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
    3. Simplified93.3%

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-out--91.2%

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

        \[\leadsto \color{blue}{x \cdot \frac{2}{y \cdot z - t \cdot z}} \]
      3. *-commutative91.1%

        \[\leadsto \color{blue}{\frac{2}{y \cdot z - t \cdot z} \cdot x} \]
      4. distribute-rgt-out--93.2%

        \[\leadsto \frac{2}{\color{blue}{z \cdot \left(y - t\right)}} \cdot x \]
    6. Applied egg-rr93.2%

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

    if 1.00000000000000006e-9 < (*.f64 x #s(literal 2 binary64))

    1. Initial program 92.3%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--93.9%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
    3. Simplified93.9%

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative93.9%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{\left(y - t\right) \cdot z}} \]
      2. times-frac92.3%

        \[\leadsto \color{blue}{\frac{x}{y - t} \cdot \frac{2}{z}} \]
    6. Applied egg-rr92.3%

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

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

Alternative 7: 96.8% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2e21

    1. Initial program 93.6%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--96.0%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
    3. Simplified96.0%

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-rgt-out--93.6%

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

        \[\leadsto \color{blue}{x \cdot \frac{2}{y \cdot z - t \cdot z}} \]
      3. *-commutative93.5%

        \[\leadsto \color{blue}{\frac{2}{y \cdot z - t \cdot z} \cdot x} \]
      4. distribute-rgt-out--95.9%

        \[\leadsto \frac{2}{\color{blue}{z \cdot \left(y - t\right)}} \cdot x \]
    6. Applied egg-rr95.9%

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

    if 2e21 < z

    1. Initial program 83.2%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--83.2%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
    3. Simplified83.2%

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. times-frac92.5%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{2}{y - t}} \]
    6. Applied egg-rr92.5%

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

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

Alternative 8: 58.5% accurate, 0.9× speedup?

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

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 1.8 \cdot 10^{+21}:\\
\;\;\;\;-2 \cdot \frac{x}{z\_m \cdot t}\\

\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{z\_m}}{t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.8e21

    1. Initial program 93.6%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--96.0%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
    3. Simplified96.0%

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 56.5%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative56.5%

        \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
    7. Simplified56.5%

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

    if 1.8e21 < z

    1. Initial program 83.2%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--83.2%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
    3. Simplified83.2%

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 38.9%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative38.9%

        \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
      2. associate-/r*51.8%

        \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z}}{t}} \]
    7. Simplified51.8%

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

Alternative 9: 92.0% accurate, 1.2× speedup?

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

\\
z\_s \cdot \left(x \cdot \frac{2}{z\_m \cdot \left(y - t\right)}\right)
\end{array}
Derivation
  1. Initial program 91.5%

    \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
  2. Step-by-step derivation
    1. distribute-rgt-out--93.4%

      \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
  3. Simplified93.4%

    \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. distribute-rgt-out--91.5%

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

      \[\leadsto \color{blue}{x \cdot \frac{2}{y \cdot z - t \cdot z}} \]
    3. *-commutative91.4%

      \[\leadsto \color{blue}{\frac{2}{y \cdot z - t \cdot z} \cdot x} \]
    4. distribute-rgt-out--93.4%

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

    \[\leadsto \color{blue}{\frac{2}{z \cdot \left(y - t\right)} \cdot x} \]
  7. Final simplification93.4%

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

Alternative 10: 53.9% accurate, 1.6× speedup?

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

\\
z\_s \cdot \left(-2 \cdot \frac{x}{z\_m \cdot t}\right)
\end{array}
Derivation
  1. Initial program 91.5%

    \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
  2. Step-by-step derivation
    1. distribute-rgt-out--93.4%

      \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
  3. Simplified93.4%

    \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
  4. Add Preprocessing
  5. Taylor expanded in y around 0 53.0%

    \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
  6. Step-by-step derivation
    1. *-commutative53.0%

      \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
  7. Simplified53.0%

    \[\leadsto \color{blue}{-2 \cdot \frac{x}{z \cdot t}} \]
  8. Add Preprocessing

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

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{\left(y - t\right) \cdot z} \cdot 2\\ t_2 := \frac{x \cdot 2}{y \cdot z - t \cdot z}\\ \mathbf{if}\;t\_2 < -2.559141628295061 \cdot 10^{-13}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 < 1.045027827330126 \cdot 10^{-269}:\\ \;\;\;\;\frac{\frac{x}{z} \cdot 2}{y - t}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (/ x (* (- y t) z)) 2.0))
        (t_2 (/ (* x 2.0) (- (* y z) (* t z)))))
   (if (< t_2 -2.559141628295061e-13)
     t_1
     (if (< t_2 1.045027827330126e-269) (/ (* (/ x z) 2.0) (- y t)) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / ((y - t) * z)) * 2.0;
	double t_2 = (x * 2.0) / ((y * z) - (t * z));
	double tmp;
	if (t_2 < -2.559141628295061e-13) {
		tmp = t_1;
	} else if (t_2 < 1.045027827330126e-269) {
		tmp = ((x / z) * 2.0) / (y - t);
	} 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 - t) * z)) * 2.0d0
    t_2 = (x * 2.0d0) / ((y * z) - (t * z))
    if (t_2 < (-2.559141628295061d-13)) then
        tmp = t_1
    else if (t_2 < 1.045027827330126d-269) then
        tmp = ((x / z) * 2.0d0) / (y - t)
    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 - t) * z)) * 2.0;
	double t_2 = (x * 2.0) / ((y * z) - (t * z));
	double tmp;
	if (t_2 < -2.559141628295061e-13) {
		tmp = t_1;
	} else if (t_2 < 1.045027827330126e-269) {
		tmp = ((x / z) * 2.0) / (y - t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / ((y - t) * z)) * 2.0
	t_2 = (x * 2.0) / ((y * z) - (t * z))
	tmp = 0
	if t_2 < -2.559141628295061e-13:
		tmp = t_1
	elif t_2 < 1.045027827330126e-269:
		tmp = ((x / z) * 2.0) / (y - t)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x / Float64(Float64(y - t) * z)) * 2.0)
	t_2 = Float64(Float64(x * 2.0) / Float64(Float64(y * z) - Float64(t * z)))
	tmp = 0.0
	if (t_2 < -2.559141628295061e-13)
		tmp = t_1;
	elseif (t_2 < 1.045027827330126e-269)
		tmp = Float64(Float64(Float64(x / z) * 2.0) / Float64(y - t));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x / ((y - t) * z)) * 2.0;
	t_2 = (x * 2.0) / ((y * z) - (t * z));
	tmp = 0.0;
	if (t_2 < -2.559141628295061e-13)
		tmp = t_1;
	elseif (t_2 < 1.045027827330126e-269)
		tmp = ((x / z) * 2.0) / (y - t);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / N[(N[(y - t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -2.559141628295061e-13], t$95$1, If[Less[t$95$2, 1.045027827330126e-269], N[(N[(N[(x / z), $MachinePrecision] * 2.0), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{x}{\left(y - t\right) \cdot z} \cdot 2\\
t_2 := \frac{x \cdot 2}{y \cdot z - t \cdot z}\\
\mathbf{if}\;t\_2 < -2.559141628295061 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 < 1.045027827330126 \cdot 10^{-269}:\\
\;\;\;\;\frac{\frac{x}{z} \cdot 2}{y - t}\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024128 
(FPCore (x y z t)
  :name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< (/ (* x 2) (- (* y z) (* t z))) -2559141628295061/10000000000000000000000000000) (* (/ x (* (- y t) z)) 2) (if (< (/ (* x 2) (- (* y z) (* t z))) 522513913665063/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (* (/ x z) 2) (- y t)) (* (/ x (* (- y t) z)) 2))))

  (/ (* x 2.0) (- (* y z) (* t z))))