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

Percentage Accurate: 86.7% → 99.3%
Time: 14.6s
Alternatives: 17
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 17 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.7% 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.3% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} + \frac{2 + \left(1 - t\right) \cdot \left(2 \cdot z\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 (* (- 1.0 t) (* 2.0 z))) (* 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 + ((1.0 - t) * (2.0 * z))) / (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(1.0 - t) * Float64(2.0 * z))) / 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[(1.0 - t), $MachinePrecision] * N[(2.0 * z), $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(1 - t\right) \cdot \left(2 \cdot z\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.4%

      \[\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.4%

        \[\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.4%

        \[\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.4%

        \[\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.4%

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

        \[\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.4%

        \[\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.4%

        \[\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(1 - t\right) \cdot \left(2 \cdot z\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.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} + \frac{2 + \left(1 - t\right) \cdot \left(2 \cdot z\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 (* (- 1.0 t) (* 2.0 z))) (* 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 + ((1.0 - t) * (2.0 * z))) / (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 + ((1.0 - t) * (2.0 * z))) / (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 + ((1.0 - t) * (2.0 * z))) / (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(1.0 - t) * Float64(2.0 * z))) / 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 + ((1.0 - t) * (2.0 * z))) / (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[(1.0 - t), $MachinePrecision] * N[(2.0 * z), $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(1 - t\right) \cdot \left(2 \cdot z\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.4%

      \[\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.5%

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

Alternative 3: 65.2% accurate, 0.7× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 x y) < -5e16

    1. Initial program 82.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 72.3%

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

    if -5e16 < (/.f64 x y) < 5.00000000000000015e-54

    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 z around inf 61.5%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{1}{t} - 2} \]
    7. Step-by-step derivation
      1. sub-neg60.8%

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

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

        \[\leadsto \color{blue}{\frac{2 \cdot 1}{t}} + -2 \]
      4. metadata-eval60.8%

        \[\leadsto \frac{\color{blue}{2}}{t} + -2 \]
      5. +-commutative60.8%

        \[\leadsto \color{blue}{-2 + \frac{2}{t}} \]
      6. metadata-eval60.8%

        \[\leadsto -2 + \frac{\color{blue}{--2}}{t} \]
      7. distribute-neg-frac60.8%

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

        \[\leadsto \color{blue}{-2 - \frac{-2}{t}} \]
    8. Simplified60.8%

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

    if 5.00000000000000015e-54 < (/.f64 x y) < 9.9999999999999998e-17

    1. Initial program 99.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 z around 0 80.0%

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

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

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

    if 9.9999999999999998e-17 < (/.f64 x y)

    1. Initial program 85.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 77.6%

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

Alternative 4: 65.2% accurate, 0.7× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 x y) < -5e16

    1. Initial program 82.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 72.3%

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

    if -5e16 < (/.f64 x y) < 5.00000000000000015e-54

    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 z around inf 61.5%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{1}{t} - 2} \]
    7. Step-by-step derivation
      1. sub-neg60.8%

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

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

        \[\leadsto \color{blue}{\frac{2 \cdot 1}{t}} + -2 \]
      4. metadata-eval60.8%

        \[\leadsto \frac{\color{blue}{2}}{t} + -2 \]
      5. +-commutative60.8%

        \[\leadsto \color{blue}{-2 + \frac{2}{t}} \]
      6. metadata-eval60.8%

        \[\leadsto -2 + \frac{\color{blue}{--2}}{t} \]
      7. distribute-neg-frac60.8%

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

        \[\leadsto \color{blue}{-2 - \frac{-2}{t}} \]
    8. Simplified60.8%

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

    if 5.00000000000000015e-54 < (/.f64 x y) < 9.9999999999999998e-17

    1. Initial program 99.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 z around 0 80.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{2}{t}}{z}} \]
    8. Simplified80.0%

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

    if 9.9999999999999998e-17 < (/.f64 x y)

    1. Initial program 85.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 77.6%

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

Alternative 5: 65.2% accurate, 0.7× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 x y) < -5e16

    1. Initial program 82.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 72.3%

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

    if -5e16 < (/.f64 x y) < 5.00000000000000015e-54

    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 z around inf 61.5%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{1}{t} - 2} \]
    7. Step-by-step derivation
      1. sub-neg60.8%

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

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

        \[\leadsto \color{blue}{\frac{2 \cdot 1}{t}} + -2 \]
      4. metadata-eval60.8%

        \[\leadsto \frac{\color{blue}{2}}{t} + -2 \]
      5. +-commutative60.8%

        \[\leadsto \color{blue}{-2 + \frac{2}{t}} \]
      6. metadata-eval60.8%

        \[\leadsto -2 + \frac{\color{blue}{--2}}{t} \]
      7. distribute-neg-frac60.8%

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

        \[\leadsto \color{blue}{-2 - \frac{-2}{t}} \]
    8. Simplified60.8%

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

    if 5.00000000000000015e-54 < (/.f64 x y) < 9.9999999999999998e-17

    1. Initial program 99.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 z around 0 80.0%

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

    if 9.9999999999999998e-17 < (/.f64 x y)

    1. Initial program 85.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 77.6%

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

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

