Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2

Percentage Accurate: 86.1% → 99.4%
Time: 11.6s
Alternatives: 15
Speedup: 1.3×

Specification

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

\\
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{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 15 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: 86.1% accurate, 1.0× speedup?

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

\\
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\end{array}

Alternative 1: 99.4% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x}{y} + \frac{2 + \left(2 \cdot z\right) \cdot \left(1 - t\right)}{z \cdot t}\\
\mathbf{if}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\

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


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

    1. Initial program 99.8%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]

    if +inf.0 < (+.f64 (/.f64 x y) (/.f64 (+.f64 2 (*.f64 (*.f64 z 2) (-.f64 1 t))) (*.f64 t z)))

    1. Initial program 0.0%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around inf 100.0%

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

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

Alternative 2: 63.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} - 2\\ t_2 := \frac{2}{z \cdot t}\\ t_3 := -2 + \frac{2}{t}\\ \mathbf{if}\;z \leq -3.5 \cdot 10^{+108}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -3.7 \cdot 10^{-89}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 6.1 \cdot 10^{-120}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 9 \cdot 10^{-40}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-11}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{+213} \lor \neg \left(z \leq 4.9 \cdot 10^{+291}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (/ x y) 2.0)) (t_2 (/ 2.0 (* z t))) (t_3 (+ -2.0 (/ 2.0 t))))
   (if (<= z -3.5e+108)
     t_3
     (if (<= z -3.7e-89)
       t_1
       (if (<= z 6.1e-120)
         t_2
         (if (<= z 9e-40)
           t_1
           (if (<= z 1.65e-11)
             t_2
             (if (or (<= z 7.2e+213) (not (<= z 4.9e+291))) t_1 t_3))))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / y) - 2.0;
	double t_2 = 2.0 / (z * t);
	double t_3 = -2.0 + (2.0 / t);
	double tmp;
	if (z <= -3.5e+108) {
		tmp = t_3;
	} else if (z <= -3.7e-89) {
		tmp = t_1;
	} else if (z <= 6.1e-120) {
		tmp = t_2;
	} else if (z <= 9e-40) {
		tmp = t_1;
	} else if (z <= 1.65e-11) {
		tmp = t_2;
	} else if ((z <= 7.2e+213) || !(z <= 4.9e+291)) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	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) :: t_3
    real(8) :: tmp
    t_1 = (x / y) - 2.0d0
    t_2 = 2.0d0 / (z * t)
    t_3 = (-2.0d0) + (2.0d0 / t)
    if (z <= (-3.5d+108)) then
        tmp = t_3
    else if (z <= (-3.7d-89)) then
        tmp = t_1
    else if (z <= 6.1d-120) then
        tmp = t_2
    else if (z <= 9d-40) then
        tmp = t_1
    else if (z <= 1.65d-11) then
        tmp = t_2
    else if ((z <= 7.2d+213) .or. (.not. (z <= 4.9d+291))) then
        tmp = t_1
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (x / y) - 2.0;
	double t_2 = 2.0 / (z * t);
	double t_3 = -2.0 + (2.0 / t);
	double tmp;
	if (z <= -3.5e+108) {
		tmp = t_3;
	} else if (z <= -3.7e-89) {
		tmp = t_1;
	} else if (z <= 6.1e-120) {
		tmp = t_2;
	} else if (z <= 9e-40) {
		tmp = t_1;
	} else if (z <= 1.65e-11) {
		tmp = t_2;
	} else if ((z <= 7.2e+213) || !(z <= 4.9e+291)) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / y) - 2.0
	t_2 = 2.0 / (z * t)
	t_3 = -2.0 + (2.0 / t)
	tmp = 0
	if z <= -3.5e+108:
		tmp = t_3
	elif z <= -3.7e-89:
		tmp = t_1
	elif z <= 6.1e-120:
		tmp = t_2
	elif z <= 9e-40:
		tmp = t_1
	elif z <= 1.65e-11:
		tmp = t_2
	elif (z <= 7.2e+213) or not (z <= 4.9e+291):
		tmp = t_1
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x / y) - 2.0)
	t_2 = Float64(2.0 / Float64(z * t))
	t_3 = Float64(-2.0 + Float64(2.0 / t))
	tmp = 0.0
	if (z <= -3.5e+108)
		tmp = t_3;
	elseif (z <= -3.7e-89)
		tmp = t_1;
	elseif (z <= 6.1e-120)
		tmp = t_2;
	elseif (z <= 9e-40)
		tmp = t_1;
	elseif (z <= 1.65e-11)
		tmp = t_2;
	elseif ((z <= 7.2e+213) || !(z <= 4.9e+291))
		tmp = t_1;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x / y) - 2.0;
	t_2 = 2.0 / (z * t);
	t_3 = -2.0 + (2.0 / t);
	tmp = 0.0;
	if (z <= -3.5e+108)
		tmp = t_3;
	elseif (z <= -3.7e-89)
		tmp = t_1;
	elseif (z <= 6.1e-120)
		tmp = t_2;
	elseif (z <= 9e-40)
		tmp = t_1;
	elseif (z <= 1.65e-11)
		tmp = t_2;
	elseif ((z <= 7.2e+213) || ~((z <= 4.9e+291)))
		tmp = t_1;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.5e+108], t$95$3, If[LessEqual[z, -3.7e-89], t$95$1, If[LessEqual[z, 6.1e-120], t$95$2, If[LessEqual[z, 9e-40], t$95$1, If[LessEqual[z, 1.65e-11], t$95$2, If[Or[LessEqual[z, 7.2e+213], N[Not[LessEqual[z, 4.9e+291]], $MachinePrecision]], t$95$1, t$95$3]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -3.7 \cdot 10^{-89}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 6.1 \cdot 10^{-120}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 9 \cdot 10^{-40}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 1.65 \cdot 10^{-11}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 7.2 \cdot 10^{+213} \lor \neg \left(z \leq 4.9 \cdot 10^{+291}\right):\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.5000000000000002e108 or 7.2000000000000002e213 < z < 4.90000000000000004e291

    1. Initial program 72.4%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in z around inf 100.0%

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \frac{1 - t}{t}} \]
    3. Step-by-step derivation
      1. div-sub100.0%

        \[\leadsto \frac{x}{y} + 2 \cdot \color{blue}{\left(\frac{1}{t} - \frac{t}{t}\right)} \]
      2. sub-neg100.0%

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \left(\frac{1}{t} + -1\right)} \]
    5. Taylor expanded in x around 0 80.9%

      \[\leadsto \color{blue}{2 \cdot \left(\frac{1}{t} - 1\right)} \]
    6. Step-by-step derivation
      1. sub-neg80.9%

        \[\leadsto 2 \cdot \color{blue}{\left(\frac{1}{t} + \left(-1\right)\right)} \]
      2. metadata-eval80.9%

        \[\leadsto 2 \cdot \left(\frac{1}{t} + \color{blue}{-1}\right) \]
      3. distribute-lft-in80.9%

        \[\leadsto \color{blue}{2 \cdot \frac{1}{t} + 2 \cdot -1} \]
      4. associate-*r/80.9%

        \[\leadsto \color{blue}{\frac{2 \cdot 1}{t}} + 2 \cdot -1 \]
      5. metadata-eval80.9%

        \[\leadsto \frac{\color{blue}{2}}{t} + 2 \cdot -1 \]
      6. metadata-eval80.9%

        \[\leadsto \frac{2}{t} + \color{blue}{-2} \]
    7. Simplified80.9%

      \[\leadsto \color{blue}{\frac{2}{t} + -2} \]

    if -3.5000000000000002e108 < z < -3.6999999999999997e-89 or 6.1e-120 < z < 9.0000000000000002e-40 or 1.6500000000000001e-11 < z < 7.2000000000000002e213 or 4.90000000000000004e291 < z

    1. Initial program 87.8%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around inf 71.2%

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

    if -3.6999999999999997e-89 < z < 6.1e-120 or 9.0000000000000002e-40 < z < 1.6500000000000001e-11

    1. Initial program 97.7%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around 0 95.7%

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{2 + 2 \cdot z}{t \cdot z}} \]
    3. Taylor expanded in z around 0 95.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} + \left(2 \cdot \frac{1}{t} + \frac{\color{blue}{2}}{z} \cdot \frac{1}{t}\right) \]
      12. distribute-rgt-in95.7%

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

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

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{2 + \frac{2}{z}}}{t} \]
    5. Simplified95.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.5 \cdot 10^{+108}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;z \leq -3.7 \cdot 10^{-89}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq 6.1 \cdot 10^{-120}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{elif}\;z \leq 9 \cdot 10^{-40}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-11}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{+213} \lor \neg \left(z \leq 4.9 \cdot 10^{+291}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \end{array} \]

