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

Percentage Accurate: 86.5% → 99.5%
Time: 10.2s
Alternatives: 15
Speedup: 0.7×

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.5% 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.5% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \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:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (+ (/ x y) (/ (+ 2.0 (* (* 2.0 z) (- 1.0 t))) (* z t))) INFINITY)
   (fma (fma z (- 1.0 t) 1.0) (/ 2.0 (* z t)) (/ x y))
   (- (/ x y) 2.0)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x / y) + ((2.0 + ((2.0 * z) * (1.0 - t))) / (z * t))) <= ((double) INFINITY)) {
		tmp = fma(fma(z, (1.0 - t), 1.0), (2.0 / (z * t)), (x / y));
	} else {
		tmp = (x / y) - 2.0;
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(2.0 * z) * Float64(1.0 - t))) / Float64(z * t))) <= Inf)
		tmp = fma(fma(z, Float64(1.0 - t), 1.0), Float64(2.0 / Float64(z * t)), Float64(x / y));
	else
		tmp = Float64(Float64(x / y) - 2.0);
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[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], Infinity], N[(N[(z * N[(1.0 - t), $MachinePrecision] + 1.0), $MachinePrecision] * N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]
\begin{array}{l}

\\
\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:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \frac{x}{y}\right)\\

\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 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z))) < +inf.0

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(1 - t\right) \cdot z + 1, \frac{2}{t \cdot z}, -\frac{-x}{y}\right)} \]
      10. *-commutative99.7%

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(z, 1 - t, 1\right)}, \frac{2}{t \cdot z}, -\frac{-x}{y}\right) \]
      12. *-commutative99.7%

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{\color{blue}{z \cdot t}}, -\frac{-x}{y}\right) \]
      13. distribute-frac-neg99.7%

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, -\color{blue}{\left(-\frac{x}{y}\right)}\right) \]
      14. remove-double-neg99.7%

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

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

    if +inf.0 < (+.f64 (/.f64 x y) (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) 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. Add Preprocessing
    3. 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:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 99.5% accurate, 0.4× 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 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z))) < +inf.0

    1. Initial program 99.3%

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

    if +inf.0 < (+.f64 (/.f64 x y) (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) 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. Add Preprocessing
    3. 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.4%

    \[\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} \]
  5. Add Preprocessing