Alternative 6: 98.2% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 85.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 z around 0 74.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2e6 < (/.f64 x y) < 0.20000000000000001

    1. Initial program 89.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 0 98.1%

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

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

        \[\leadsto 2 \cdot \frac{1 - t}{t} + \frac{\color{blue}{2}}{t \cdot z} \]
      3. associate-/l/98.1%

        \[\leadsto 2 \cdot \frac{1 - t}{t} + \color{blue}{\frac{\frac{2}{z}}{t}} \]
      4. +-commutative98.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 98.1% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 83.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 96.3%

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

    if -1.99999999999999988e-11 < (/.f64 x y) < 0.20000000000000001

    1. Initial program 89.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 0 98.0%

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

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

        \[\leadsto 2 \cdot \frac{1 - t}{t} + \frac{\color{blue}{2}}{t \cdot z} \]
      3. associate-/l/98.1%

        \[\leadsto 2 \cdot \frac{1 - t}{t} + \color{blue}{\frac{\frac{2}{z}}{t}} \]
      4. +-commutative98.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.20000000000000001 < (/.f64 x y)

    1. Initial program 86.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 0 79.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 88.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+16} \lor \neg \left(\frac{x}{y} \leq 40000000000\right):\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \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+16) (not (<= (/ x y) 40000000000.0)))
   (+ (/ x y) (/ 2.0 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+16) || !((x / y) <= 40000000000.0)) {
		tmp = (x / y) + (2.0 / 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+16)) .or. (.not. ((x / y) <= 40000000000.0d0))) then
        tmp = (x / y) + (2.0d0 / 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+16) || !((x / y) <= 40000000000.0)) {
		tmp = (x / y) + (2.0 / 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+16) or not ((x / y) <= 40000000000.0):
		tmp = (x / y) + (2.0 / 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+16) || !(Float64(x / y) <= 40000000000.0))
		tmp = Float64(Float64(x / y) + Float64(2.0 / 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+16) || ~(((x / y) <= 40000000000.0)))
		tmp = (x / y) + (2.0 / t);
	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+16], N[Not[LessEqual[N[(x / y), $MachinePrecision], 40000000000.0]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $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^{+16} \lor \neg \left(\frac{x}{y} \leq 40000000000\right):\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\

\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) < -5e16 or 4e10 < (/.f64 x y)

    1. Initial program 84.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 z around inf 85.2%

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

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

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

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

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

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

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

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

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

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

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

    if -5e16 < (/.f64 x y) < 4e10

    1. Initial program 89.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 0 97.5%

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

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

        \[\leadsto 2 \cdot \frac{1 - t}{t} + \frac{\color{blue}{2}}{t \cdot z} \]
      3. associate-/l/97.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \left(2 \cdot \frac{1}{t} + \color{blue}{\frac{2}{z} \cdot \frac{1}{t}}\right) \]
      18. distribute-rgt-out97.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 89.0% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 82.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 z around inf 84.3%

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

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

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

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

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

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

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

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

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

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

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

    if -5e16 < (/.f64 x y) < 4e10

    1. Initial program 89.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 0 97.5%

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

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

        \[\leadsto 2 \cdot \frac{1 - t}{t} + \frac{\color{blue}{2}}{t \cdot z} \]
      3. associate-/l/97.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \left(2 \cdot \frac{1}{t} + \color{blue}{\frac{2}{z} \cdot \frac{1}{t}}\right) \]
      18. distribute-rgt-out97.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4e10 < (/.f64 x y)

    1. Initial program 86.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 z around inf 85.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 67.2% accurate, 0.8× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.1e-64 or 4.00000000000000025e-9 < z

    1. Initial program 78.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 z around inf 97.2%

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

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

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

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

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

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

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

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

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

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

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

    if -1.1e-64 < z < 4.00000000000000016e-153

    1. Initial program 98.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 z around 0 69.9%

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

        \[\leadsto \color{blue}{\frac{\frac{2}{z}}{t}} \]
    5. Simplified69.9%

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

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

        \[\leadsto \color{blue}{\frac{\frac{2}{t}}{z}} \]
    8. Simplified69.9%

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

    if 4.00000000000000016e-153 < z < 4.00000000000000025e-9

    1. Initial program 96.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 t around inf 65.9%

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