Alternative 3: 63.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} - 2\\ t_2 := \frac{\frac{2}{t}}{z}\\ t_3 := -2 + \frac{2}{t}\\ \mathbf{if}\;z \leq -1.25 \cdot 10^{+108}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -2.15 \cdot 10^{-89}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{-119}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 9.2 \cdot 10^{-40}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-11}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.02 \cdot 10^{+214} \lor \neg \left(z \leq 4.5 \cdot 10^{+292}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (/ x y) 2.0)) (t_2 (/ (/ 2.0 t) z)) (t_3 (+ -2.0 (/ 2.0 t))))
   (if (<= z -1.25e+108)
     t_3
     (if (<= z -2.15e-89)
       t_1
       (if (<= z 8.2e-119)
         t_2
         (if (<= z 9.2e-40)
           t_1
           (if (<= z 1.65e-11)
             t_2
             (if (or (<= z 1.02e+214) (not (<= z 4.5e+292))) t_1 t_3))))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / y) - 2.0;
	double t_2 = (2.0 / t) / z;
	double t_3 = -2.0 + (2.0 / t);
	double tmp;
	if (z <= -1.25e+108) {
		tmp = t_3;
	} else if (z <= -2.15e-89) {
		tmp = t_1;
	} else if (z <= 8.2e-119) {
		tmp = t_2;
	} else if (z <= 9.2e-40) {
		tmp = t_1;
	} else if (z <= 1.65e-11) {
		tmp = t_2;
	} else if ((z <= 1.02e+214) || !(z <= 4.5e+292)) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	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) :: t_3
    real(8) :: tmp
    t_1 = (x / y) - 2.0d0
    t_2 = (2.0d0 / t) / z
    t_3 = (-2.0d0) + (2.0d0 / t)
    if (z <= (-1.25d+108)) then
        tmp = t_3
    else if (z <= (-2.15d-89)) then
        tmp = t_1
    else if (z <= 8.2d-119) then
        tmp = t_2
    else if (z <= 9.2d-40) then
        tmp = t_1
    else if (z <= 1.65d-11) then
        tmp = t_2
    else if ((z <= 1.02d+214) .or. (.not. (z <= 4.5d+292))) then
        tmp = t_1
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (x / y) - 2.0;
	double t_2 = (2.0 / t) / z;
	double t_3 = -2.0 + (2.0 / t);
	double tmp;
	if (z <= -1.25e+108) {
		tmp = t_3;
	} else if (z <= -2.15e-89) {
		tmp = t_1;
	} else if (z <= 8.2e-119) {
		tmp = t_2;
	} else if (z <= 9.2e-40) {
		tmp = t_1;
	} else if (z <= 1.65e-11) {
		tmp = t_2;
	} else if ((z <= 1.02e+214) || !(z <= 4.5e+292)) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / y) - 2.0
	t_2 = (2.0 / t) / z
	t_3 = -2.0 + (2.0 / t)
	tmp = 0
	if z <= -1.25e+108:
		tmp = t_3
	elif z <= -2.15e-89:
		tmp = t_1
	elif z <= 8.2e-119:
		tmp = t_2
	elif z <= 9.2e-40:
		tmp = t_1
	elif z <= 1.65e-11:
		tmp = t_2
	elif (z <= 1.02e+214) or not (z <= 4.5e+292):
		tmp = t_1
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x / y) - 2.0)
	t_2 = Float64(Float64(2.0 / t) / z)
	t_3 = Float64(-2.0 + Float64(2.0 / t))
	tmp = 0.0
	if (z <= -1.25e+108)
		tmp = t_3;
	elseif (z <= -2.15e-89)
		tmp = t_1;
	elseif (z <= 8.2e-119)
		tmp = t_2;
	elseif (z <= 9.2e-40)
		tmp = t_1;
	elseif (z <= 1.65e-11)
		tmp = t_2;
	elseif ((z <= 1.02e+214) || !(z <= 4.5e+292))
		tmp = t_1;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x / y) - 2.0;
	t_2 = (2.0 / t) / z;
	t_3 = -2.0 + (2.0 / t);
	tmp = 0.0;
	if (z <= -1.25e+108)
		tmp = t_3;
	elseif (z <= -2.15e-89)
		tmp = t_1;
	elseif (z <= 8.2e-119)
		tmp = t_2;
	elseif (z <= 9.2e-40)
		tmp = t_1;
	elseif (z <= 1.65e-11)
		tmp = t_2;
	elseif ((z <= 1.02e+214) || ~((z <= 4.5e+292)))
		tmp = t_1;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]}, Block[{t$95$3 = N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.25e+108], t$95$3, If[LessEqual[z, -2.15e-89], t$95$1, If[LessEqual[z, 8.2e-119], t$95$2, If[LessEqual[z, 9.2e-40], t$95$1, If[LessEqual[z, 1.65e-11], t$95$2, If[Or[LessEqual[z, 1.02e+214], N[Not[LessEqual[z, 4.5e+292]], $MachinePrecision]], t$95$1, t$95$3]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -2.15 \cdot 10^{-89}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 8.2 \cdot 10^{-119}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 9.2 \cdot 10^{-40}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 1.65 \cdot 10^{-11}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 1.02 \cdot 10^{+214} \lor \neg \left(z \leq 4.5 \cdot 10^{+292}\right):\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.24999999999999998e108 or 1.02e214 < z < 4.49999999999999984e292

    1. Initial program 72.4%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in z around inf 100.0%

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \frac{1 - t}{t}} \]
    3. Step-by-step derivation
      1. div-sub100.0%

        \[\leadsto \frac{x}{y} + 2 \cdot \color{blue}{\left(\frac{1}{t} - \frac{t}{t}\right)} \]
      2. sub-neg100.0%

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \left(\frac{1}{t} + -1\right)} \]
    5. Taylor expanded in x around 0 80.9%

      \[\leadsto \color{blue}{2 \cdot \left(\frac{1}{t} - 1\right)} \]
    6. Step-by-step derivation
      1. sub-neg80.9%

        \[\leadsto 2 \cdot \color{blue}{\left(\frac{1}{t} + \left(-1\right)\right)} \]
      2. metadata-eval80.9%

        \[\leadsto 2 \cdot \left(\frac{1}{t} + \color{blue}{-1}\right) \]
      3. distribute-lft-in80.9%

        \[\leadsto \color{blue}{2 \cdot \frac{1}{t} + 2 \cdot -1} \]
      4. associate-*r/80.9%

        \[\leadsto \color{blue}{\frac{2 \cdot 1}{t}} + 2 \cdot -1 \]
      5. metadata-eval80.9%

        \[\leadsto \frac{\color{blue}{2}}{t} + 2 \cdot -1 \]
      6. metadata-eval80.9%

        \[\leadsto \frac{2}{t} + \color{blue}{-2} \]
    7. Simplified80.9%

      \[\leadsto \color{blue}{\frac{2}{t} + -2} \]

    if -1.24999999999999998e108 < z < -2.14999999999999993e-89 or 8.20000000000000041e-119 < z < 9.2e-40 or 1.6500000000000001e-11 < z < 1.02e214 or 4.49999999999999984e292 < z

    1. Initial program 87.8%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around inf 71.2%

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

    if -2.14999999999999993e-89 < z < 8.20000000000000041e-119 or 9.2e-40 < z < 1.6500000000000001e-11

    1. Initial program 97.7%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around 0 95.7%

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{2 + 2 \cdot z}{t \cdot z}} \]
    3. Taylor expanded in z around 0 95.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} + \left(2 \cdot \frac{1}{t} + \frac{\color{blue}{2}}{z} \cdot \frac{1}{t}\right) \]
      12. distribute-rgt-in95.7%

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

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

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{2 + \frac{2}{z}}}{t} \]
    5. Simplified95.8%

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

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

        \[\leadsto \color{blue}{\frac{\frac{2}{t}}{z}} \]
    8. Simplified77.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.25 \cdot 10^{+108}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;z \leq -2.15 \cdot 10^{-89}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{-119}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;z \leq 9.2 \cdot 10^{-40}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-11}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;z \leq 1.02 \cdot 10^{+214} \lor \neg \left(z \leq 4.5 \cdot 10^{+292}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \end{array} \]

