Linear.Projection:infinitePerspective from linear-1.19.1.3, A

Percentage Accurate: 89.3% → 98.3%
Time: 8.3s
Alternatives: 10
Speedup: 1.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 89.3% 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: 98.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot z - z \cdot t\\ \mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 5 \cdot 10^{+301}\right):\\ \;\;\;\;2 \cdot \frac{\frac{x}{z}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot x}{z \cdot \left(y - t\right)}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (* y z) (* z t))))
   (if (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+301)))
     (* 2.0 (/ (/ x z) (- y t)))
     (/ (* 2.0 x) (* z (- y t))))))
double code(double x, double y, double z, double t) {
	double t_1 = (y * z) - (z * t);
	double tmp;
	if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 5e+301)) {
		tmp = 2.0 * ((x / z) / (y - t));
	} else {
		tmp = (2.0 * x) / (z * (y - t));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = (y * z) - (z * t);
	double tmp;
	if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 5e+301)) {
		tmp = 2.0 * ((x / z) / (y - t));
	} else {
		tmp = (2.0 * x) / (z * (y - t));
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (y * z) - (z * t)
	tmp = 0
	if (t_1 <= -math.inf) or not (t_1 <= 5e+301):
		tmp = 2.0 * ((x / z) / (y - t))
	else:
		tmp = (2.0 * x) / (z * (y - t))
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(y * z) - Float64(z * t))
	tmp = 0.0
	if ((t_1 <= Float64(-Inf)) || !(t_1 <= 5e+301))
		tmp = Float64(2.0 * Float64(Float64(x / z) / Float64(y - t)));
	else
		tmp = Float64(Float64(2.0 * x) / Float64(z * Float64(y - t)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (y * z) - (z * t);
	tmp = 0.0;
	if ((t_1 <= -Inf) || ~((t_1 <= 5e+301)))
		tmp = 2.0 * ((x / z) / (y - t));
	else
		tmp = (2.0 * x) / (z * (y - t));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * z), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+301]], $MachinePrecision]], N[(2.0 * N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * x), $MachinePrecision] / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := y \cdot z - z \cdot t\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 5 \cdot 10^{+301}\right):\\
\;\;\;\;2 \cdot \frac{\frac{x}{z}}{y - t}\\

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


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

    1. Initial program 57.1%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. associate-*l/57.1%

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

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

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

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

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

    if -inf.0 < (-.f64 (*.f64 y z) (*.f64 t z)) < 5.0000000000000004e301

    1. Initial program 97.3%

      \[\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)}} \]
    3. Simplified98.3%

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

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