Alternative 11: 80.7% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -185 \lor \neg \left(t \leq 3.7 \cdot 10^{-26}\right):\\
\;\;\;\;\frac{x}{y} - 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -185 or 3.6999999999999999e-26 < t

    1. Initial program 77.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 83.9%

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

    if -185 < t < 3.6999999999999999e-26

    1. Initial program 98.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 0 78.7%

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{t}{2 + \frac{2}{z}}}} \]
      2. associate-/r/78.7%

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

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

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

Alternative 12: 66.0% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -5e16 or 2e20 < (/.f64 x y)

    1. Initial program 84.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 77.1%

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

    if -5e16 < (/.f64 x y) < 2e20

    1. Initial program 89.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 inf 59.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{1}{t} - 2} \]
    7. Step-by-step derivation
      1. sub-neg56.8%

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

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

        \[\leadsto \color{blue}{\frac{2 \cdot 1}{t}} + -2 \]
      4. metadata-eval56.8%

        \[\leadsto \frac{\color{blue}{2}}{t} + -2 \]
      5. +-commutative56.8%

        \[\leadsto \color{blue}{-2 + \frac{2}{t}} \]
      6. metadata-eval56.8%

        \[\leadsto -2 + \frac{\color{blue}{--2}}{t} \]
      7. distribute-neg-frac56.8%

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

        \[\leadsto \color{blue}{-2 - \frac{-2}{t}} \]
    8. Simplified56.8%

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

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

Alternative 13: 65.8% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 82.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 72.3%

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

    if -5e16 < (/.f64 x y) < 4.99999999999999962e-25

    1. Initial program 90.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 z around inf 60.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{1}{t} - 2} \]
    7. Step-by-step derivation
      1. sub-neg59.6%

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

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

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

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

        \[\leadsto \color{blue}{-2 + \frac{2}{t}} \]
      6. metadata-eval59.6%

        \[\leadsto -2 + \frac{\color{blue}{--2}}{t} \]
      7. distribute-neg-frac59.6%

        \[\leadsto -2 + \color{blue}{\left(-\frac{-2}{t}\right)} \]
      8. unsub-neg59.6%

        \[\leadsto \color{blue}{-2 - \frac{-2}{t}} \]
    8. Simplified59.6%

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

    if 4.99999999999999962e-25 < (/.f64 x y)

    1. Initial program 85.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 inf 74.9%

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