Alternative 4: 75.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{2 + \frac{2}{z}}{t}\\ t_2 := \frac{x}{y} + \frac{2}{t}\\ t_3 := \frac{x}{y} - 2\\ \mathbf{if}\;t \leq -1.5 \cdot 10^{+19}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq -5.4 \cdot 10^{-57}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -1.44 \cdot 10^{-157}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 1.3 \cdot 10^{-276}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 5.3 \cdot 10^{-96}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 1.45 \cdot 10^{-16}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (+ 2.0 (/ 2.0 z)) t))
        (t_2 (+ (/ x y) (/ 2.0 t)))
        (t_3 (- (/ x y) 2.0)))
   (if (<= t -1.5e+19)
     t_3
     (if (<= t -5.4e-57)
       t_1
       (if (<= t -1.44e-157)
         t_2
         (if (<= t 1.3e-276)
           t_1
           (if (<= t 5.3e-96) t_2 (if (<= t 1.45e-16) t_1 t_3))))))))
double code(double x, double y, double z, double t) {
	double t_1 = (2.0 + (2.0 / z)) / t;
	double t_2 = (x / y) + (2.0 / t);
	double t_3 = (x / y) - 2.0;
	double tmp;
	if (t <= -1.5e+19) {
		tmp = t_3;
	} else if (t <= -5.4e-57) {
		tmp = t_1;
	} else if (t <= -1.44e-157) {
		tmp = t_2;
	} else if (t <= 1.3e-276) {
		tmp = t_1;
	} else if (t <= 5.3e-96) {
		tmp = t_2;
	} else if (t <= 1.45e-16) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	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) :: t_3
    real(8) :: tmp
    t_1 = (2.0d0 + (2.0d0 / z)) / t
    t_2 = (x / y) + (2.0d0 / t)
    t_3 = (x / y) - 2.0d0
    if (t <= (-1.5d+19)) then
        tmp = t_3
    else if (t <= (-5.4d-57)) then
        tmp = t_1
    else if (t <= (-1.44d-157)) then
        tmp = t_2
    else if (t <= 1.3d-276) then
        tmp = t_1
    else if (t <= 5.3d-96) then
        tmp = t_2
    else if (t <= 1.45d-16) then
        tmp = t_1
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (2.0 + (2.0 / z)) / t;
	double t_2 = (x / y) + (2.0 / t);
	double t_3 = (x / y) - 2.0;
	double tmp;
	if (t <= -1.5e+19) {
		tmp = t_3;
	} else if (t <= -5.4e-57) {
		tmp = t_1;
	} else if (t <= -1.44e-157) {
		tmp = t_2;
	} else if (t <= 1.3e-276) {
		tmp = t_1;
	} else if (t <= 5.3e-96) {
		tmp = t_2;
	} else if (t <= 1.45e-16) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (2.0 + (2.0 / z)) / t
	t_2 = (x / y) + (2.0 / t)
	t_3 = (x / y) - 2.0
	tmp = 0
	if t <= -1.5e+19:
		tmp = t_3
	elif t <= -5.4e-57:
		tmp = t_1
	elif t <= -1.44e-157:
		tmp = t_2
	elif t <= 1.3e-276:
		tmp = t_1
	elif t <= 5.3e-96:
		tmp = t_2
	elif t <= 1.45e-16:
		tmp = t_1
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(2.0 + Float64(2.0 / z)) / t)
	t_2 = Float64(Float64(x / y) + Float64(2.0 / t))
	t_3 = Float64(Float64(x / y) - 2.0)
	tmp = 0.0
	if (t <= -1.5e+19)
		tmp = t_3;
	elseif (t <= -5.4e-57)
		tmp = t_1;
	elseif (t <= -1.44e-157)
		tmp = t_2;
	elseif (t <= 1.3e-276)
		tmp = t_1;
	elseif (t <= 5.3e-96)
		tmp = t_2;
	elseif (t <= 1.45e-16)
		tmp = t_1;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (2.0 + (2.0 / z)) / t;
	t_2 = (x / y) + (2.0 / t);
	t_3 = (x / y) - 2.0;
	tmp = 0.0;
	if (t <= -1.5e+19)
		tmp = t_3;
	elseif (t <= -5.4e-57)
		tmp = t_1;
	elseif (t <= -1.44e-157)
		tmp = t_2;
	elseif (t <= 1.3e-276)
		tmp = t_1;
	elseif (t <= 5.3e-96)
		tmp = t_2;
	elseif (t <= 1.45e-16)
		tmp = t_1;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[t, -1.5e+19], t$95$3, If[LessEqual[t, -5.4e-57], t$95$1, If[LessEqual[t, -1.44e-157], t$95$2, If[LessEqual[t, 1.3e-276], t$95$1, If[LessEqual[t, 5.3e-96], t$95$2, If[LessEqual[t, 1.45e-16], t$95$1, t$95$3]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq -5.4 \cdot 10^{-57}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq -1.44 \cdot 10^{-157}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t \leq 1.3 \cdot 10^{-276}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 5.3 \cdot 10^{-96}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t \leq 1.45 \cdot 10^{-16}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.5e19 or 1.4499999999999999e-16 < t

    1. Initial program 78.6%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around inf 78.4%

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

    if -1.5e19 < t < -5.4000000000000004e-57 or -1.43999999999999996e-157 < t < 1.29999999999999992e-276 or 5.3000000000000001e-96 < t < 1.4499999999999999e-16

    1. Initial program 99.7%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around 0 91.0%

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

        \[\leadsto \frac{2 + \color{blue}{\frac{2 \cdot 1}{z}}}{t} \]
      2. metadata-eval91.0%

        \[\leadsto \frac{2 + \frac{\color{blue}{2}}{z}}{t} \]
    4. Simplified91.0%

      \[\leadsto \color{blue}{\frac{2 + \frac{2}{z}}{t}} \]

    if -5.4000000000000004e-57 < t < -1.43999999999999996e-157 or 1.29999999999999992e-276 < t < 5.3000000000000001e-96

    1. Initial program 96.1%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around 0 96.1%

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{2 + 2 \cdot z}{t \cdot z}} \]
    3. Taylor expanded in z around inf 80.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.5 \cdot 10^{+19}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;t \leq -5.4 \cdot 10^{-57}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{elif}\;t \leq -1.44 \cdot 10^{-157}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{elif}\;t \leq 1.3 \cdot 10^{-276}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{elif}\;t \leq 5.3 \cdot 10^{-96}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{elif}\;t \leq 1.45 \cdot 10^{-16}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]

Alternative 5: 84.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := -2 + \frac{\frac{2}{t}}{z}\\
t_2 := \frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{-89}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 7.9 \cdot 10^{-119}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;z \leq 8.5 \cdot 10^{-11}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.60000000000000007e-89 or 8.50000000000000037e-11 < z

    1. Initial program 81.5%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in z around inf 94.6%

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \frac{1 - t}{t}} \]
    3. Step-by-step derivation
      1. div-sub94.6%

        \[\leadsto \frac{x}{y} + 2 \cdot \color{blue}{\left(\frac{1}{t} - \frac{t}{t}\right)} \]
      2. sub-neg94.6%

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \left(\frac{1}{t} + -1\right)} \]
    5. Taylor expanded in x around 0 94.6%

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

        \[\leadsto \color{blue}{\frac{x}{y} + 2 \cdot \left(\frac{1}{t} - 1\right)} \]
      2. sub-neg94.6%

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

        \[\leadsto \frac{x}{y} + 2 \cdot \left(\frac{1}{t} + \color{blue}{-1}\right) \]
      4. distribute-lft-in94.6%

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

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

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

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

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

    if -3.60000000000000007e-89 < z < 7.9e-119 or 1.55e-43 < z < 8.50000000000000037e-11

    1. Initial program 97.7%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around inf 97.5%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{1}{t \cdot z} - 2} \]
    9. Step-by-step derivation
      1. sub-neg80.0%

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

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

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

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

        \[\leadsto \frac{\frac{2}{t}}{z} + \color{blue}{-2} \]
      6. +-commutative80.1%

        \[\leadsto \color{blue}{-2 + \frac{\frac{2}{t}}{z}} \]
    10. Simplified80.1%

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

    if 7.9e-119 < z < 1.55e-43

    1. Initial program 99.7%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around inf 82.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.6 \cdot 10^{-89}:\\ \;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\ \mathbf{elif}\;z \leq 7.9 \cdot 10^{-119}:\\ \;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-43}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-11}:\\ \;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\ \end{array} \]

