Linear.Projection:infinitePerspective from linear-1.19.1.3, A

Percentage Accurate: 89.5% → 96.2%
Time: 12.3s
Alternatives: 11
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 11 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.5% 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.2% 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 5 \cdot 10^{+69}:\\ \;\;\;\;\frac{x \cdot 2}{z\_m \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \frac{\frac{x}{z\_m}}{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 5e+69)
    (/ (* x 2.0) (* z_m (- y t)))
    (* 2.0 (/ (/ x 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 (z_m <= 5e+69) {
		tmp = (x * 2.0) / (z_m * (y - t));
	} else {
		tmp = 2.0 * ((x / 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 (z_m <= 5d+69) then
        tmp = (x * 2.0d0) / (z_m * (y - t))
    else
        tmp = 2.0d0 * ((x / 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 (z_m <= 5e+69) {
		tmp = (x * 2.0) / (z_m * (y - t));
	} else {
		tmp = 2.0 * ((x / 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 z_m <= 5e+69:
		tmp = (x * 2.0) / (z_m * (y - t))
	else:
		tmp = 2.0 * ((x / 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 (z_m <= 5e+69)
		tmp = Float64(Float64(x * 2.0) / Float64(z_m * Float64(y - t)));
	else
		tmp = Float64(2.0 * Float64(Float64(x / 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 (z_m <= 5e+69)
		tmp = (x * 2.0) / (z_m * (y - t));
	else
		tmp = 2.0 * ((x / 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[z$95$m, 5e+69], N[(N[(x * 2.0), $MachinePrecision] / N[(z$95$m * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(x / z$95$m), $MachinePrecision] / 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 5 \cdot 10^{+69}:\\
\;\;\;\;\frac{x \cdot 2}{z\_m \cdot \left(y - t\right)}\\

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


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

    1. Initial program 93.4%

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

    if 5.00000000000000036e69 < z

    1. Initial program 75.1%

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

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

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

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.65e-80 or 4.7999999999999998e-45 < t

    1. Initial program 86.8%

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

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

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

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

    if -1.65e-80 < t < 4.7999999999999998e-45

    1. Initial program 95.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \frac{2}{z \cdot y}} \]
    10. Simplified80.1%

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

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

Alternative 3: 72.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 -1.15 \cdot 10^{+24} \lor \neg \left(y \leq 7 \cdot 10^{-59}\right):\\ \;\;\;\;x \cdot \frac{\frac{2}{y}}{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.15e+24) (not (<= y 7e-59)))
    (* 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.15e+24) || !(y <= 7e-59)) {
		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.15d+24)) .or. (.not. (y <= 7d-59))) 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.15e+24) || !(y <= 7e-59)) {
		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.15e+24) or not (y <= 7e-59):
		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.15e+24) || !(y <= 7e-59))
		tmp = Float64(x * Float64(Float64(2.0 / 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.15e+24) || ~((y <= 7e-59)))
		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.15e+24], N[Not[LessEqual[y, 7e-59]], $MachinePrecision]], N[(x * N[(N[(2.0 / y), $MachinePrecision] / z$95$m), $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.15 \cdot 10^{+24} \lor \neg \left(y \leq 7 \cdot 10^{-59}\right):\\
\;\;\;\;x \cdot \frac{\frac{2}{y}}{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.15e24 or 7.0000000000000002e-59 < y

    1. Initial program 86.2%

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

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

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

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

        \[\leadsto \color{blue}{{\left(\frac{z \cdot \left(y - t\right)}{x \cdot 2}\right)}^{-1}} \]
      3. associate-/l*84.6%

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

      \[\leadsto \color{blue}{{\left(z \cdot \frac{y - t}{x \cdot 2}\right)}^{-1}} \]
    7. Step-by-step derivation
      1. unpow-184.6%

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

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

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

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

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

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

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

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

    if -1.15e24 < y < 7.0000000000000002e-59

    1. Initial program 94.6%

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

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

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

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

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

Alternative 4: 72.4% 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.05 \cdot 10^{+25} \lor \neg \left(y \leq 1.25 \cdot 10^{-57}\right):\\ \;\;\;\;\frac{x}{z\_m} \cdot \frac{2}{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.05e+25) (not (<= y 1.25e-57)))
    (* (/ x z_m) (/ 2.0 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.05e+25) || !(y <= 1.25e-57)) {
		tmp = (x / z_m) * (2.0 / 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.05d+25)) .or. (.not. (y <= 1.25d-57))) then
        tmp = (x / z_m) * (2.0d0 / 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.05e+25) || !(y <= 1.25e-57)) {
		tmp = (x / z_m) * (2.0 / 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.05e+25) or not (y <= 1.25e-57):
		tmp = (x / z_m) * (2.0 / 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.05e+25) || !(y <= 1.25e-57))
		tmp = Float64(Float64(x / z_m) * Float64(2.0 / 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.05e+25) || ~((y <= 1.25e-57)))
		tmp = (x / z_m) * (2.0 / 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.05e+25], N[Not[LessEqual[y, 1.25e-57]], $MachinePrecision]], N[(N[(x / z$95$m), $MachinePrecision] * N[(2.0 / 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.05 \cdot 10^{+25} \lor \neg \left(y \leq 1.25 \cdot 10^{-57}\right):\\
\;\;\;\;\frac{x}{z\_m} \cdot \frac{2}{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.05e25 or 1.25e-57 < y

    1. Initial program 86.2%

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

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

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

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

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

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

    if -1.05e25 < y < 1.25e-57

    1. Initial program 94.6%

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

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

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

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

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

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

\mathbf{elif}\;y \leq 6 \cdot 10^{-60}:\\
\;\;\;\;-2 \cdot \frac{x}{z\_m \cdot 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 < -8.2e20

    1. Initial program 85.8%

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

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

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

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

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

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

    if -8.2e20 < y < 6.00000000000000038e-60

    1. Initial program 94.6%

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

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

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

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

    if 6.00000000000000038e-60 < y

    1. Initial program 86.4%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{2}{y - t}} \]
    7. Step-by-step derivation
      1. clear-num95.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{x}}} \cdot \frac{2}{y - t} \]
      2. frac-times96.0%

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{y \cdot \frac{z}{x}}} \]
    11. Simplified82.1%

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

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

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

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

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


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

    1. Initial program 89.9%

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

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

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

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

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

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

    if -2.09999999999999992e-76 < y < 3.2000000000000001e-55

    1. Initial program 93.8%

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

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

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

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

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

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

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

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

    if 3.2000000000000001e-55 < y

    1. Initial program 86.4%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{2}{y - t}} \]
    7. Step-by-step derivation
      1. clear-num95.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{x}}} \cdot \frac{2}{y - t} \]
      2. frac-times96.0%

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{y \cdot \frac{z}{x}}} \]
    11. Simplified82.1%

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

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

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

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

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


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

    1. Initial program 89.9%

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

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

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

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

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

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

    if -3.9999999999999997e-77 < y < 1.69999999999999991e-56

    1. Initial program 93.8%

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

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

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

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

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

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

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

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

    if 1.69999999999999991e-56 < y

    1. Initial program 86.4%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot y} \cdot 1} \]
      3. associate-/r*82.2%

        \[\leadsto \color{blue}{\frac{\frac{x \cdot 2}{z}}{y}} \cdot 1 \]
      4. associate-*r/82.0%

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{\frac{z}{2}}}}{y} \cdot 1 \]
      7. div-inv82.2%

        \[\leadsto \frac{\frac{x}{\color{blue}{z \cdot \frac{1}{2}}}}{y} \cdot 1 \]
      8. metadata-eval82.2%

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

      \[\leadsto \color{blue}{\frac{\frac{x}{z \cdot 0.5}}{y} \cdot 1} \]
    10. Step-by-step derivation
      1. *-rgt-identity82.2%

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

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

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{z \cdot 0.5}} \]
      4. associate-/r*71.3%

        \[\leadsto \color{blue}{\frac{\frac{\frac{x}{y}}{z}}{0.5}} \]
      5. associate-/r*78.3%

        \[\leadsto \frac{\color{blue}{\frac{x}{y \cdot z}}}{0.5} \]
      6. associate-/l/82.2%

        \[\leadsto \frac{\color{blue}{\frac{\frac{x}{z}}{y}}}{0.5} \]
    11. Simplified82.2%

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

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

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

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


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

    1. Initial program 93.4%

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

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

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

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

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

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

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

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

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

    if 5.19999999999999983e71 < z

    1. Initial program 75.1%

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

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

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

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

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

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

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