Alternative 3: 51.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -8 \cdot 10^{+49}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -2.15 \cdot 10^{-47}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 2.5 \cdot 10^{-214}:\\ \;\;\;\;-2\\ \mathbf{elif}\;\frac{x}{y} \leq 6.6 \cdot 10^{+25}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (/ x y) -8e+49)
   (/ x y)
   (if (<= (/ x y) -2.15e-47)
     (/ 2.0 t)
     (if (<= (/ x y) 2.5e-214)
       -2.0
       (if (<= (/ x y) 6.6e+25) (/ 2.0 t) (/ x y))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x / y) <= -8e+49) {
		tmp = x / y;
	} else if ((x / y) <= -2.15e-47) {
		tmp = 2.0 / t;
	} else if ((x / y) <= 2.5e-214) {
		tmp = -2.0;
	} else if ((x / y) <= 6.6e+25) {
		tmp = 2.0 / t;
	} else {
		tmp = x / y;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((x / y) <= (-8d+49)) then
        tmp = x / y
    else if ((x / y) <= (-2.15d-47)) then
        tmp = 2.0d0 / t
    else if ((x / y) <= 2.5d-214) then
        tmp = -2.0d0
    else if ((x / y) <= 6.6d+25) then
        tmp = 2.0d0 / t
    else
        tmp = x / y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((x / y) <= -8e+49) {
		tmp = x / y;
	} else if ((x / y) <= -2.15e-47) {
		tmp = 2.0 / t;
	} else if ((x / y) <= 2.5e-214) {
		tmp = -2.0;
	} else if ((x / y) <= 6.6e+25) {
		tmp = 2.0 / t;
	} else {
		tmp = x / y;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x / y) <= -8e+49:
		tmp = x / y
	elif (x / y) <= -2.15e-47:
		tmp = 2.0 / t
	elif (x / y) <= 2.5e-214:
		tmp = -2.0
	elif (x / y) <= 6.6e+25:
		tmp = 2.0 / t
	else:
		tmp = x / y
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(x / y) <= -8e+49)
		tmp = Float64(x / y);
	elseif (Float64(x / y) <= -2.15e-47)
		tmp = Float64(2.0 / t);
	elseif (Float64(x / y) <= 2.5e-214)
		tmp = -2.0;
	elseif (Float64(x / y) <= 6.6e+25)
		tmp = Float64(2.0 / t);
	else
		tmp = Float64(x / y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x / y) <= -8e+49)
		tmp = x / y;
	elseif ((x / y) <= -2.15e-47)
		tmp = 2.0 / t;
	elseif ((x / y) <= 2.5e-214)
		tmp = -2.0;
	elseif ((x / y) <= 6.6e+25)
		tmp = 2.0 / t;
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -8e+49], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -2.15e-47], N[(2.0 / t), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2.5e-214], -2.0, If[LessEqual[N[(x / y), $MachinePrecision], 6.6e+25], N[(2.0 / t), $MachinePrecision], N[(x / y), $MachinePrecision]]]]]
\begin{array}{l}

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 x y) < -7.99999999999999957e49 or 6.6000000000000002e25 < (/.f64 x y)

    1. Initial program 88.7%

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

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

    if -7.99999999999999957e49 < (/.f64 x y) < -2.1499999999999999e-47 or 2.4999999999999999e-214 < (/.f64 x y) < 6.6000000000000002e25

    1. Initial program 91.8%

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

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

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

        \[\leadsto \frac{2 + \frac{\color{blue}{2}}{z}}{t} \]
    5. Simplified78.6%

      \[\leadsto \color{blue}{\frac{2 + \frac{2}{z}}{t}} \]
    6. Taylor expanded in z around inf 38.3%

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

    if -2.1499999999999999e-47 < (/.f64 x y) < 2.4999999999999999e-214

    1. Initial program 85.8%

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

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

      \[\leadsto \color{blue}{-2} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 92.4% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{+56} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{+16}\right):\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\

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


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

    1. Initial program 87.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} + \left(\frac{\color{blue}{2}}{t} + -2\right) \]
    5. Simplified93.9%

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

    if -4.9999999999999999e119 < (/.f64 x y) < -1.00000000000000009e56 or 5e16 < (/.f64 x y)

    1. Initial program 88.9%

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

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

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

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

    if -1.00000000000000009e56 < (/.f64 x y) < 5e16

    1. Initial program 88.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \left(\frac{1}{t} \cdot 2 + \frac{1}{t} \cdot \color{blue}{\left(2 \cdot \frac{1}{z}\right)}\right) \]
      11. distribute-lft-in97.6%

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

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

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

        \[\leadsto -2 + \color{blue}{\frac{1 \cdot \left(2 + \frac{2}{z}\right)}{t}} \]
      15. *-lft-identity97.7%

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

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

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

Alternative 5: 92.4% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{+56} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{+16}\right):\\
\;\;\;\;\frac{x}{y} + \frac{2}{z \cdot t}\\

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


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

    1. Initial program 87.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} + \left(\frac{\color{blue}{2}}{t} + -2\right) \]
    5. Simplified93.9%

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

    if -4.9999999999999999e119 < (/.f64 x y) < -1.00000000000000009e56 or 5e16 < (/.f64 x y)

    1. Initial program 88.9%

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

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

    if -1.00000000000000009e56 < (/.f64 x y) < 5e16

    1. Initial program 88.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \left(\frac{1}{t} \cdot 2 + \frac{1}{t} \cdot \color{blue}{\left(2 \cdot \frac{1}{z}\right)}\right) \]
      11. distribute-lft-in97.6%

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

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

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

        \[\leadsto -2 + \color{blue}{\frac{1 \cdot \left(2 + \frac{2}{z}\right)}{t}} \]
      15. *-lft-identity97.7%

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

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

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

Alternative 6: 75.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -2 \cdot 10^{+200}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq -1.28 \cdot 10^{+23}:\\
\;\;\;\;-2 + \frac{2}{z \cdot t}\\