Alternative 6: 74.1% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -4 \cdot 10^{+100} \lor \neg \left(\frac{x}{y} \leq 3.1 \cdot 10^{+46}\right):\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -4.00000000000000006e100 or 3.09999999999999975e46 < (/.f64 x y)

    1. Initial program 92.5%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around 0 98.1%

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{2 + 2 \cdot z}{t \cdot z}} \]
    3. Taylor expanded in z around inf 82.5%

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

    if -4.00000000000000006e100 < (/.f64 x y) < 3.09999999999999975e46

    1. Initial program 85.6%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around inf 61.1%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{1}{t \cdot z} - 2} \]
    9. Step-by-step derivation
      1. sub-neg71.4%

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

        \[\leadsto \color{blue}{\frac{2 \cdot 1}{t \cdot z}} + \left(-2\right) \]
      3. metadata-eval71.4%

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

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

        \[\leadsto \frac{\frac{2}{t}}{z} + \color{blue}{-2} \]
      6. +-commutative71.4%

        \[\leadsto \color{blue}{-2 + \frac{\frac{2}{t}}{z}} \]
    10. Simplified71.4%

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

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

Alternative 7: 98.3% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\

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


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

    1. Initial program 77.5%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in z around inf 99.3%

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \frac{1 - t}{t}} \]
    3. Step-by-step derivation
      1. div-sub99.3%

        \[\leadsto \frac{x}{y} + 2 \cdot \color{blue}{\left(\frac{1}{t} - \frac{t}{t}\right)} \]
      2. sub-neg99.3%

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \left(\frac{1}{t} + -1\right)} \]
    5. Taylor expanded in x around 0 99.3%

      \[\leadsto \color{blue}{2 \cdot \left(\frac{1}{t} - 1\right) + \frac{x}{y}} \]
    6. Step-by-step derivation
      1. +-commutative99.3%

        \[\leadsto \color{blue}{\frac{x}{y} + 2 \cdot \left(\frac{1}{t} - 1\right)} \]
      2. sub-neg99.3%

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

        \[\leadsto \frac{x}{y} + 2 \cdot \left(\frac{1}{t} + \color{blue}{-1}\right) \]
      4. distribute-lft-in99.3%

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

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

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

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

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

    if -1 < z < 1

    1. Initial program 98.3%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around inf 97.1%

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 98.0% accurate, 1.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -0.859999999999999987 or 8.49999999999999931e-30 < t

    1. Initial program 79.7%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around inf 78.4%

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

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

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

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

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

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

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

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

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

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

    if -0.859999999999999987 < t < 8.49999999999999931e-30

    1. Initial program 98.1%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around 0 98.1%

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{2 + 2 \cdot z}{t \cdot z}} \]
    3. Taylor expanded in z around 0 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 71.1% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.85 \cdot 10^{+100}:\\
