Linear.Projection:infinitePerspective from linear-1.19.1.3, A

Percentage Accurate: 89.6% → 96.8%
Time: 11.4s
Alternatives: 10
Speedup: 0.8×

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.6% 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: 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 8 \cdot 10^{+32}:\\ \;\;\;\;\frac{x \cdot 2}{z\_m \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y - t} \cdot \frac{2}{z\_m}\\ \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 8e+32)
    (/ (* x 2.0) (* z_m (- y t)))
    (* (/ x (- y t)) (/ 2.0 z_m)))))
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 <= 8e+32) {
		tmp = (x * 2.0) / (z_m * (y - t));
	} else {
		tmp = (x / (y - t)) * (2.0 / z_m);
	}
	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 <= 8d+32) then
        tmp = (x * 2.0d0) / (z_m * (y - t))
    else
        tmp = (x / (y - t)) * (2.0d0 / z_m)
    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 <= 8e+32) {
		tmp = (x * 2.0) / (z_m * (y - t));
	} else {
		tmp = (x / (y - t)) * (2.0 / z_m);
	}
	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 <= 8e+32:
		tmp = (x * 2.0) / (z_m * (y - t))
	else:
		tmp = (x / (y - t)) * (2.0 / z_m)
	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 <= 8e+32)
		tmp = Float64(Float64(x * 2.0) / Float64(z_m * Float64(y - t)));
	else
		tmp = Float64(Float64(x / Float64(y - t)) * Float64(2.0 / z_m));
	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 <= 8e+32)
		tmp = (x * 2.0) / (z_m * (y - t));
	else
		tmp = (x / (y - t)) * (2.0 / z_m);
	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, 8e+32], N[(N[(x * 2.0), $MachinePrecision] / N[(z$95$m * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(2.0 / z$95$m), $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 8 \cdot 10^{+32}:\\
\;\;\;\;\frac{x \cdot 2}{z\_m \cdot \left(y - t\right)}\\

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


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

    1. Initial program 94.9%

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

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

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

    if 8.00000000000000043e32 < z

    1. Initial program 73.1%

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

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

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

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

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

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

Alternative 2: 73.7% 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 -2.3 \cdot 10^{-41} \lor \neg \left(y \leq 2.1 \cdot 10^{-53}\right):\\ \;\;\;\;\frac{2}{z\_m} \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2}{z\_m} \cdot \frac{x}{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 -2.3e-41) (not (<= y 2.1e-53)))
    (* (/ 2.0 z_m) (/ x y))
    (* (/ -2.0 z_m) (/ x 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 <= -2.3e-41) || !(y <= 2.1e-53)) {
		tmp = (2.0 / z_m) * (x / y);
	} else {
		tmp = (-2.0 / z_m) * (x / 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 <= (-2.3d-41)) .or. (.not. (y <= 2.1d-53))) then
        tmp = (2.0d0 / z_m) * (x / y)
    else
        tmp = ((-2.0d0) / z_m) * (x / 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 <= -2.3e-41) || !(y <= 2.1e-53)) {
		tmp = (2.0 / z_m) * (x / y);
	} else {
		tmp = (-2.0 / z_m) * (x / 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 <= -2.3e-41) or not (y <= 2.1e-53):
		tmp = (2.0 / z_m) * (x / y)
	else:
		tmp = (-2.0 / z_m) * (x / 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 <= -2.3e-41) || !(y <= 2.1e-53))
		tmp = Float64(Float64(2.0 / z_m) * Float64(x / y));
	else
		tmp = Float64(Float64(-2.0 / z_m) * Float64(x / 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 <= -2.3e-41) || ~((y <= 2.1e-53)))
		tmp = (2.0 / z_m) * (x / y);
	else
		tmp = (-2.0 / z_m) * (x / 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, -2.3e-41], N[Not[LessEqual[y, 2.1e-53]], $MachinePrecision]], N[(N[(2.0 / z$95$m), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 / z$95$m), $MachinePrecision] * N[(x / 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}\;y \leq -2.3 \cdot 10^{-41} \lor \neg \left(y \leq 2.1 \cdot 10^{-53}\right):\\
\;\;\;\;\frac{2}{z\_m} \cdot \frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.3000000000000001e-41 or 2.09999999999999977e-53 < y

    1. Initial program 88.8%

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

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

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

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

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

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

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

    if -2.3000000000000001e-41 < y < 2.09999999999999977e-53

    1. Initial program 92.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 73.6% 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.9 \cdot 10^{-39}:\\ \;\;\;\;\frac{\frac{x}{y \cdot 0.5}}{z\_m}\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{-53}:\\ \;\;\;\;\frac{-2}{z\_m} \cdot \frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{y \cdot \frac{z\_m}{x}}\\ \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 (<= y -1.9e-39)
    (/ (/ x (* y 0.5)) z_m)
    (if (<= y 1.9e-53) (* (/ -2.0 z_m) (/ x t)) (/ 2.0 (* y (/ z_m x)))))))
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.9e-39) {
		tmp = (x / (y * 0.5)) / z_m;
	} else if (y <= 1.9e-53) {
		tmp = (-2.0 / z_m) * (x / t);
	} else {
		tmp = 2.0 / (y * (z_m / x));
	}
	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.9d-39)) then
        tmp = (x / (y * 0.5d0)) / z_m
    else if (y <= 1.9d-53) then
        tmp = ((-2.0d0) / z_m) * (x / t)
    else
        tmp = 2.0d0 / (y * (z_m / x))
    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.9e-39) {
		tmp = (x / (y * 0.5)) / z_m;
	} else if (y <= 1.9e-53) {
		tmp = (-2.0 / z_m) * (x / t);
	} else {
		tmp = 2.0 / (y * (z_m / x));
	}
	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.9e-39:
		tmp = (x / (y * 0.5)) / z_m
	elif y <= 1.9e-53:
		tmp = (-2.0 / z_m) * (x / t)
	else:
		tmp = 2.0 / (y * (z_m / x))
	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.9e-39)
		tmp = Float64(Float64(x / Float64(y * 0.5)) / z_m);
	elseif (y <= 1.9e-53)
		tmp = Float64(Float64(-2.0 / z_m) * Float64(x / t));
	else
		tmp = Float64(2.0 / Float64(y * Float64(z_m / x)));
	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.9e-39)
		tmp = (x / (y * 0.5)) / z_m;
	elseif (y <= 1.9e-53)
		tmp = (-2.0 / z_m) * (x / t);
	else
		tmp = 2.0 / (y * (z_m / x));
	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[y, -1.9e-39], N[(N[(x / N[(y * 0.5), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision], If[LessEqual[y, 1.9e-53], N[(N[(-2.0 / z$95$m), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(y * N[(z$95$m / x), $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.9 \cdot 10^{-39}:\\
\;\;\;\;\frac{\frac{x}{y \cdot 0.5}}{z\_m}\\

\mathbf{elif}\;y \leq 1.9 \cdot 10^{-53}:\\
\;\;\;\;\frac{-2}{z\_m} \cdot \frac{x}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.9000000000000001e-39

    1. Initial program 86.9%

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

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{x}{y \cdot z}} \]
    6. Step-by-step derivation
      1. associate-*r/75.7%

        \[\leadsto \color{blue}{\frac{2 \cdot x}{y \cdot z}} \]
      2. *-commutative75.7%

        \[\leadsto \frac{\color{blue}{x \cdot 2}}{y \cdot z} \]
      3. *-commutative75.7%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot y}} \]
      4. times-frac73.2%

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

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

        \[\leadsto \color{blue}{\frac{x \cdot \frac{2}{y}}{z}} \]
      2. clear-num77.9%

        \[\leadsto \frac{x \cdot \color{blue}{\frac{1}{\frac{y}{2}}}}{z} \]
      3. un-div-inv78.0%

        \[\leadsto \frac{\color{blue}{\frac{x}{\frac{y}{2}}}}{z} \]
      4. div-inv78.0%

        \[\leadsto \frac{\frac{x}{\color{blue}{y \cdot \frac{1}{2}}}}{z} \]
      5. metadata-eval78.0%

        \[\leadsto \frac{\frac{x}{y \cdot \color{blue}{0.5}}}{z} \]
    9. Applied egg-rr78.0%

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

    if -1.9000000000000001e-39 < y < 1.8999999999999999e-53

    1. Initial program 92.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.8999999999999999e-53 < y

    1. Initial program 90.9%

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

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{x}{y \cdot z}} \]
    6. Step-by-step derivation
      1. associate-*r/76.5%

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

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

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot y}} \]
      4. times-frac78.2%

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{x}}} \cdot \frac{2}{y} \]
      2. frac-times80.6%

        \[\leadsto \color{blue}{\frac{1 \cdot 2}{\frac{z}{x} \cdot y}} \]
      3. metadata-eval80.6%

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

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

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