\mathbf{elif}\;t \leq -1.6 \cdot 10^{-72} \lor \neg \left(t \leq 5.8 \cdot 10^{-48}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.9999999999999999e200 or -1.28e23 < t < -1.6e-72 or 5.8000000000000006e-48 < t

    1. Initial program 79.1%

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

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

    if -1.9999999999999999e200 < t < -1.28e23

    1. Initial program 82.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{2}{t \cdot z}} + -2 \]
    10. Step-by-step derivation
      1. *-commutative75.0%

        \[\leadsto \frac{2}{\color{blue}{z \cdot t}} + -2 \]
    11. Simplified75.0%

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

    if -1.6e-72 < t < 5.8000000000000006e-48

    1. Initial program 98.9%

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

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

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

        \[\leadsto \frac{2 + \frac{\color{blue}{2}}{z}}{t} \]
    5. Simplified87.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2 \cdot 10^{+200}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;t \leq -1.28 \cdot 10^{+23}:\\ \;\;\;\;-2 + \frac{2}{z \cdot t}\\ \mathbf{elif}\;t \leq -1.6 \cdot 10^{-72} \lor \neg \left(t \leq 5.8 \cdot 10^{-48}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 67.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{2}{t} + -2\\ t_2 := \frac{x}{y} - 2\\ \mathbf{if}\;z \leq -1.46 \cdot 10^{+96}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq -1:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.46 \cdot 10^{-38}:\\ \;\;\;\;-2 + \frac{2}{z \cdot t}\\ \mathbf{elif}\;z \leq 9 \cdot 10^{+193}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ (/ 2.0 t) -2.0)) (t_2 (- (/ x y) 2.0)))
   (if (<= z -1.46e+96)
     t_2
     (if (<= z -1.0)
       t_1
       (if (<= z 1.46e-38)
         (+ -2.0 (/ 2.0 (* z t)))
         (if (<= z 9e+193) t_2 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = (2.0 / t) + -2.0;
	double t_2 = (x / y) - 2.0;
	double tmp;
	if (z <= -1.46e+96) {
		tmp = t_2;
	} else if (z <= -1.0) {
		tmp = t_1;
	} else if (z <= 1.46e-38) {
		tmp = -2.0 + (2.0 / (z * t));
	} else if (z <= 9e+193) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (2.0d0 / t) + (-2.0d0)
    t_2 = (x / y) - 2.0d0
    if (z <= (-1.46d+96)) then
        tmp = t_2
    else if (z <= (-1.0d0)) then
        tmp = t_1
    else if (z <= 1.46d-38) then
        tmp = (-2.0d0) + (2.0d0 / (z * t))
    else if (z <= 9d+193) then
        tmp = t_2
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (2.0 / t) + -2.0;
	double t_2 = (x / y) - 2.0;
	double tmp;
	if (z <= -1.46e+96) {
		tmp = t_2;
	} else if (z <= -1.0) {
		tmp = t_1;
	} else if (z <= 1.46e-38) {
		tmp = -2.0 + (2.0 / (z * t));
	} else if (z <= 9e+193) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (2.0 / t) + -2.0
	t_2 = (x / y) - 2.0
	tmp = 0
	if z <= -1.46e+96:
		tmp = t_2
	elif z <= -1.0:
		tmp = t_1
	elif z <= 1.46e-38:
		tmp = -2.0 + (2.0 / (z * t))
	elif z <= 9e+193:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(2.0 / t) + -2.0)
	t_2 = Float64(Float64(x / y) - 2.0)
	tmp = 0.0
	if (z <= -1.46e+96)
		tmp = t_2;
	elseif (z <= -1.0)
		tmp = t_1;
	elseif (z <= 1.46e-38)
		tmp = Float64(-2.0 + Float64(2.0 / Float64(z * t)));
	elseif (z <= 9e+193)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (2.0 / t) + -2.0;
	t_2 = (x / y) - 2.0;
	tmp = 0.0;
	if (z <= -1.46e+96)
		tmp = t_2;
	elseif (z <= -1.0)
		tmp = t_1;
	elseif (z <= 1.46e-38)
		tmp = -2.0 + (2.0 / (z * t));
	elseif (z <= 9e+193)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[z, -1.46e+96], t$95$2, If[LessEqual[z, -1.0], t$95$1, If[LessEqual[z, 1.46e-38], N[(-2.0 + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9e+193], t$95$2, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 1.46 \cdot 10^{-38}:\\
\;\;\;\;-2 + \frac{2}{z \cdot t}\\

\mathbf{elif}\;z \leq 9 \cdot 10^{+193}:\\
\;\;\;\;t\_2\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.4600000000000001e96 or 1.4599999999999999e-38 < z < 8.99999999999999999e193

    1. Initial program 81.6%

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

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

    if -1.4600000000000001e96 < z < -1 or 8.99999999999999999e193 < z

    1. Initial program 75.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \left(\frac{1}{t} \cdot 2 + \color{blue}{\frac{2 \cdot \frac{1}{t}}{z}}\right) \]
      7. *-commutative72.0%

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

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

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

        \[\leadsto -2 + \left(\frac{1}{t} \cdot 2 + \frac{1}{t} \cdot \color{blue}{\left(2 \cdot \frac{1}{z}\right)}\right) \]
      11. distribute-lft-in72.0%

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

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

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

        \[\leadsto -2 + \color{blue}{\frac{1 \cdot \left(2 + \frac{2}{z}\right)}{t}} \]
      15. *-lft-identity72.1%

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

      \[\leadsto \color{blue}{-2 + \frac{2 + \frac{2}{z}}{t}} \]
    9. Taylor expanded in z around inf 70.0%

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

    if -1 < z < 1.4599999999999999e-38

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{2}{t} + \frac{\color{blue}{2}}{t \cdot z}\right) + \left(-2\right) \]
      6. +-commutative82.2%

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

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

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

      \[\leadsto \color{blue}{\frac{2}{t \cdot z}} + -2 \]
    10. Step-by-step derivation
      1. *-commutative82.2%

        \[\leadsto \frac{2}{\color{blue}{z \cdot t}} + -2 \]
    11. Simplified82.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.46 \cdot 10^{+96}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq -1:\\ \;\;\;\;\frac{2}{t} + -2\\ \mathbf{elif}\;z \leq 1.46 \cdot 10^{-38}:\\ \;\;\;\;-2 + \frac{2}{z \cdot t}\\ \mathbf{elif}\;z \leq 9 \cdot 10^{+193}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t} + -2\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 61.9% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;z \leq -9 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 7.3 \cdot 10^{-41}:\\
\;\;\;\;\frac{\frac{2}{t}}{z}\\

\mathbf{elif}\;z \leq 6.1 \cdot 10^{+193}:\\
\;\;\;\;t\_2\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.25000000000000005e92 or 7.30000000000000026e-41 < z < 6.1000000000000003e193

    1. Initial program 81.6%

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

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

    if -1.25000000000000005e92 < z < -9e-13 or 6.1000000000000003e193 < z

    1. Initial program 75.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \left(\frac{1}{t} \cdot 2 + \color{blue}{\frac{2 \cdot \frac{1}{t}}{z}}\right) \]
      7. *-commutative72.0%

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

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

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

        \[\leadsto -2 + \left(\frac{1}{t} \cdot 2 + \frac{1}{t} \cdot \color{blue}{\left(2 \cdot \frac{1}{z}\right)}\right) \]
      11. distribute-lft-in72.0%

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

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

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

        \[\leadsto -2 + \color{blue}{\frac{1 \cdot \left(2 + \frac{2}{z}\right)}{t}} \]
      15. *-lft-identity72.1%

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

      \[\leadsto \color{blue}{-2 + \frac{2 + \frac{2}{z}}{t}} \]
    9. Taylor expanded in z around inf 70.0%

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

    if -9e-13 < z < 7.30000000000000026e-41

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\frac{\frac{2}{t \cdot x}}{z}} \]
    9. Taylor expanded in x around 0 71.9%

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

        \[\leadsto \color{blue}{\frac{\frac{2}{t}}{z}} \]
    11. Simplified72.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.25 \cdot 10^{+92}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq -9 \cdot 10^{-13}:\\ \;\;\;\;\frac{2}{t} + -2\\ \mathbf{elif}\;z \leq 7.3 \cdot 10^{-41}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;z \leq 6.1 \cdot 10^{+193}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t} + -2\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 61.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{2}{t} + -2\\ t_2 := \frac{x}{y} - 2\\ \mathbf{if}\;z \leq -3.3 \cdot 10^{+96}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq -1.3 \cdot 10^{-11}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.76 \cdot 10^{-40}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{+193}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ (/ 2.0 t) -2.0)) (t_2 (- (/ x y) 2.0)))
   (if (<= z -3.3e+96)
     t_2
     (if (<= z -1.3e-11)
       t_1
       (if (<= z 1.76e-40) (/ 2.0 (* z t)) (if (<= z 5.6e+193) t_2 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = (2.0 / t) + -2.0;
	double t_2 = (x / y) - 2.0;
	double tmp;
	if (z <= -3.3e+96) {
		tmp = t_2;
	} else if (z <= -1.3e-11) {
		tmp = t_1;
	} else if (z <= 1.76e-40) {
		tmp = 2.0 / (z * t);
	} else if (z <= 5.6e+193) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (2.0d0 / t) + (-2.0d0)
    t_2 = (x / y) - 2.0d0
    if (z <= (-3.3d+96)) then
        tmp = t_2
    else if (z <= (-1.3d-11)) then
        tmp = t_1
    else if (z <= 1.76d-40) then
        tmp = 2.0d0 / (z * t)
    else if (z <= 5.6d+193) then
        tmp = t_2
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (2.0 / t) + -2.0;
	double t_2 = (x / y) - 2.0;
	double tmp;
	if (z <= -3.3e+96) {
		tmp = t_2;
	} else if (z <= -1.3e-11) {
		tmp = t_1;
	} else if (z <= 1.76e-40) {
		tmp = 2.0 / (z * t);
	} else if (z <= 5.6e+193) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (2.0 / t) + -2.0
	t_2 = (x / y) - 2.0
	tmp = 0
	if z <= -3.3e+96:
		tmp = t_2
	elif z <= -1.3e-11:
		tmp = t_1
	elif z <= 1.76e-40:
		tmp = 2.0 / (z * t)
	elif z <= 5.6e+193:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(2.0 / t) + -2.0)
	t_2 = Float64(Float64(x / y) - 2.0)
	tmp = 0.0
	if (z <= -3.3e+96)
		tmp = t_2;
	elseif (z <= -1.3e-11)
		tmp = t_1;
	elseif (z <= 1.76e-40)
		tmp = Float64(2.0 / Float64(z * t));
	elseif (z <= 5.6e+193)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (2.0 / t) + -2.0;
	t_2 = (x / y) - 2.0;
	tmp = 0.0;
	if (z <= -3.3e+96)
		tmp = t_2;
	elseif (z <= -1.3e-11)
		tmp = t_1;
	elseif (z <= 1.76e-40)
		tmp = 2.0 / (z * t);
	elseif (z <= 5.6e+193)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[z, -3.3e+96], t$95$2, If[LessEqual[z, -1.3e-11], t$95$1, If[LessEqual[z, 1.76e-40], N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.6e+193], t$95$2, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.3 \cdot 10^{-11}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 1.76 \cdot 10^{-40}:\\
\;\;\;\;\frac{2}{z \cdot t}\\

\mathbf{elif}\;z \leq 5.6 \cdot 10^{+193}:\\
\;\;\;\;t\_2\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.29999999999999984e96 or 1.76e-40 < z < 5.59999999999999972e193

    1. Initial program 81.6%

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

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

    if -3.29999999999999984e96 < z < -1.3e-11 or 5.59999999999999972e193 < z

    1. Initial program 75.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \left(\frac{1}{t} \cdot 2 + \color{blue}{\frac{2 \cdot \frac{1}{t}}{z}}\right) \]
      7. *-commutative72.0%

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

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

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

        \[\leadsto -2 + \left(\frac{1}{t} \cdot 2 + \frac{1}{t} \cdot \color{blue}{\left(2 \cdot \frac{1}{z}\right)}\right) \]
      11. distribute-lft-in72.0%

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

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

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

        \[\leadsto -2 + \color{blue}{\frac{1 \cdot \left(2 + \frac{2}{z}\right)}{t}} \]
      15. *-lft-identity72.1%

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

      \[\leadsto \color{blue}{-2 + \frac{2 + \frac{2}{z}}{t}} \]
    9. Taylor expanded in z around inf 70.0%

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

    if -1.3e-11 < z < 1.76e-40

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.3 \cdot 10^{+96}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq -1.3 \cdot 10^{-11}:\\ \;\;\;\;\frac{2}{t} + -2\\ \mathbf{elif}\;z \leq 1.76 \cdot 10^{-40}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{+193}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t} + -2\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 87.0% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -4.9999999999999999e119 or 1.0000000000000001e130 < (/.f64 x y)

    1. Initial program 90.1%

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999999e119 < (/.f64 x y) < 1.0000000000000001e130

    1. Initial program 87.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\frac{2 \cdot \left(\frac{1}{t} + \color{blue}{-1}\right)}{x} + \left(\frac{1}{y} + \frac{2}{t \cdot \left(x \cdot z\right)}\right)\right) \]
      9. distribute-lft-in74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \left(\frac{1}{t} \cdot 2 + \frac{1}{t} \cdot \color{blue}{\left(2 \cdot \frac{1}{z}\right)}\right) \]
      11. distribute-lft-in91.6%

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

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

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

        \[\leadsto -2 + \color{blue}{\frac{1 \cdot \left(2 + \frac{2}{z}\right)}{t}} \]
      15. *-lft-identity91.7%

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

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

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