\;\;\;\;\frac{x}{y}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 x y) < -1.8500000000000001e100

    1. Initial program 90.2%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in x around inf 74.2%

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

    if -1.8500000000000001e100 < (/.f64 x y) < 1.55999999999999998e47

    1. Initial program 85.6%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around inf 61.1%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{1}{t \cdot z} - 2} \]
    9. Step-by-step derivation
      1. sub-neg71.4%

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

        \[\leadsto \color{blue}{\frac{2 \cdot 1}{t \cdot z}} + \left(-2\right) \]
      3. metadata-eval71.4%

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

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

        \[\leadsto \frac{\frac{2}{t}}{z} + \color{blue}{-2} \]
      6. +-commutative71.4%

        \[\leadsto \color{blue}{-2 + \frac{\frac{2}{t}}{z}} \]
    10. Simplified71.4%

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

    if 1.55999999999999998e47 < (/.f64 x y)

    1. Initial program 94.6%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around inf 75.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1.85 \cdot 10^{+100}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 1.56 \cdot 10^{+47}:\\ \;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]

Alternative 10: 65.2% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5.5 \cdot 10^{+34} \lor \neg \left(\frac{x}{y} \leq 1300000\right):\\
\;\;\;\;\frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -5.4999999999999996e34 or 1.3e6 < (/.f64 x y)

    1. Initial program 91.1%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in x around inf 67.3%

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

    if -5.4999999999999996e34 < (/.f64 x y) < 1.3e6

    1. Initial program 85.9%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in z around inf 59.0%

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \frac{1 - t}{t}} \]
    3. Step-by-step derivation
      1. div-sub59.0%

        \[\leadsto \frac{x}{y} + 2 \cdot \color{blue}{\left(\frac{1}{t} - \frac{t}{t}\right)} \]
      2. sub-neg59.0%

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \left(\frac{1}{t} + -1\right)} \]
    5. Taylor expanded in x around 0 58.7%

      \[\leadsto \color{blue}{2 \cdot \left(\frac{1}{t} - 1\right)} \]
    6. Step-by-step derivation
      1. sub-neg58.7%

        \[\leadsto 2 \cdot \color{blue}{\left(\frac{1}{t} + \left(-1\right)\right)} \]
      2. metadata-eval58.7%

        \[\leadsto 2 \cdot \left(\frac{1}{t} + \color{blue}{-1}\right) \]
      3. distribute-lft-in58.7%

        \[\leadsto \color{blue}{2 \cdot \frac{1}{t} + 2 \cdot -1} \]
      4. associate-*r/58.7%

        \[\leadsto \color{blue}{\frac{2 \cdot 1}{t}} + 2 \cdot -1 \]
      5. metadata-eval58.7%

        \[\leadsto \frac{\color{blue}{2}}{t} + 2 \cdot -1 \]
      6. metadata-eval58.7%

        \[\leadsto \frac{2}{t} + \color{blue}{-2} \]
    7. Simplified58.7%

      \[\leadsto \color{blue}{\frac{2}{t} + -2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification62.9%

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

Alternative 11: 92.0% accurate, 1.3× speedup?

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

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

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


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

    1. Initial program 77.5%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in z around inf 99.3%

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \frac{1 - t}{t}} \]
    3. Step-by-step derivation
      1. div-sub99.3%

        \[\leadsto \frac{x}{y} + 2 \cdot \color{blue}{\left(\frac{1}{t} - \frac{t}{t}\right)} \]
      2. sub-neg99.3%

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \left(\frac{1}{t} + -1\right)} \]
    5. Taylor expanded in x around 0 99.3%

      \[\leadsto \color{blue}{2 \cdot \left(\frac{1}{t} - 1\right) + \frac{x}{y}} \]
    6. Step-by-step derivation
      1. +-commutative99.3%

        \[\leadsto \color{blue}{\frac{x}{y} + 2 \cdot \left(\frac{1}{t} - 1\right)} \]
      2. sub-neg99.3%

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

        \[\leadsto \frac{x}{y} + 2 \cdot \left(\frac{1}{t} + \color{blue}{-1}\right) \]
      4. distribute-lft-in99.3%

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

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

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

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

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

    if -0.115000000000000005 < z < 2.00000000000000016e-5

    1. Initial program 98.3%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in z around 0 91.4%

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

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

