Linear.Projection:infinitePerspective from linear-1.19.1.3, A

Percentage Accurate: 89.6% → 98.5%
Time: 14.2s
Alternatives: 11
Speedup: 1.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 89.6% accurate, 1.0× speedup?

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

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

Alternative 1: 98.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot z - z \cdot t\\ \mathbf{if}\;t_1 \leq -1 \cdot 10^{+263} \lor \neg \left(t_1 \leq 2 \cdot 10^{+247}\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 -1e+263) (not (<= t_1 2e+247)))
     (* 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 <= -1e+263) || !(t_1 <= 2e+247)) {
		tmp = 2.0 * ((x / z) / (y - t));
	} else {
		tmp = (2.0 * x) / (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) :: t_1
    real(8) :: tmp
    t_1 = (y * z) - (z * t)
    if ((t_1 <= (-1d+263)) .or. (.not. (t_1 <= 2d+247))) then
        tmp = 2.0d0 * ((x / z) / (y - t))
    else
        tmp = (2.0d0 * x) / (z * (y - t))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (y * z) - (z * t);
	double tmp;
	if ((t_1 <= -1e+263) || !(t_1 <= 2e+247)) {
		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 <= -1e+263) or not (t_1 <= 2e+247):
		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 <= -1e+263) || !(t_1 <= 2e+247))
		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 <= -1e+263) || ~((t_1 <= 2e+247)))
		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, -1e+263], N[Not[LessEqual[t$95$1, 2e+247]], $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 -1 \cdot 10^{+263} \lor \neg \left(t_1 \leq 2 \cdot 10^{+247}\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)) < -1.00000000000000002e263 or 1.9999999999999999e247 < (-.f64 (*.f64 y z) (*.f64 t z))

    1. Initial program 65.3%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative65.3%

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

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

        \[\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 -1.00000000000000002e263 < (-.f64 (*.f64 y z) (*.f64 t z)) < 1.9999999999999999e247

    1. Initial program 96.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot z - z \cdot t \leq -1 \cdot 10^{+263} \lor \neg \left(y \cdot z - z \cdot t \leq 2 \cdot 10^{+247}\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: 73.3% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot \frac{\frac{-2}{z}}{t}\\
t_2 := 2 \cdot \frac{\frac{x}{y}}{z}\\
\mathbf{if}\;y \leq -1.12 \cdot 10^{-10}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;y \leq -2.5 \cdot 10^{-66}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -6.5 \cdot 10^{-98}:\\
\;\;\;\;x \cdot \frac{2}{y \cdot z}\\

\mathbf{elif}\;y \leq 3.5 \cdot 10^{-69}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.12e-10 or 3.5000000000000001e-69 < y

    1. Initial program 87.3%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative87.3%

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

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

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

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

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

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

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

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

    if -1.12e-10 < y < -2.49999999999999981e-66 or -6.50000000000000017e-98 < y < 3.5000000000000001e-69

    1. Initial program 86.8%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative86.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(x \cdot -2\right) \cdot \frac{1}{z \cdot t}} \]
      6. associate-*l*76.2%

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

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

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

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

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

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

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

    if -2.49999999999999981e-66 < y < -6.50000000000000017e-98

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.12 \cdot 10^{-10}:\\ \;\;\;\;2 \cdot \frac{\frac{x}{y}}{z}\\ \mathbf{elif}\;y \leq -2.5 \cdot 10^{-66}:\\ \;\;\;\;x \cdot \frac{\frac{-2}{z}}{t}\\ \mathbf{elif}\;y \leq -6.5 \cdot 10^{-98}:\\ \;\;\;\;x \cdot \frac{2}{y \cdot z}\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{-69}:\\ \;\;\;\;x \cdot \frac{\frac{-2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \frac{\frac{x}{y}}{z}\\ \end{array} \]

Alternative 3: 73.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \frac{\frac{x}{y}}{z}\\ \mathbf{if}\;y \leq -5.1 \cdot 10^{-11}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.5 \cdot 10^{-66}:\\ \;\;\;\;x \cdot \frac{\frac{-2}{z}}{t}\\ \mathbf{elif}\;y \leq -6.2 \cdot 10^{-98}:\\ \;\;\;\;x \cdot \frac{2}{y \cdot z}\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-67}:\\ \;\;\;\;\frac{-2}{z} \cdot \frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* 2.0 (/ (/ x y) z))))
   (if (<= y -5.1e-11)
     t_1
     (if (<= y -2.5e-66)
       (* x (/ (/ -2.0 z) t))
       (if (<= y -6.2e-98)
         (* x (/ 2.0 (* y z)))
         (if (<= y 1.3e-67) (* (/ -2.0 z) (/ x t)) t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * ((x / y) / z);
	double tmp;
	if (y <= -5.1e-11) {
		tmp = t_1;
	} else if (y <= -2.5e-66) {
		tmp = x * ((-2.0 / z) / t);
	} else if (y <= -6.2e-98) {
		tmp = x * (2.0 / (y * z));
	} else if (y <= 1.3e-67) {
		tmp = (-2.0 / z) * (x / 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) :: tmp
    t_1 = 2.0d0 * ((x / y) / z)
    if (y <= (-5.1d-11)) then
        tmp = t_1
    else if (y <= (-2.5d-66)) then
        tmp = x * (((-2.0d0) / z) / t)
    else if (y <= (-6.2d-98)) then
        tmp = x * (2.0d0 / (y * z))
    else if (y <= 1.3d-67) then
        tmp = ((-2.0d0) / z) * (x / 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 = 2.0 * ((x / y) / z);
	double tmp;
	if (y <= -5.1e-11) {
		tmp = t_1;
	} else if (y <= -2.5e-66) {
		tmp = x * ((-2.0 / z) / t);
	} else if (y <= -6.2e-98) {
		tmp = x * (2.0 / (y * z));
	} else if (y <= 1.3e-67) {
		tmp = (-2.0 / z) * (x / t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 * ((x / y) / z)
	tmp = 0
	if y <= -5.1e-11:
		tmp = t_1
	elif y <= -2.5e-66:
		tmp = x * ((-2.0 / z) / t)
	elif y <= -6.2e-98:
		tmp = x * (2.0 / (y * z))
	elif y <= 1.3e-67:
		tmp = (-2.0 / z) * (x / t)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(2.0 * Float64(Float64(x / y) / z))
	tmp = 0.0
	if (y <= -5.1e-11)
		tmp = t_1;
	elseif (y <= -2.5e-66)
		tmp = Float64(x * Float64(Float64(-2.0 / z) / t));
	elseif (y <= -6.2e-98)
		tmp = Float64(x * Float64(2.0 / Float64(y * z)));
	elseif (y <= 1.3e-67)
		tmp = Float64(Float64(-2.0 / z) * Float64(x / t));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = 2.0 * ((x / y) / z);
	tmp = 0.0;
	if (y <= -5.1e-11)
		tmp = t_1;
	elseif (y <= -2.5e-66)
		tmp = x * ((-2.0 / z) / t);
	elseif (y <= -6.2e-98)
		tmp = x * (2.0 / (y * z));
	elseif (y <= 1.3e-67)
		tmp = (-2.0 / z) * (x / t);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(N[(x / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.1e-11], t$95$1, If[LessEqual[y, -2.5e-66], N[(x * N[(N[(-2.0 / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -6.2e-98], N[(x * N[(2.0 / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e-67], N[(N[(-2.0 / z), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := 2 \cdot \frac{\frac{x}{y}}{z}\\
\mathbf{if}\;y \leq -5.1 \cdot 10^{-11}:\\
\;\;\;\;t_1\\

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

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

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -5.09999999999999984e-11 or 1.2999999999999999e-67 < y

    1. Initial program 87.3%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative87.3%

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

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

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

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

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

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

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

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

    if -5.09999999999999984e-11 < y < -2.49999999999999981e-66

    1. Initial program 93.8%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative93.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(x \cdot -2\right) \cdot \frac{1}{z \cdot t}} \]
      6. associate-*l*70.5%

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

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

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

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

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

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

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

    if -2.49999999999999981e-66 < y < -6.2e-98

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.2e-98 < y < 1.2999999999999999e-67

    1. Initial program 85.6%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative85.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.1 \cdot 10^{-11}:\\ \;\;\;\;2 \cdot \frac{\frac{x}{y}}{z}\\ \mathbf{elif}\;y \leq -2.5 \cdot 10^{-66}:\\ \;\;\;\;x \cdot \frac{\frac{-2}{z}}{t}\\ \mathbf{elif}\;y \leq -6.2 \cdot 10^{-98}:\\ \;\;\;\;x \cdot \frac{2}{y \cdot z}\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-67}:\\ \;\;\;\;\frac{-2}{z} \cdot \frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \frac{\frac{x}{y}}{z}\\ \end{array} \]

Alternative 4: 73.3% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \frac{\frac{x}{y}}{z}\\ \mathbf{if}\;y \leq -4 \cdot 10^{-7}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -3.3 \cdot 10^{-66}:\\ \;\;\;\;x \cdot \frac{\frac{-2}{z}}{t}\\ \mathbf{elif}\;y \leq -6.2 \cdot 10^{-98}:\\ \;\;\;\;x \cdot \frac{2}{y \cdot z}\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-68}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{-2}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* 2.0 (/ (/ x y) z))))
   (if (<= y -4e-7)
     t_1
     (if (<= y -3.3e-66)
       (* x (/ (/ -2.0 z) t))
       (if (<= y -6.2e-98)
         (* x (/ 2.0 (* y z)))
         (if (<= y 6e-68) (* (/ x z) (/ -2.0 t)) t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * ((x / y) / z);
	double tmp;
	if (y <= -4e-7) {
		tmp = t_1;
	} else if (y <= -3.3e-66) {
		tmp = x * ((-2.0 / z) / t);
	} else if (y <= -6.2e-98) {
		tmp = x * (2.0 / (y * z));
	} else if (y <= 6e-68) {
		tmp = (x / z) * (-2.0 / 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) :: tmp
    t_1 = 2.0d0 * ((x / y) / z)
    if (y <= (-4d-7)) then
        tmp = t_1
    else if (y <= (-3.3d-66)) then
        tmp = x * (((-2.0d0) / z) / t)
    else if (y <= (-6.2d-98)) then
        tmp = x * (2.0d0 / (y * z))
    else if (y <= 6d-68) then
        tmp = (x / z) * ((-2.0d0) / 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 = 2.0 * ((x / y) / z);
	double tmp;
	if (y <= -4e-7) {
		tmp = t_1;
	} else if (y <= -3.3e-66) {
		tmp = x * ((-2.0 / z) / t);
	} else if (y <= -6.2e-98) {
		tmp = x * (2.0 / (y * z));
	} else if (y <= 6e-68) {
		tmp = (x / z) * (-2.0 / t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 * ((x / y) / z)
	tmp = 0
	if y <= -4e-7:
		tmp = t_1
	elif y <= -3.3e-66:
		tmp = x * ((-2.0 / z) / t)
	elif y <= -6.2e-98:
		tmp = x * (2.0 / (y * z))
	elif y <= 6e-68:
		tmp = (x / z) * (-2.0 / t)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(2.0 * Float64(Float64(x / y) / z))
	tmp = 0.0
	if (y <= -4e-7)
		tmp = t_1;
	elseif (y <= -3.3e-66)
		tmp = Float64(x * Float64(Float64(-2.0 / z) / t));
	elseif (y <= -6.2e-98)
		tmp = Float64(x * Float64(2.0 / Float64(y * z)));
	elseif (y <= 6e-68)
		tmp = Float64(Float64(x / z) * Float64(-2.0 / t));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = 2.0 * ((x / y) / z);
	tmp = 0.0;
	if (y <= -4e-7)
		tmp = t_1;
	elseif (y <= -3.3e-66)
		tmp = x * ((-2.0 / z) / t);
	elseif (y <= -6.2e-98)
		tmp = x * (2.0 / (y * z));
	elseif (y <= 6e-68)
		tmp = (x / z) * (-2.0 / t);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(N[(x / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4e-7], t$95$1, If[LessEqual[y, -3.3e-66], N[(x * N[(N[(-2.0 / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -6.2e-98], N[(x * N[(2.0 / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e-68], N[(N[(x / z), $MachinePrecision] * N[(-2.0 / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := 2 \cdot \frac{\frac{x}{y}}{z}\\
\mathbf{if}\;y \leq -4 \cdot 10^{-7}:\\
\;\;\;\;t_1\\

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

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

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -3.9999999999999998e-7 or 6e-68 < y

    1. Initial program 87.3%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative87.3%

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

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

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

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

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

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

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

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

    if -3.9999999999999998e-7 < y < -3.2999999999999999e-66

    1. Initial program 93.8%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative93.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(x \cdot -2\right) \cdot \frac{1}{z \cdot t}} \]
      6. associate-*l*70.5%

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

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

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

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

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

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

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

    if -3.2999999999999999e-66 < y < -6.2e-98

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.2e-98 < y < 6e-68

    1. Initial program 85.6%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4 \cdot 10^{-7}:\\ \;\;\;\;2 \cdot \frac{\frac{x}{y}}{z}\\ \mathbf{elif}\;y \leq -3.3 \cdot 10^{-66}:\\ \;\;\;\;x \cdot \frac{\frac{-2}{z}}{t}\\ \mathbf{elif}\;y \leq -6.2 \cdot 10^{-98}:\\ \;\;\;\;x \cdot \frac{2}{y \cdot z}\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-68}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{-2}{t}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \frac{\frac{x}{y}}{z}\\ \end{array} \]

Alternative 5: 73.1% accurate, 0.7× speedup?

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

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

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

\mathbf{elif}\;y \leq -6.5 \cdot 10^{-98}:\\
\;\;\;\;x \cdot \frac{2}{y \cdot z}\\

\mathbf{elif}\;y \leq 1.55 \cdot 10^{+27}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{-2}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -1.6999999999999999e-9

    1. Initial program 86.8%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative86.8%

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

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

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

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

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

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

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

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

    if -1.6999999999999999e-9 < y < -2.29999999999999992e-66

    1. Initial program 93.8%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative93.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(x \cdot -2\right) \cdot \frac{1}{z \cdot t}} \]
      6. associate-*l*70.5%

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

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

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

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

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

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

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

    if -2.29999999999999992e-66 < y < -6.50000000000000017e-98

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.50000000000000017e-98 < y < 1.54999999999999998e27

    1. Initial program 86.4%

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

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

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

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

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

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

    if 1.54999999999999998e27 < y

    1. Initial program 86.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.7 \cdot 10^{-9}:\\ \;\;\;\;2 \cdot \frac{\frac{x}{y}}{z}\\ \mathbf{elif}\;y \leq -2.3 \cdot 10^{-66}:\\ \;\;\;\;x \cdot \frac{\frac{-2}{z}}{t}\\ \mathbf{elif}\;y \leq -6.5 \cdot 10^{-98}:\\ \;\;\;\;x \cdot \frac{2}{y \cdot z}\\ \mathbf{elif}\;y \leq 1.55 \cdot 10^{+27}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{-2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{2}{y}\\ \end{array} \]

Alternative 6: 73.0% accurate, 0.7× speedup?

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

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

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

\mathbf{elif}\;y \leq -6.5 \cdot 10^{-98}:\\
\;\;\;\;x \cdot \frac{2}{y \cdot z}\\

\mathbf{elif}\;y \leq 3.5 \cdot 10^{+26}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{-2}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -2.09999999999999994e-8

    1. Initial program 86.8%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative86.8%

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

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

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

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

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

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

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

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

    if -2.09999999999999994e-8 < y < -2.8e-66

    1. Initial program 93.8%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative93.8%

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

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

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

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

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

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

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

    if -2.8e-66 < y < -6.50000000000000017e-98

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.50000000000000017e-98 < y < 3.4999999999999999e26

    1. Initial program 86.4%

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

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

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

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

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

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

    if 3.4999999999999999e26 < y

    1. Initial program 86.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.1 \cdot 10^{-8}:\\ \;\;\;\;2 \cdot \frac{\frac{x}{y}}{z}\\ \mathbf{elif}\;y \leq -2.8 \cdot 10^{-66}:\\ \;\;\;\;\frac{x}{z \cdot t} \cdot -2\\ \mathbf{elif}\;y \leq -6.5 \cdot 10^{-98}:\\ \;\;\;\;x \cdot \frac{2}{y \cdot z}\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{+26}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{-2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{2}{y}\\ \end{array} \]

Alternative 7: 73.0% accurate, 0.7× speedup?

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

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

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

\mathbf{elif}\;y \leq -6.5 \cdot 10^{-98}:\\
\;\;\;\;x \cdot \frac{2}{y \cdot z}\\

\mathbf{elif}\;y \leq 3.9 \cdot 10^{+25}:\\
\;\;\;\;\frac{\frac{x \cdot -2}{z}}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -1.80000000000000005e-5

    1. Initial program 86.8%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative86.8%

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

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

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

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

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

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

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

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

    if -1.80000000000000005e-5 < y < -2.29999999999999992e-66

    1. Initial program 93.8%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative93.8%

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

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

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

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

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

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

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

    if -2.29999999999999992e-66 < y < -6.50000000000000017e-98

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.50000000000000017e-98 < y < 3.9000000000000002e25

    1. Initial program 86.4%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative86.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{-x \cdot 2}{z}}{t}} \]
      6. distribute-rgt-neg-in78.3%

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

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

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

    if 3.9000000000000002e25 < y

    1. Initial program 86.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.8 \cdot 10^{-5}:\\ \;\;\;\;2 \cdot \frac{\frac{x}{y}}{z}\\ \mathbf{elif}\;y \leq -2.3 \cdot 10^{-66}:\\ \;\;\;\;\frac{x}{z \cdot t} \cdot -2\\ \mathbf{elif}\;y \leq -6.5 \cdot 10^{-98}:\\ \;\;\;\;x \cdot \frac{2}{y \cdot z}\\ \mathbf{elif}\;y \leq 3.9 \cdot 10^{+25}:\\ \;\;\;\;\frac{\frac{x \cdot -2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{2}{y}\\ \end{array} \]

Alternative 8: 94.0% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 89.1%

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

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

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

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

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

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

    if 1.9999999999999999e-77 < (*.f64 x 2)

    1. Initial program 84.1%

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

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

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

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

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

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

Alternative 9: 93.9% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 89.8%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative89.8%

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000002e-23 < (*.f64 x 2)

    1. Initial program 81.7%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative81.7%

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

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

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

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

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

Alternative 10: 92.0% 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 87.5%

    \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
  2. Step-by-step derivation
    1. *-commutative87.5%

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

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

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

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

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

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

Alternative 11: 52.8% accurate, 1.6× speedup?

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

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

    \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
  2. Step-by-step derivation
    1. *-commutative87.5%

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

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

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

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

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

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

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

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

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

Developer target: 97.0% accurate, 0.3× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023279 
(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))))