Alternative 11: 84.5% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -5.00000000000000049e198 or 1.0000000000000001e130 < (/.f64 x y)

    1. Initial program 90.2%

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

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

    if -5.00000000000000049e198 < (/.f64 x y) < 1.0000000000000001e130

    1. Initial program 88.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \left(\frac{1}{t} \cdot 2 + \frac{1}{t} \cdot \color{blue}{\left(2 \cdot \frac{1}{z}\right)}\right) \]
      11. distribute-lft-in89.6%

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

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

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

        \[\leadsto -2 + \color{blue}{\frac{1 \cdot \left(2 + \frac{2}{z}\right)}{t}} \]
      15. *-lft-identity89.7%

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

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

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

Alternative 12: 65.6% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -8.5 \cdot 10^{+49} \lor \neg \left(\frac{x}{y} \leq 1.05 \cdot 10^{+28}\right):\\
\;\;\;\;\frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -8.4999999999999996e49 or 1.04999999999999995e28 < (/.f64 x y)

    1. Initial program 88.7%

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

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

    if -8.4999999999999996e49 < (/.f64 x y) < 1.04999999999999995e28

    1. Initial program 88.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \left(\frac{1}{t} \cdot 2 + \frac{1}{t} \cdot \color{blue}{\left(2 \cdot \frac{1}{z}\right)}\right) \]
      11. distribute-lft-in97.6%

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

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

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

        \[\leadsto -2 + \color{blue}{\frac{1 \cdot \left(2 + \frac{2}{z}\right)}{t}} \]
      15. *-lft-identity97.7%

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

      \[\leadsto \color{blue}{-2 + \frac{2 + \frac{2}{z}}{t}} \]
    9. Taylor expanded in z around inf 57.2%

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

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