Alternative 4: 73.6% 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.95 \cdot 10^{-39}:\\ \;\;\;\;\frac{2}{z\_m} \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{-52}:\\ \;\;\;\;\frac{-2}{z\_m} \cdot \frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{y \cdot \frac{z\_m}{x}}\\ \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 (<= y -1.95e-39)
    (* (/ 2.0 z_m) (/ x y))
    (if (<= y 1.15e-52) (* (/ -2.0 z_m) (/ x t)) (/ 2.0 (* y (/ z_m x)))))))
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.95e-39) {
		tmp = (2.0 / z_m) * (x / y);
	} else if (y <= 1.15e-52) {
		tmp = (-2.0 / z_m) * (x / t);
	} else {
		tmp = 2.0 / (y * (z_m / x));
	}
	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.95d-39)) then
        tmp = (2.0d0 / z_m) * (x / y)
    else if (y <= 1.15d-52) then
        tmp = ((-2.0d0) / z_m) * (x / t)
    else
        tmp = 2.0d0 / (y * (z_m / x))
    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.95e-39) {
		tmp = (2.0 / z_m) * (x / y);
	} else if (y <= 1.15e-52) {
		tmp = (-2.0 / z_m) * (x / t);
	} else {
		tmp = 2.0 / (y * (z_m / x));
	}
	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.95e-39:
		tmp = (2.0 / z_m) * (x / y)
	elif y <= 1.15e-52:
		tmp = (-2.0 / z_m) * (x / t)
	else:
		tmp = 2.0 / (y * (z_m / x))
	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.95e-39)
		tmp = Float64(Float64(2.0 / z_m) * Float64(x / y));
	elseif (y <= 1.15e-52)
		tmp = Float64(Float64(-2.0 / z_m) * Float64(x / t));
	else
		tmp = Float64(2.0 / Float64(y * Float64(z_m / x)));
	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.95e-39)
		tmp = (2.0 / z_m) * (x / y);
	elseif (y <= 1.15e-52)
		tmp = (-2.0 / z_m) * (x / t);
	else
		tmp = 2.0 / (y * (z_m / x));
	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[y, -1.95e-39], N[(N[(2.0 / z$95$m), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.15e-52], N[(N[(-2.0 / z$95$m), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(y * N[(z$95$m / x), $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.95 \cdot 10^{-39}:\\
\;\;\;\;\frac{2}{z\_m} \cdot \frac{x}{y}\\

\mathbf{elif}\;y \leq 1.15 \cdot 10^{-52}:\\
\;\;\;\;\frac{-2}{z\_m} \cdot \frac{x}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.95000000000000015e-39

    1. Initial program 86.9%

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

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

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

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

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

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

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

    if -1.95000000000000015e-39 < y < 1.14999999999999997e-52

    1. Initial program 92.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.14999999999999997e-52 < y

    1. Initial program 90.9%

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

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{x}{y \cdot z}} \]
    6. Step-by-step derivation
      1. associate-*r/76.5%

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

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

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot y}} \]
      4. times-frac78.2%

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{x}}} \cdot \frac{2}{y} \]
      2. frac-times80.6%

        \[\leadsto \color{blue}{\frac{1 \cdot 2}{\frac{z}{x} \cdot y}} \]
      3. metadata-eval80.6%

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

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

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