Alternative 14: 80.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -750 \lor \neg \left(t \leq 3.8 \cdot 10^{-26}\right):\\
\;\;\;\;\frac{x}{y} - 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -750 or 3.80000000000000015e-26 < t

    1. Initial program 77.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 83.9%

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

    if -750 < t < 3.80000000000000015e-26

    1. Initial program 98.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 0 78.7%

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

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

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

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

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

Alternative 15: 52.9% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -5e16 or 0.20000000000000001 < (/.f64 x y)

    1. Initial program 84.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 75.5%

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

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

    1. Initial program 89.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 0 97.5%

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

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

        \[\leadsto 2 \cdot \frac{1 - t}{t} + \frac{\color{blue}{2}}{t \cdot z} \]
      3. associate-/l/97.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \left(2 \cdot \frac{1}{t} + \color{blue}{\frac{2}{z} \cdot \frac{1}{t}}\right) \]
      18. distribute-rgt-out97.5%

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

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

      \[\leadsto -2 + \frac{1}{t} \cdot \color{blue}{2} \]
    7. Taylor expanded in t around inf 30.3%

      \[\leadsto \color{blue}{-2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification54.7%

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

Alternative 16: 37.5% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;t \leq 2:\\
\;\;\;\;\frac{2}{t}\\

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


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

    1. Initial program 75.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 0 42.8%

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

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

        \[\leadsto 2 \cdot \frac{1 - t}{t} + \frac{\color{blue}{2}}{t \cdot z} \]
      3. associate-/l/42.9%

        \[\leadsto 2 \cdot \frac{1 - t}{t} + \color{blue}{\frac{\frac{2}{z}}{t}} \]
      4. +-commutative42.9%

        \[\leadsto \color{blue}{\frac{\frac{2}{z}}{t} + 2 \cdot \frac{1 - t}{t}} \]
      5. div-sub42.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \left(2 \cdot \frac{1}{t} + \color{blue}{\frac{\frac{2}{z}}{t}}\right) \]
      16. *-rgt-identity42.9%

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

        \[\leadsto -2 + \left(2 \cdot \frac{1}{t} + \color{blue}{\frac{2}{z} \cdot \frac{1}{t}}\right) \]
      18. distribute-rgt-out42.9%

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

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

      \[\leadsto -2 + \frac{1}{t} \cdot \color{blue}{2} \]
    7. Taylor expanded in t around inf 28.7%

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

    if -1 < t < 2

    1. Initial program 98.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 z around inf 60.4%

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

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

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

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

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

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

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

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

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

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

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

Alternative 17: 20.3% 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 87.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 0 59.4%

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

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

      \[\leadsto 2 \cdot \frac{1 - t}{t} + \frac{\color{blue}{2}}{t \cdot z} \]
    3. associate-/l/59.4%

      \[\leadsto 2 \cdot \frac{1 - t}{t} + \color{blue}{\frac{\frac{2}{z}}{t}} \]
    4. +-commutative59.4%

      \[\leadsto \color{blue}{\frac{\frac{2}{z}}{t} + 2 \cdot \frac{1 - t}{t}} \]
    5. div-sub59.4%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -2 + \left(2 \cdot \frac{1}{t} + \color{blue}{\frac{2}{z} \cdot \frac{1}{t}}\right) \]
    18. distribute-rgt-out59.4%

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

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

    \[\leadsto -2 + \frac{1}{t} \cdot \color{blue}{2} \]
  7. Taylor expanded in t around inf 15.4%

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

Developer Target 1: 99.1% accurate, 1.3× speedup?

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

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

Reproduce

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

  :alt
  (! :herbie-platform default (- (/ (+ (/ 2 z) 2) t) (- 2 (/ x y))))

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