Alternative 13: 66.0% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 88.1%

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

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

    if -7.8000000000000002e49 < (/.f64 x y) < 0.71999999999999997

    1. Initial program 88.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \frac{\color{blue}{2 + \frac{2}{z}}}{t} \]
    8. Simplified98.3%

      \[\leadsto \color{blue}{-2 + \frac{2 + \frac{2}{z}}{t}} \]
    9. Taylor expanded in z around inf 58.7%

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

    if 0.71999999999999997 < (/.f64 x y)

    1. Initial program 88.4%

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

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

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

Alternative 14: 36.9% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -19000000:\\
\;\;\;\;-2\\

\mathbf{elif}\;t \leq 3.2 \cdot 10^{+14}:\\
\;\;\;\;\frac{2}{t}\\

\mathbf{else}:\\
\;\;\;\;-2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.9e7 or 3.2e14 < t

    1. Initial program 75.5%

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

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

      \[\leadsto \color{blue}{-2} \]

    if -1.9e7 < t < 3.2e14

    1. Initial program 99.0%

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

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

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

        \[\leadsto \frac{2 + \frac{\color{blue}{2}}{z}}{t} \]
    5. Simplified78.6%

      \[\leadsto \color{blue}{\frac{2 + \frac{2}{z}}{t}} \]
    6. Taylor expanded in z around inf 35.0%

      \[\leadsto \color{blue}{\frac{2}{t}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 15: 21.1% accurate, 17.0× speedup?

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

\\
-2
\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. Add Preprocessing
  3. Taylor expanded in t around inf 47.7%

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

    \[\leadsto \color{blue}{-2} \]
  5. Add Preprocessing

Developer target: 99.3% 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 2024087 
(FPCore (x y z t)
  :name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
  :precision binary64

  :alt
  (- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y)))

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