Alternative 9: 56.6% 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 3.1 \cdot 10^{+71}:\\ \;\;\;\;-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 3.1e+71) (* -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 <= 3.1e+71) {
		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 <= 3.1d+71) 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 <= 3.1e+71) {
		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 <= 3.1e+71:
		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 <= 3.1e+71)
		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 <= 3.1e+71)
		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, 3.1e+71], 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 3.1 \cdot 10^{+71}:\\
\;\;\;\;-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 < 3.10000000000000018e71

    1. Initial program 93.4%

      \[\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. Taylor expanded in y around 0 55.3%

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

    if 3.10000000000000018e71 < z

    1. Initial program 75.1%

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

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

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

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

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

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

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

Alternative 10: 91.7% accurate, 1.2× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \left(2 \cdot \frac{\frac{x}{z\_m}}{y - 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) (- 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 * (2.0 * ((x / 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 * (2.0d0 * ((x / 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 * (2.0 * ((x / 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 * (2.0 * ((x / 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(2.0 * Float64(Float64(x / 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 * (2.0 * ((x / 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[(2.0 * N[(N[(x / z$95$m), $MachinePrecision] / 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 \left(2 \cdot \frac{\frac{x}{z\_m}}{y - t}\right)
\end{array}
Derivation
  1. Initial program 90.6%

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

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

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

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

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

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

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

Alternative 11: 52.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 90.6%

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

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

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

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

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

Developer target: 96.8% 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 2024067 
(FPCore (x y z t)
  :name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
  :precision binary64

  :alt
  (if (< (/ (* x 2.0) (- (* y z) (* t z))) -2.559141628295061e-13) (* (/ x (* (- y t) z)) 2.0) (if (< (/ (* x 2.0) (- (* y z) (* t z))) 1.045027827330126e-269) (/ (* (/ x z) 2.0) (- y t)) (* (/ x (* (- y t) z)) 2.0)))

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