Alternative 12: 92.0% accurate, 1.3× speedup?

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

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

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


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

    1. Initial program 77.5%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in z around inf 99.3%

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \frac{1 - t}{t}} \]
    3. Step-by-step derivation
      1. div-sub99.3%

        \[\leadsto \frac{x}{y} + 2 \cdot \color{blue}{\left(\frac{1}{t} - \frac{t}{t}\right)} \]
      2. sub-neg99.3%

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \left(\frac{1}{t} + -1\right)} \]
    5. Taylor expanded in x around 0 99.3%

      \[\leadsto \color{blue}{2 \cdot \left(\frac{1}{t} - 1\right) + \frac{x}{y}} \]
    6. Step-by-step derivation
      1. +-commutative99.3%

        \[\leadsto \color{blue}{\frac{x}{y} + 2 \cdot \left(\frac{1}{t} - 1\right)} \]
      2. sub-neg99.3%

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

        \[\leadsto \frac{x}{y} + 2 \cdot \left(\frac{1}{t} + \color{blue}{-1}\right) \]
      4. distribute-lft-in99.3%

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

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

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

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

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

    if -0.110000000000000001 < z < 1.29999999999999992e-5

    1. Initial program 98.3%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in z around 0 91.4%

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

        \[\leadsto \frac{x}{y} + \color{blue}{\frac{\frac{2}{t}}{z}} \]
    4. Simplified91.4%

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

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

