Linear.Projection:infinitePerspective from linear-1.19.1.3, A

Percentage Accurate: 89.8% → 97.1%
Time: 12.4s
Alternatives: 12
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 12 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 89.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 92.7%

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

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

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

    if 3.6e35 < z

    1. Initial program 79.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{\frac{x}{y - t}}{z}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/l/83.1%

        \[\leadsto 2 \cdot \color{blue}{\frac{x}{z \cdot \left(y - t\right)}} \]
      2. distribute-rgt-out--78.9%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 3.6 \cdot 10^{+35}:\\ \;\;\;\;\frac{x \cdot 2}{z \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{\frac{z}{2}}}{y - t}\\ \end{array} \]
  5. 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}\;t \leq -5.7 \cdot 10^{-12} \lor \neg \left(t \leq 480000\right):\\ \;\;\;\;\frac{x}{t} \cdot \frac{-2}{z\_m}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{2}{z\_m \cdot y}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m t)
 :precision binary64
 (*
  z_s
  (if (or (<= t -5.7e-12) (not (<= t 480000.0)))
    (* (/ x t) (/ -2.0 z_m))
    (* 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 <= -5.7e-12) || !(t <= 480000.0)) {
		tmp = (x / t) * (-2.0 / z_m);
	} 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 <= (-5.7d-12)) .or. (.not. (t <= 480000.0d0))) then
        tmp = (x / t) * ((-2.0d0) / z_m)
    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 <= -5.7e-12) || !(t <= 480000.0)) {
		tmp = (x / t) * (-2.0 / z_m);
	} 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 <= -5.7e-12) or not (t <= 480000.0):
		tmp = (x / t) * (-2.0 / z_m)
	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 <= -5.7e-12) || !(t <= 480000.0))
		tmp = Float64(Float64(x / t) * Float64(-2.0 / z_m));
	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 <= -5.7e-12) || ~((t <= 480000.0)))
		tmp = (x / t) * (-2.0 / z_m);
	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, -5.7e-12], N[Not[LessEqual[t, 480000.0]], $MachinePrecision]], N[(N[(x / t), $MachinePrecision] * N[(-2.0 / z$95$m), $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 -5.7 \cdot 10^{-12} \lor \neg \left(t \leq 480000\right):\\
\;\;\;\;\frac{x}{t} \cdot \frac{-2}{z\_m}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -5.7000000000000003e-12 or 4.8e5 < t

    1. Initial program 86.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.7000000000000003e-12 < t < 4.8e5

    1. Initial program 92.4%

      \[\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)}} \]
      2. *-commutative94.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\frac{\frac{2}{y - t}}{z}} \]
      6. *-lft-identity94.8%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.7 \cdot 10^{-12} \lor \neg \left(t \leq 480000\right):\\ \;\;\;\;\frac{x}{t} \cdot \frac{-2}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{2}{z \cdot y}\\ \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}\;t \leq -5.4 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{t} \cdot \frac{-2}{z\_m}\\ \mathbf{elif}\;t \leq 3600000:\\ \;\;\;\;x \cdot \frac{2}{z\_m \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z\_m} \cdot \frac{-2}{t}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m t)
 :precision binary64
 (*
  z_s
  (if (<= t -5.4e-12)
    (* (/ x t) (/ -2.0 z_m))
    (if (<= t 3600000.0) (* x (/ 2.0 (* z_m y))) (* (/ x z_m) (/ -2.0 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 <= -5.4e-12) {
		tmp = (x / t) * (-2.0 / z_m);
	} else if (t <= 3600000.0) {
		tmp = x * (2.0 / (z_m * y));
	} else {
		tmp = (x / z_m) * (-2.0 / 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 <= (-5.4d-12)) then
        tmp = (x / t) * ((-2.0d0) / z_m)
    else if (t <= 3600000.0d0) then
        tmp = x * (2.0d0 / (z_m * y))
    else
        tmp = (x / z_m) * ((-2.0d0) / 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 <= -5.4e-12) {
		tmp = (x / t) * (-2.0 / z_m);
	} else if (t <= 3600000.0) {
		tmp = x * (2.0 / (z_m * y));
	} else {
		tmp = (x / z_m) * (-2.0 / 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 <= -5.4e-12:
		tmp = (x / t) * (-2.0 / z_m)
	elif t <= 3600000.0:
		tmp = x * (2.0 / (z_m * y))
	else:
		tmp = (x / z_m) * (-2.0 / 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 <= -5.4e-12)
		tmp = Float64(Float64(x / t) * Float64(-2.0 / z_m));
	elseif (t <= 3600000.0)
		tmp = Float64(x * Float64(2.0 / Float64(z_m * y)));
	else
		tmp = Float64(Float64(x / z_m) * Float64(-2.0 / 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 <= -5.4e-12)
		tmp = (x / t) * (-2.0 / z_m);
	elseif (t <= 3600000.0)
		tmp = x * (2.0 / (z_m * y));
	else
		tmp = (x / z_m) * (-2.0 / 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, -5.4e-12], N[(N[(x / t), $MachinePrecision] * N[(-2.0 / z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3600000.0], N[(x * N[(2.0 / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z$95$m), $MachinePrecision] * N[(-2.0 / 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}\;t \leq -5.4 \cdot 10^{-12}:\\
\;\;\;\;\frac{x}{t} \cdot \frac{-2}{z\_m}\\

\mathbf{elif}\;t \leq 3600000:\\
\;\;\;\;x \cdot \frac{2}{z\_m \cdot y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -5.39999999999999961e-12

    1. Initial program 91.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.39999999999999961e-12 < t < 3.6e6

    1. Initial program 92.4%

      \[\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)}} \]
      2. *-commutative94.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\frac{\frac{2}{y - t}}{z}} \]
      6. *-lft-identity94.8%

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

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

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

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

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

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

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

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

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

    if 3.6e6 < t

    1. Initial program 80.9%

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

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

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

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

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

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

Alternative 4: 74.0% 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.6 \cdot 10^{-18}:\\ \;\;\;\;\frac{x}{t} \cdot \frac{-2}{z\_m}\\ \mathbf{elif}\;t \leq 2400000:\\ \;\;\;\;\frac{x}{z\_m} \cdot \frac{2}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z\_m} \cdot \frac{-2}{t}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m t)
 :precision binary64
 (*
  z_s
  (if (<= t -1.6e-18)
    (* (/ x t) (/ -2.0 z_m))
    (if (<= t 2400000.0) (* (/ x z_m) (/ 2.0 y)) (* (/ x z_m) (/ -2.0 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 <= -1.6e-18) {
		tmp = (x / t) * (-2.0 / z_m);
	} else if (t <= 2400000.0) {
		tmp = (x / z_m) * (2.0 / y);
	} else {
		tmp = (x / z_m) * (-2.0 / 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 <= (-1.6d-18)) then
        tmp = (x / t) * ((-2.0d0) / z_m)
    else if (t <= 2400000.0d0) then
        tmp = (x / z_m) * (2.0d0 / y)
    else
        tmp = (x / z_m) * ((-2.0d0) / 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 <= -1.6e-18) {
		tmp = (x / t) * (-2.0 / z_m);
	} else if (t <= 2400000.0) {
		tmp = (x / z_m) * (2.0 / y);
	} else {
		tmp = (x / z_m) * (-2.0 / 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 <= -1.6e-18:
		tmp = (x / t) * (-2.0 / z_m)
	elif t <= 2400000.0:
		tmp = (x / z_m) * (2.0 / y)
	else:
		tmp = (x / z_m) * (-2.0 / 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 <= -1.6e-18)
		tmp = Float64(Float64(x / t) * Float64(-2.0 / z_m));
	elseif (t <= 2400000.0)
		tmp = Float64(Float64(x / z_m) * Float64(2.0 / y));
	else
		tmp = Float64(Float64(x / z_m) * Float64(-2.0 / 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 <= -1.6e-18)
		tmp = (x / t) * (-2.0 / z_m);
	elseif (t <= 2400000.0)
		tmp = (x / z_m) * (2.0 / y);
	else
		tmp = (x / z_m) * (-2.0 / 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, -1.6e-18], N[(N[(x / t), $MachinePrecision] * N[(-2.0 / z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2400000.0], N[(N[(x / z$95$m), $MachinePrecision] * N[(2.0 / y), $MachinePrecision]), $MachinePrecision], N[(N[(x / z$95$m), $MachinePrecision] * N[(-2.0 / 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}\;t \leq -1.6 \cdot 10^{-18}:\\
\;\;\;\;\frac{x}{t} \cdot \frac{-2}{z\_m}\\

\mathbf{elif}\;t \leq 2400000:\\
\;\;\;\;\frac{x}{z\_m} \cdot \frac{2}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.6e-18

    1. Initial program 91.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.6e-18 < t < 2.4e6

    1. Initial program 92.4%

      \[\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)}} \]
      2. times-frac96.4%

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

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

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

    if 2.4e6 < t

    1. Initial program 80.9%

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

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

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

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

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

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

Alternative 5: 73.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}\;t \leq -5.5 \cdot 10^{-30}:\\ \;\;\;\;\frac{x}{t} \cdot \frac{-2}{z\_m}\\ \mathbf{elif}\;t \leq 550000:\\ \;\;\;\;\frac{2}{\frac{y}{\frac{x}{z\_m}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z\_m} \cdot \frac{-2}{t}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m t)
 :precision binary64
 (*
  z_s
  (if (<= t -5.5e-30)
    (* (/ x t) (/ -2.0 z_m))
    (if (<= t 550000.0) (/ 2.0 (/ y (/ x z_m))) (* (/ x z_m) (/ -2.0 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 <= -5.5e-30) {
		tmp = (x / t) * (-2.0 / z_m);
	} else if (t <= 550000.0) {
		tmp = 2.0 / (y / (x / z_m));
	} else {
		tmp = (x / z_m) * (-2.0 / 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 <= (-5.5d-30)) then
        tmp = (x / t) * ((-2.0d0) / z_m)
    else if (t <= 550000.0d0) then
        tmp = 2.0d0 / (y / (x / z_m))
    else
        tmp = (x / z_m) * ((-2.0d0) / 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 <= -5.5e-30) {
		tmp = (x / t) * (-2.0 / z_m);
	} else if (t <= 550000.0) {
		tmp = 2.0 / (y / (x / z_m));
	} else {
		tmp = (x / z_m) * (-2.0 / 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 <= -5.5e-30:
		tmp = (x / t) * (-2.0 / z_m)
	elif t <= 550000.0:
		tmp = 2.0 / (y / (x / z_m))
	else:
		tmp = (x / z_m) * (-2.0 / 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 <= -5.5e-30)
		tmp = Float64(Float64(x / t) * Float64(-2.0 / z_m));
	elseif (t <= 550000.0)
		tmp = Float64(2.0 / Float64(y / Float64(x / z_m)));
	else
		tmp = Float64(Float64(x / z_m) * Float64(-2.0 / 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 <= -5.5e-30)
		tmp = (x / t) * (-2.0 / z_m);
	elseif (t <= 550000.0)
		tmp = 2.0 / (y / (x / z_m));
	else
		tmp = (x / z_m) * (-2.0 / 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, -5.5e-30], N[(N[(x / t), $MachinePrecision] * N[(-2.0 / z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 550000.0], N[(2.0 / N[(y / N[(x / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z$95$m), $MachinePrecision] * N[(-2.0 / 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}\;t \leq -5.5 \cdot 10^{-30}:\\
\;\;\;\;\frac{x}{t} \cdot \frac{-2}{z\_m}\\

\mathbf{elif}\;t \leq 550000:\\
\;\;\;\;\frac{2}{\frac{y}{\frac{x}{z\_m}}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -5.49999999999999976e-30

    1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.49999999999999976e-30 < t < 5.5e5

    1. Initial program 92.2%

      \[\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)}} \]
      2. *-commutative94.8%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{z \cdot \frac{1}{\frac{x}{y}}}} \]
      4. clear-num78.7%

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{y}{\frac{x}{z}}}} \]
    9. Applied egg-rr83.7%

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

    if 5.5e5 < t

    1. Initial program 80.9%

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

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

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

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

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

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

Alternative 6: 73.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}\;t \leq -4.5 \cdot 10^{-30}:\\ \;\;\;\;\frac{\frac{x \cdot -2}{t}}{z\_m}\\ \mathbf{elif}\;t \leq 600000:\\ \;\;\;\;\frac{2}{\frac{y}{\frac{x}{z\_m}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z\_m} \cdot \frac{-2}{t}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m t)
 :precision binary64
 (*
  z_s
  (if (<= t -4.5e-30)
    (/ (/ (* x -2.0) t) z_m)
    (if (<= t 600000.0) (/ 2.0 (/ y (/ x z_m))) (* (/ x z_m) (/ -2.0 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 <= -4.5e-30) {
		tmp = ((x * -2.0) / t) / z_m;
	} else if (t <= 600000.0) {
		tmp = 2.0 / (y / (x / z_m));
	} else {
		tmp = (x / z_m) * (-2.0 / 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 <= (-4.5d-30)) then
        tmp = ((x * (-2.0d0)) / t) / z_m
    else if (t <= 600000.0d0) then
        tmp = 2.0d0 / (y / (x / z_m))
    else
        tmp = (x / z_m) * ((-2.0d0) / 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 <= -4.5e-30) {
		tmp = ((x * -2.0) / t) / z_m;
	} else if (t <= 600000.0) {
		tmp = 2.0 / (y / (x / z_m));
	} else {
		tmp = (x / z_m) * (-2.0 / 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 <= -4.5e-30:
		tmp = ((x * -2.0) / t) / z_m
	elif t <= 600000.0:
		tmp = 2.0 / (y / (x / z_m))
	else:
		tmp = (x / z_m) * (-2.0 / 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 <= -4.5e-30)
		tmp = Float64(Float64(Float64(x * -2.0) / t) / z_m);
	elseif (t <= 600000.0)
		tmp = Float64(2.0 / Float64(y / Float64(x / z_m)));
	else
		tmp = Float64(Float64(x / z_m) * Float64(-2.0 / 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 <= -4.5e-30)
		tmp = ((x * -2.0) / t) / z_m;
	elseif (t <= 600000.0)
		tmp = 2.0 / (y / (x / z_m));
	else
		tmp = (x / z_m) * (-2.0 / 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, -4.5e-30], N[(N[(N[(x * -2.0), $MachinePrecision] / t), $MachinePrecision] / z$95$m), $MachinePrecision], If[LessEqual[t, 600000.0], N[(2.0 / N[(y / N[(x / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z$95$m), $MachinePrecision] * N[(-2.0 / 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}\;t \leq -4.5 \cdot 10^{-30}:\\
\;\;\;\;\frac{\frac{x \cdot -2}{t}}{z\_m}\\

\mathbf{elif}\;t \leq 600000:\\
\;\;\;\;\frac{2}{\frac{y}{\frac{x}{z\_m}}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -4.49999999999999967e-30

    1. Initial program 92.1%

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

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

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

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

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

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

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

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

    if -4.49999999999999967e-30 < t < 6e5

    1. Initial program 92.2%

      \[\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)}} \]
      2. *-commutative94.8%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{z \cdot \frac{1}{\frac{x}{y}}}} \]
      4. clear-num78.7%

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{y}{\frac{x}{z}}}} \]
    9. Applied egg-rr83.7%

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

    if 6e5 < t

    1. Initial program 80.9%

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

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

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

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

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

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

Alternative 7: 94.6% accurate, 0.7× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ z_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot 2 \leq 1000000:\\ \;\;\;\;x \cdot \frac{\frac{2}{z\_m}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \frac{\frac{x}{y - t}}{z\_m}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m t)
 :precision binary64
 (*
  z_s
  (if (<= (* x 2.0) 1000000.0)
    (* x (/ (/ 2.0 z_m) (- y t)))
    (* 2.0 (/ (/ x (- y t)) 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 ((x * 2.0) <= 1000000.0) {
		tmp = x * ((2.0 / z_m) / (y - t));
	} else {
		tmp = 2.0 * ((x / (y - t)) / 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 ((x * 2.0d0) <= 1000000.0d0) then
        tmp = x * ((2.0d0 / z_m) / (y - t))
    else
        tmp = 2.0d0 * ((x / (y - t)) / 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 ((x * 2.0) <= 1000000.0) {
		tmp = x * ((2.0 / z_m) / (y - t));
	} else {
		tmp = 2.0 * ((x / (y - t)) / 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 (x * 2.0) <= 1000000.0:
		tmp = x * ((2.0 / z_m) / (y - t))
	else:
		tmp = 2.0 * ((x / (y - t)) / 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 (Float64(x * 2.0) <= 1000000.0)
		tmp = Float64(x * Float64(Float64(2.0 / z_m) / Float64(y - t)));
	else
		tmp = Float64(2.0 * Float64(Float64(x / Float64(y - t)) / 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 ((x * 2.0) <= 1000000.0)
		tmp = x * ((2.0 / z_m) / (y - t));
	else
		tmp = 2.0 * ((x / (y - t)) / 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[N[(x * 2.0), $MachinePrecision], 1000000.0], N[(x * N[(N[(2.0 / z$95$m), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] / 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}\;x \cdot 2 \leq 1000000:\\
\;\;\;\;x \cdot \frac{\frac{2}{z\_m}}{y - t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x 2) < 1e6

    1. Initial program 94.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\frac{\frac{2}{y - t}}{z}} \]
      6. *-lft-identity98.2%

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

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

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

        \[\leadsto x \cdot \frac{\color{blue}{\frac{1 \cdot 2}{z}}}{y - t} \]
      10. metadata-eval98.2%

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

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

    if 1e6 < (*.f64 x 2)

    1. Initial program 76.0%

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 92.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{\color{blue}{\frac{1 \cdot 2}{z}}}{y - t} \]
      10. metadata-eval95.9%

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

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

    if 2.0999999999999999e35 < z

    1. Initial program 79.0%

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

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

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

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

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

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

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

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


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

    1. Initial program 92.7%

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

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

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

    if 1.9999999999999999e35 < z

    1. Initial program 79.0%

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

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

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

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

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

Alternative 10: 56.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 8 \cdot 10^{-84}:\\ \;\;\;\;x \cdot \frac{2}{z\_m \cdot y}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \frac{\frac{x}{y}}{z\_m}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m t)
 :precision binary64
 (* z_s (if (<= z_m 8e-84) (* x (/ 2.0 (* z_m y))) (* 2.0 (/ (/ x y) 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-84) {
		tmp = x * (2.0 / (z_m * y));
	} else {
		tmp = 2.0 * ((x / y) / 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-84) then
        tmp = x * (2.0d0 / (z_m * y))
    else
        tmp = 2.0d0 * ((x / y) / 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-84) {
		tmp = x * (2.0 / (z_m * y));
	} else {
		tmp = 2.0 * ((x / y) / 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-84:
		tmp = x * (2.0 / (z_m * y))
	else:
		tmp = 2.0 * ((x / y) / 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-84)
		tmp = Float64(x * Float64(2.0 / Float64(z_m * y)));
	else
		tmp = Float64(2.0 * Float64(Float64(x / y) / 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-84)
		tmp = x * (2.0 / (z_m * y));
	else
		tmp = 2.0 * ((x / y) / 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-84], N[(x * N[(2.0 / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(x / y), $MachinePrecision] / 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^{-84}:\\
\;\;\;\;x \cdot \frac{2}{z\_m \cdot y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 8.0000000000000003e-84

    1. Initial program 91.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.0000000000000003e-84 < z

    1. Initial program 85.0%

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

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

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

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

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

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

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

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

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

Alternative 11: 92.1% 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}{y - t}}{z\_m}\right) \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m t)
 :precision binary64
 (* z_s (* 2.0 (/ (/ x (- y t)) 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) {
	return z_s * (2.0 * ((x / (y - t)) / z_m));
}
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 / (y - t)) / z_m))
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 / (y - t)) / z_m));
}
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 / (y - t)) / z_m))
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 / Float64(y - t)) / z_m)))
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 / (y - t)) / z_m));
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 / N[(y - t), $MachinePrecision]), $MachinePrecision] / 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 \left(2 \cdot \frac{\frac{x}{y - t}}{z\_m}\right)
\end{array}
Derivation
  1. Initial program 89.2%

    \[\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)}} \]
    2. *-commutative92.8%

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

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

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

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

    \[\leadsto \color{blue}{2 \cdot \frac{\frac{x}{y - t}}{z}} \]
  4. Add Preprocessing
  5. Final simplification93.0%

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

Alternative 12: 54.1% 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{\frac{x}{y}}{z\_m}\right) \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m t) :precision binary64 (* z_s (* 2.0 (/ (/ x y) 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) {
	return z_s * (2.0 * ((x / y) / z_m));
}
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 / y) / z_m))
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 / y) / z_m));
}
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 / y) / z_m))
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 / y) / z_m)))
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 / y) / z_m));
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 / y), $MachinePrecision] / 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 \left(2 \cdot \frac{\frac{x}{y}}{z\_m}\right)
\end{array}
Derivation
  1. Initial program 89.2%

    \[\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)}} \]
    2. *-commutative92.8%

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

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

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

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

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

    \[\leadsto 2 \cdot \frac{\color{blue}{\frac{x}{y}}}{z} \]
  6. Final simplification52.8%

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

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

  :herbie-target
  (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))))