Alternative 5: 73.6% 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 -8.5 \cdot 10^{-39}:\\ \;\;\;\;\frac{2}{z\_m} \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq 6.2 \cdot 10^{-54}:\\ \;\;\;\;\frac{-2}{z\_m} \cdot \frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z\_m} \cdot \frac{2}{y}\\ \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 (<= y -8.5e-39)
    (* (/ 2.0 z_m) (/ x y))
    (if (<= y 6.2e-54) (* (/ -2.0 z_m) (/ x t)) (* (/ x z_m) (/ 2.0 y))))))
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 <= -8.5e-39) {
		tmp = (2.0 / z_m) * (x / y);
	} else if (y <= 6.2e-54) {
		tmp = (-2.0 / z_m) * (x / t);
	} else {
		tmp = (x / z_m) * (2.0 / y);
	}
	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 <= (-8.5d-39)) then
        tmp = (2.0d0 / z_m) * (x / y)
    else if (y <= 6.2d-54) then
        tmp = ((-2.0d0) / z_m) * (x / t)
    else
        tmp = (x / z_m) * (2.0d0 / y)
    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 <= -8.5e-39) {
		tmp = (2.0 / z_m) * (x / y);
	} else if (y <= 6.2e-54) {
		tmp = (-2.0 / z_m) * (x / t);
	} else {
		tmp = (x / z_m) * (2.0 / y);
	}
	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 <= -8.5e-39:
		tmp = (2.0 / z_m) * (x / y)
	elif y <= 6.2e-54:
		tmp = (-2.0 / z_m) * (x / t)
	else:
		tmp = (x / z_m) * (2.0 / y)
	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 <= -8.5e-39)
		tmp = Float64(Float64(2.0 / z_m) * Float64(x / y));
	elseif (y <= 6.2e-54)
		tmp = Float64(Float64(-2.0 / z_m) * Float64(x / t));
	else
		tmp = Float64(Float64(x / z_m) * Float64(2.0 / y));
	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 <= -8.5e-39)
		tmp = (2.0 / z_m) * (x / y);
	elseif (y <= 6.2e-54)
		tmp = (-2.0 / z_m) * (x / t);
	else
		tmp = (x / z_m) * (2.0 / y);
	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[y, -8.5e-39], N[(N[(2.0 / z$95$m), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.2e-54], N[(N[(-2.0 / z$95$m), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(N[(x / z$95$m), $MachinePrecision] * N[(2.0 / y), $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 -8.5 \cdot 10^{-39}:\\
\;\;\;\;\frac{2}{z\_m} \cdot \frac{x}{y}\\

\mathbf{elif}\;y \leq 6.2 \cdot 10^{-54}:\\
\;\;\;\;\frac{-2}{z\_m} \cdot \frac{x}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -8.5000000000000005e-39

    1. Initial program 86.9%

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

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

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

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

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

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

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

    if -8.5000000000000005e-39 < y < 6.20000000000000008e-54

    1. Initial program 92.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.20000000000000008e-54 < y

    1. Initial program 90.9%

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

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{x}{y \cdot z}} \]
    6. Step-by-step derivation
      1. associate-*r/76.5%

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

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

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot y}} \]
      4. times-frac78.2%

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

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

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

Alternative 6: 96.6% 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^{+20}:\\ \;\;\;\;x \cdot \frac{2}{z\_m \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y - t} \cdot \frac{2}{z\_m}\\ \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+20)
    (* x (/ 2.0 (* z_m (- y t))))
    (* (/ x (- y t)) (/ 2.0 z_m)))))
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+20) {
		tmp = x * (2.0 / (z_m * (y - t)));
	} else {
		tmp = (x / (y - t)) * (2.0 / z_m);
	}
	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+20) then
        tmp = x * (2.0d0 / (z_m * (y - t)))
    else
        tmp = (x / (y - t)) * (2.0d0 / z_m)
    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+20) {
		tmp = x * (2.0 / (z_m * (y - t)));
	} else {
		tmp = (x / (y - t)) * (2.0 / z_m);
	}
	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+20:
		tmp = x * (2.0 / (z_m * (y - t)))
	else:
		tmp = (x / (y - t)) * (2.0 / z_m)
	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+20)
		tmp = Float64(x * Float64(2.0 / Float64(z_m * Float64(y - t))));
	else
		tmp = Float64(Float64(x / Float64(y - t)) * Float64(2.0 / z_m));
	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+20)
		tmp = x * (2.0 / (z_m * (y - t)));
	else
		tmp = (x / (y - t)) * (2.0 / z_m);
	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+20], N[(x * N[(2.0 / N[(z$95$m * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(2.0 / z$95$m), $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^{+20}:\\
\;\;\;\;x \cdot \frac{2}{z\_m \cdot \left(y - t\right)}\\

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


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

    1. Initial program 94.8%

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

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

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

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

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

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

    if 2e20 < z

    1. Initial program 75.4%

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

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

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

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

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

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

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

Alternative 7: 91.6% 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}\;t \leq -5 \cdot 10^{+231}:\\ \;\;\;\;\frac{\frac{x \cdot -2}{t}}{z\_m}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{2}{z\_m \cdot \left(y - t\right)}\\ \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 (<= t -5e+231) (/ (/ (* x -2.0) t) z_m) (* 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 tmp;
	if (t <= -5e+231) {
		tmp = ((x * -2.0) / t) / z_m;
	} else {
		tmp = x * (2.0 / (z_m * (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 (t <= (-5d+231)) then
        tmp = ((x * (-2.0d0)) / t) / z_m
    else
        tmp = x * (2.0d0 / (z_m * (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 (t <= -5e+231) {
		tmp = ((x * -2.0) / t) / z_m;
	} 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):
	tmp = 0
	if t <= -5e+231:
		tmp = ((x * -2.0) / t) / z_m
	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)
	tmp = 0.0
	if (t <= -5e+231)
		tmp = Float64(Float64(Float64(x * -2.0) / t) / z_m);
	else
		tmp = Float64(x * Float64(2.0 / Float64(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)
	tmp = 0.0;
	if (t <= -5e+231)
		tmp = ((x * -2.0) / t) / z_m;
	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_] := N[(z$95$s * If[LessEqual[t, -5e+231], N[(N[(N[(x * -2.0), $MachinePrecision] / t), $MachinePrecision] / z$95$m), $MachinePrecision], 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 \begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{+231}:\\
\;\;\;\;\frac{\frac{x \cdot -2}{t}}{z\_m}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -5.00000000000000028e231

    1. Initial program 57.6%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot \color{blue}{\left(-2\right)}}{z \cdot t} \]
      4. distribute-rgt-neg-in57.8%

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

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

        \[\leadsto \color{blue}{\frac{\frac{-x \cdot 2}{t}}{z}} \]
      7. distribute-rgt-neg-in93.8%

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

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

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

    if -5.00000000000000028e231 < t

    1. Initial program 92.9%

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

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot \left(y - t\right)}} \]
    3. Simplified93.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--92.9%

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

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

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

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

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

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

Alternative 8: 55.8% 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 4.5 \cdot 10^{-95}:\\ \;\;\;\;\frac{-2}{z\_m} \cdot \frac{x}{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 4.5e-95) (* (/ -2.0 z_m) (/ x 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 <= 4.5e-95) {
		tmp = (-2.0 / z_m) * (x / 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 <= 4.5d-95) then
        tmp = ((-2.0d0) / z_m) * (x / 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 <= 4.5e-95) {
		tmp = (-2.0 / z_m) * (x / 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 <= 4.5e-95:
		tmp = (-2.0 / z_m) * (x / 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 <= 4.5e-95)
		tmp = Float64(Float64(-2.0 / z_m) * Float64(x / 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 <= 4.5e-95)
		tmp = (-2.0 / z_m) * (x / 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, 4.5e-95], N[(N[(-2.0 / z$95$m), $MachinePrecision] * N[(x / t), $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 4.5 \cdot 10^{-95}:\\
\;\;\;\;\frac{-2}{z\_m} \cdot \frac{x}{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 < 4.5e-95

    1. Initial program 94.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-2 \cdot x}{-\color{blue}{\left(-z \cdot t\right)}} \]
      6. remove-double-neg47.2%

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

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

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

    if 4.5e-95 < z

    1. Initial program 83.0%

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

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

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

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

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

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

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

Alternative 9: 58.0% 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.1 \cdot 10^{+40}:\\ \;\;\;\;-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.1e+40) (* -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.1e+40) {
		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.1d+40) 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.1e+40) {
		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.1e+40:
		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.1e+40)
		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.1e+40)
		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.1e+40], 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.1 \cdot 10^{+40}:\\
\;\;\;\;-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.0999999999999999e40

    1. Initial program 94.9%

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

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

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

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

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

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

    if 1.0999999999999999e40 < z

    1. Initial program 72.1%

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

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

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

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

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

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

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

Alternative 10: 53.8% 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 90.4%

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

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

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

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

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

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

Developer Target 1: 96.7% 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 2024116 
(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))))