Alternative 13: 65.3% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.35 \cdot 10^{+35}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;\frac{x}{y} \leq 60000:\\
\;\;\;\;-2 + \frac{2}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 x y) < -1.35000000000000001e35

    1. Initial program 88.2%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in x around inf 68.2%

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

    if -1.35000000000000001e35 < (/.f64 x y) < 6e4

    1. Initial program 85.9%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in z around inf 59.0%

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \frac{1 - t}{t}} \]
    3. Step-by-step derivation
      1. div-sub59.0%

        \[\leadsto \frac{x}{y} + 2 \cdot \color{blue}{\left(\frac{1}{t} - \frac{t}{t}\right)} \]
      2. sub-neg59.0%

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \left(\frac{1}{t} + -1\right)} \]
    5. Taylor expanded in x around 0 58.7%

      \[\leadsto \color{blue}{2 \cdot \left(\frac{1}{t} - 1\right)} \]
    6. Step-by-step derivation
      1. sub-neg58.7%

        \[\leadsto 2 \cdot \color{blue}{\left(\frac{1}{t} + \left(-1\right)\right)} \]
      2. metadata-eval58.7%

        \[\leadsto 2 \cdot \left(\frac{1}{t} + \color{blue}{-1}\right) \]
      3. distribute-lft-in58.7%

        \[\leadsto \color{blue}{2 \cdot \frac{1}{t} + 2 \cdot -1} \]
      4. associate-*r/58.7%

        \[\leadsto \color{blue}{\frac{2 \cdot 1}{t}} + 2 \cdot -1 \]
      5. metadata-eval58.7%

        \[\leadsto \frac{\color{blue}{2}}{t} + 2 \cdot -1 \]
      6. metadata-eval58.7%

        \[\leadsto \frac{2}{t} + \color{blue}{-2} \]
    7. Simplified58.7%

      \[\leadsto \color{blue}{\frac{2}{t} + -2} \]

    if 6e4 < (/.f64 x y)

    1. Initial program 93.8%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around inf 66.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1.35 \cdot 10^{+35}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 60000:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]