Alternative 2: 96.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.8 \cdot 10^{-18} \lor \neg \left(z \leq 50000\right):\\ \;\;\;\;2 \cdot \frac{\frac{x}{z}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{2}{z \cdot \left(y - t\right)}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= z -2.8e-18) (not (<= z 50000.0)))
   (* 2.0 (/ (/ x z) (- y t)))
   (* x (/ 2.0 (* z (- y t))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -2.8e-18) || !(z <= 50000.0)) {
		tmp = 2.0 * ((x / z) / (y - t));
	} else {
		tmp = x * (2.0 / (z * (y - t)));
	}
	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) :: tmp
    if ((z <= (-2.8d-18)) .or. (.not. (z <= 50000.0d0))) then
        tmp = 2.0d0 * ((x / z) / (y - t))
    else
        tmp = x * (2.0d0 / (z * (y - t)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -2.8e-18) || !(z <= 50000.0)) {
		tmp = 2.0 * ((x / z) / (y - t));
	} else {
		tmp = x * (2.0 / (z * (y - t)));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z <= -2.8e-18) or not (z <= 50000.0):
		tmp = 2.0 * ((x / z) / (y - t))
	else:
		tmp = x * (2.0 / (z * (y - t)))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((z <= -2.8e-18) || !(z <= 50000.0))
		tmp = Float64(2.0 * Float64(Float64(x / z) / Float64(y - t)));
	else
		tmp = Float64(x * Float64(2.0 / Float64(z * Float64(y - t))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((z <= -2.8e-18) || ~((z <= 50000.0)))
		tmp = 2.0 * ((x / z) / (y - t));
	else
		tmp = x * (2.0 / (z * (y - t)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.8e-18], N[Not[LessEqual[z, 50000.0]], $MachinePrecision]], N[(2.0 * N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(2.0 / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{-18} \lor \neg \left(z \leq 50000\right):\\
\;\;\;\;2 \cdot \frac{\frac{x}{z}}{y - t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.80000000000000012e-18 or 5e4 < z

    1. Initial program 82.4%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. associate-*l/82.3%

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

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

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

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

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

    if -2.80000000000000012e-18 < z < 5e4

    1. Initial program 96.0%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. associate-*r/95.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.8 \cdot 10^{-18} \lor \neg \left(z \leq 50000\right):\\ \;\;\;\;2 \cdot \frac{\frac{x}{z}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{2}{z \cdot \left(y - t\right)}\\ \end{array} \]

Alternative 3: 96.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3.8 \cdot 10^{+98} \lor \neg \left(z \leq 1.05 \cdot 10^{-33}\right):\\ \;\;\;\;2 \cdot \frac{\frac{x}{z}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{\frac{-2}{t - y}}{z}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= z -3.8e+98) (not (<= z 1.05e-33)))
   (* 2.0 (/ (/ x z) (- y t)))
   (* x (/ (/ -2.0 (- t y)) z))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -3.8e+98) || !(z <= 1.05e-33)) {
		tmp = 2.0 * ((x / z) / (y - t));
	} else {
		tmp = x * ((-2.0 / (t - y)) / z);
	}
	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) :: tmp
    if ((z <= (-3.8d+98)) .or. (.not. (z <= 1.05d-33))) then
        tmp = 2.0d0 * ((x / z) / (y - t))
    else
        tmp = x * (((-2.0d0) / (t - y)) / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -3.8e+98) || !(z <= 1.05e-33)) {
		tmp = 2.0 * ((x / z) / (y - t));
	} else {
		tmp = x * ((-2.0 / (t - y)) / z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z <= -3.8e+98) or not (z <= 1.05e-33):
		tmp = 2.0 * ((x / z) / (y - t))
	else:
		tmp = x * ((-2.0 / (t - y)) / z)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((z <= -3.8e+98) || !(z <= 1.05e-33))
		tmp = Float64(2.0 * Float64(Float64(x / z) / Float64(y - t)));
	else
		tmp = Float64(x * Float64(Float64(-2.0 / Float64(t - y)) / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((z <= -3.8e+98) || ~((z <= 1.05e-33)))
		tmp = 2.0 * ((x / z) / (y - t));
	else
		tmp = x * ((-2.0 / (t - y)) / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.8e+98], N[Not[LessEqual[z, 1.05e-33]], $MachinePrecision]], N[(2.0 * N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(-2.0 / N[(t - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+98} \lor \neg \left(z \leq 1.05 \cdot 10^{-33}\right):\\
\;\;\;\;2 \cdot \frac{\frac{x}{z}}{y - t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.7999999999999999e98 or 1.05e-33 < z

    1. Initial program 79.6%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. associate-*l/79.6%

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

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

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

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

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

    if -3.7999999999999999e98 < z < 1.05e-33

    1. Initial program 96.4%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. associate-*r/96.2%

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

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

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

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

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

        \[\leadsto x \cdot \frac{\frac{2}{\color{blue}{\left(0 - t\right)} + y}}{z} \]
      7. associate-+l-97.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.8 \cdot 10^{+98} \lor \neg \left(z \leq 1.05 \cdot 10^{-33}\right):\\ \;\;\;\;2 \cdot \frac{\frac{x}{z}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{\frac{-2}{t - y}}{z}\\ \end{array} \]

Alternative 4: 96.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.3 \cdot 10^{+96} \lor \neg \left(z \leq 0.00047\right):\\ \;\;\;\;\frac{x}{y - t} \cdot \frac{2}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{\frac{-2}{t - y}}{z}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= z -1.3e+96) (not (<= z 0.00047)))
   (* (/ x (- y t)) (/ 2.0 z))
   (* x (/ (/ -2.0 (- t y)) z))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -1.3e+96) || !(z <= 0.00047)) {
		tmp = (x / (y - t)) * (2.0 / z);
	} else {
		tmp = x * ((-2.0 / (t - y)) / z);
	}
	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) :: tmp
    if ((z <= (-1.3d+96)) .or. (.not. (z <= 0.00047d0))) then
        tmp = (x / (y - t)) * (2.0d0 / z)
    else
        tmp = x * (((-2.0d0) / (t - y)) / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -1.3e+96) || !(z <= 0.00047)) {
		tmp = (x / (y - t)) * (2.0 / z);
	} else {
		tmp = x * ((-2.0 / (t - y)) / z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z <= -1.3e+96) or not (z <= 0.00047):
		tmp = (x / (y - t)) * (2.0 / z)
	else:
		tmp = x * ((-2.0 / (t - y)) / z)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((z <= -1.3e+96) || !(z <= 0.00047))
		tmp = Float64(Float64(x / Float64(y - t)) * Float64(2.0 / z));
	else
		tmp = Float64(x * Float64(Float64(-2.0 / Float64(t - y)) / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((z <= -1.3e+96) || ~((z <= 0.00047)))
		tmp = (x / (y - t)) * (2.0 / z);
	else
		tmp = x * ((-2.0 / (t - y)) / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.3e+96], N[Not[LessEqual[z, 0.00047]], $MachinePrecision]], N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(2.0 / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(-2.0 / N[(t - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+96} \lor \neg \left(z \leq 0.00047\right):\\
\;\;\;\;\frac{x}{y - t} \cdot \frac{2}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.3e96 or 4.69999999999999986e-4 < z

    1. Initial program 78.2%

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

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

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

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

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

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

    if -1.3e96 < z < 4.69999999999999986e-4

    1. Initial program 96.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. associate-*r/96.4%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{\frac{2}{y - t}}{z}} \]
      4. sub-neg97.8%

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

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

        \[\leadsto x \cdot \frac{\frac{2}{\color{blue}{\left(0 - t\right)} + y}}{z} \]
      7. associate-+l-97.8%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.3 \cdot 10^{+96} \lor \neg \left(z \leq 0.00047\right):\\ \;\;\;\;\frac{x}{y - t} \cdot \frac{2}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{\frac{-2}{t - y}}{z}\\ \end{array} \]

Alternative 5: 73.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.1 \cdot 10^{-14} \lor \neg \left(y \leq 7.1 \cdot 10^{-81}\right):\\ \;\;\;\;x \cdot \frac{\frac{2}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{\frac{-2}{z}}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= y -1.1e-14) (not (<= y 7.1e-81)))
   (* x (/ (/ 2.0 y) z))
   (* x (/ (/ -2.0 z) t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -1.1e-14) || !(y <= 7.1e-81)) {
		tmp = x * ((2.0 / y) / z);
	} else {
		tmp = x * ((-2.0 / z) / t);
	}
	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) :: tmp
    if ((y <= (-1.1d-14)) .or. (.not. (y <= 7.1d-81))) then
        tmp = x * ((2.0d0 / y) / z)
    else
        tmp = x * (((-2.0d0) / z) / t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -1.1e-14) || !(y <= 7.1e-81)) {
		tmp = x * ((2.0 / y) / z);
	} else {
		tmp = x * ((-2.0 / z) / t);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (y <= -1.1e-14) or not (y <= 7.1e-81):
		tmp = x * ((2.0 / y) / z)
	else:
		tmp = x * ((-2.0 / z) / t)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((y <= -1.1e-14) || !(y <= 7.1e-81))
		tmp = Float64(x * Float64(Float64(2.0 / y) / z));
	else
		tmp = Float64(x * Float64(Float64(-2.0 / z) / t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((y <= -1.1e-14) || ~((y <= 7.1e-81)))
		tmp = x * ((2.0 / y) / z);
	else
		tmp = x * ((-2.0 / z) / t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.1e-14], N[Not[LessEqual[y, 7.1e-81]], $MachinePrecision]], N[(x * N[(N[(2.0 / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(-2.0 / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{-14} \lor \neg \left(y \leq 7.1 \cdot 10^{-81}\right):\\
\;\;\;\;x \cdot \frac{\frac{2}{y}}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.1e-14 or 7.10000000000000019e-81 < y

    1. Initial program 88.2%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. associate-*r/88.1%

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

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

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

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

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

        \[\leadsto x \cdot \frac{\frac{2}{\color{blue}{\left(0 - t\right)} + y}}{z} \]
      7. associate-+l-91.3%

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

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

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

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

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

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

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

    if -1.1e-14 < y < 7.10000000000000019e-81

    1. Initial program 91.1%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. associate-*l/91.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.1 \cdot 10^{-14} \lor \neg \left(y \leq 7.1 \cdot 10^{-81}\right):\\ \;\;\;\;x \cdot \frac{\frac{2}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{\frac{-2}{z}}{t}\\ \end{array} \]

Alternative 6: 73.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.7 \cdot 10^{-17}:\\ \;\;\;\;x \cdot \frac{\frac{2}{y}}{z}\\ \mathbf{elif}\;y \leq 7 \cdot 10^{-86}:\\ \;\;\;\;x \cdot \frac{\frac{-2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{z} \cdot \frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -2.7e-17)
   (* x (/ (/ 2.0 y) z))
   (if (<= y 7e-86) (* x (/ (/ -2.0 z) t)) (* (/ 2.0 z) (/ x y)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -2.7e-17) {
		tmp = x * ((2.0 / y) / z);
	} else if (y <= 7e-86) {
		tmp = x * ((-2.0 / z) / t);
	} else {
		tmp = (2.0 / z) * (x / y);
	}
	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) :: tmp
    if (y <= (-2.7d-17)) then
        tmp = x * ((2.0d0 / y) / z)
    else if (y <= 7d-86) then
        tmp = x * (((-2.0d0) / z) / t)
    else
        tmp = (2.0d0 / z) * (x / y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -2.7e-17) {
		tmp = x * ((2.0 / y) / z);
	} else if (y <= 7e-86) {
		tmp = x * ((-2.0 / z) / t);
	} else {
		tmp = (2.0 / z) * (x / y);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= -2.7e-17:
		tmp = x * ((2.0 / y) / z)
	elif y <= 7e-86:
		tmp = x * ((-2.0 / z) / t)
	else:
		tmp = (2.0 / z) * (x / y)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -2.7e-17)
		tmp = Float64(x * Float64(Float64(2.0 / y) / z));
	elseif (y <= 7e-86)
		tmp = Float64(x * Float64(Float64(-2.0 / z) / t));
	else
		tmp = Float64(Float64(2.0 / z) * Float64(x / y));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -2.7e-17)
		tmp = x * ((2.0 / y) / z);
	elseif (y <= 7e-86)
		tmp = x * ((-2.0 / z) / t);
	else
		tmp = (2.0 / z) * (x / y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.7e-17], N[(x * N[(N[(2.0 / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e-86], N[(x * N[(N[(-2.0 / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{-17}:\\
\;\;\;\;x \cdot \frac{\frac{2}{y}}{z}\\

\mathbf{elif}\;y \leq 7 \cdot 10^{-86}:\\
\;\;\;\;x \cdot \frac{\frac{-2}{z}}{t}\\

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


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

    1. Initial program 90.7%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. associate-*r/90.6%

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

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

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

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

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

        \[\leadsto x \cdot \frac{\frac{2}{\color{blue}{\left(0 - t\right)} + y}}{z} \]
      7. associate-+l-93.3%

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

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

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

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

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

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

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

    if -2.7000000000000001e-17 < y < 7.00000000000000041e-86

    1. Initial program 91.1%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. associate-*l/91.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.00000000000000041e-86 < y

    1. Initial program 86.3%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.7 \cdot 10^{-17}:\\ \;\;\;\;x \cdot \frac{\frac{2}{y}}{z}\\ \mathbf{elif}\;y \leq 7 \cdot 10^{-86}:\\ \;\;\;\;x \cdot \frac{\frac{-2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{z} \cdot \frac{x}{y}\\ \end{array} \]

Alternative 7: 92.2% accurate, 1.2× speedup?

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

\\
2 \cdot \frac{\frac{x}{z}}{y - t}
\end{array}
Derivation
  1. Initial program 89.4%

    \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
  2. Step-by-step derivation
    1. associate-*l/89.4%

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

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

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

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

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

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

Alternative 8: 53.5% accurate, 1.6× speedup?

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

\\
-2 \cdot \frac{x}{z \cdot t}
\end{array}
Derivation
  1. Initial program 89.4%

    \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
  2. Step-by-step derivation
    1. associate-*r/89.3%

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

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

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

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

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

      \[\leadsto x \cdot \frac{\frac{2}{\color{blue}{\left(0 - t\right)} + y}}{z} \]
    7. associate-+l-92.0%

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

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

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

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

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

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

    \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
  5. Final simplification51.0%

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

Alternative 9: 53.6% accurate, 1.6× speedup?

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

\\
x \cdot \frac{\frac{-2}{t}}{z}
\end{array}
Derivation
  1. Initial program 89.4%

    \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
  2. Step-by-step derivation
    1. associate-*r/89.3%

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

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

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

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

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

      \[\leadsto x \cdot \frac{\frac{2}{\color{blue}{\left(0 - t\right)} + y}}{z} \]
    7. associate-+l-92.0%

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

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

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

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

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

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

    \[\leadsto x \cdot \frac{\color{blue}{\frac{-2}{t}}}{z} \]
  5. Final simplification51.0%

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

Alternative 10: 53.6% accurate, 1.6× speedup?

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

\\
x \cdot \frac{\frac{-2}{z}}{t}
\end{array}
Derivation
  1. Initial program 89.4%

    \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
  2. Step-by-step derivation
    1. associate-*l/89.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto x \cdot \color{blue}{\frac{\frac{-2}{z}}{t}} \]
  10. Final simplification51.1%

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

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 2023224 
(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))))