Alternative 14: 47.3% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.2 \cdot 10^{+41} \lor \neg \left(\frac{x}{y} \leq 11500000\right):\\
\;\;\;\;\frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{2}{t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -1.2000000000000001e41 or 1.15e7 < (/.f64 x y)

    1. Initial program 91.1%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in x around inf 67.3%

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

    if -1.2000000000000001e41 < (/.f64 x y) < 1.15e7

    1. Initial program 85.9%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in z around inf 59.0%

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \frac{1 - t}{t}} \]
    3. Step-by-step derivation
      1. div-sub59.0%

        \[\leadsto \frac{x}{y} + 2 \cdot \color{blue}{\left(\frac{1}{t} - \frac{t}{t}\right)} \]
      2. sub-neg59.0%

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \left(\frac{1}{t} + -1\right)} \]
    5. Taylor expanded in t around 0 27.3%

      \[\leadsto \color{blue}{\frac{2}{t}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification47.0%

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

Alternative 15: 19.4% accurate, 5.7× speedup?

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

\\
\frac{2}{t}
\end{array}
Derivation
  1. Initial program 88.5%

    \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
  2. Taylor expanded in z around inf 67.4%

    \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \frac{1 - t}{t}} \]
  3. Step-by-step derivation
    1. div-sub67.4%

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

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

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

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

    \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \left(\frac{1}{t} + -1\right)} \]
  5. Taylor expanded in t around 0 19.0%

    \[\leadsto \color{blue}{\frac{2}{t}} \]
  6. Final simplification19.0%

    \[\leadsto \frac{2}{t} \]

Developer target: 99.1% accurate, 1.3× speedup?

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

\\
\frac{\frac{2}{z} + 2}{t} - \left(2 - \frac{x}{y}\right)
\end{array}

Reproduce

?
herbie shell --seed 2023308 
(FPCore (x y z t)
  :name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
  :precision binary64

  :herbie-target
  (- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y)))

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