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

Percentage Accurate: 86.9% → 99.0%
Time: 13.1s
Alternatives: 17
Speedup: 0.9×

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.9% 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.0% accurate, 0.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < 1.9999999999999999e305

    1. Initial program 99.8%

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

    if 1.9999999999999999e305 < (/.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 36.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 y around 0 100.0%

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

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

Alternative 2: 99.3% accurate, 0.4× speedup?

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

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

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


\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.8%

      \[\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 y around 0 100.0%

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

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

        \[\leadsto \frac{\color{blue}{-2 \cdot y + x}}{y} \]
      2. *-commutative93.5%

        \[\leadsto \frac{\color{blue}{y \cdot -2} + x}{y} \]
    6. Simplified93.5%

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

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

Alternative 3: 97.8% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 88.4%

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

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

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

    1. Initial program 87.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 63.2% accurate, 0.7× speedup?

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

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

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

\mathbf{elif}\;z \leq 3.7 \cdot 10^{+27} \lor \neg \left(z \leq 4.4 \cdot 10^{+190}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.14999999999999983e-80 or 2.49999999999999981e-66 < z < 3.70000000000000002e27 or 4.4e190 < z

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

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

    if -3.14999999999999983e-80 < z < 2.49999999999999981e-66

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

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

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

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

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

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

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

    if 3.70000000000000002e27 < z < 4.4e190

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.15 \cdot 10^{-80}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-66}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;z \leq 3.7 \cdot 10^{+27} \lor \neg \left(z \leq 4.4 \cdot 10^{+190}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 63.0% accurate, 0.7× speedup?

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

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

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

\mathbf{elif}\;z \leq 2.25 \cdot 10^{+27} \lor \neg \left(z \leq 4.4 \cdot 10^{+190}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.94999999999999973e-79 or 5.4999999999999997e-60 < z < 2.25e27 or 4.4e190 < z

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

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

    if -3.94999999999999973e-79 < z < 5.4999999999999997e-60

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

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

    if 2.25e27 < z < 4.4e190

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.95 \cdot 10^{-79}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-60}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{elif}\;z \leq 2.25 \cdot 10^{+27} \lor \neg \left(z \leq 4.4 \cdot 10^{+190}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 93.1% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 87.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 y around 0 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.99999999999999989e34 < (/.f64 x y) < 2e15

    1. Initial program 87.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 96.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 92.9% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 89.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 y around 0 99.9%

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

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

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

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

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

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

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

    if -1.99999999999999989e34 < (/.f64 x y) < 2e15

    1. Initial program 87.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 96.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e15 < (/.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 y around 0 98.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 52.7% accurate, 0.7× speedup?

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

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

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

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

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


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

    1. Initial program 88.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 69.8%

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

    if -3.0999999999999999e29 < (/.f64 x y) < -1.02000000000000002e-79

    1. Initial program 88.1%

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

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

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

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

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

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

    if -1.02000000000000002e-79 < (/.f64 x y) < 2

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

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

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

Alternative 9: 69.8% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -1.99999999999999997e157 or 1.45e26 < (/.f64 x y)

    1. Initial program 87.6%

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

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

    if -1.99999999999999997e157 < (/.f64 x y) < 1.45e26

    1. Initial program 87.8%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 94.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/94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 90.9% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.02e-41 or 3.09999999999999999e-59 < z

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

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

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

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

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

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

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

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

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

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

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

    if -1.02e-41 < z < 3.09999999999999999e-59

    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 y around 0 93.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 85.5% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6.00000000000000001e-57 or 3.2000000000000001e-60 < z

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

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

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

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

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

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

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

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

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

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

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

    if -6.00000000000000001e-57 < z < 3.2000000000000001e-60

    1. Initial program 97.9%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 76.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/76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 66.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -6.6 \cdot 10^{+28} \lor \neg \left(\frac{x}{y} \leq 2.1 \cdot 10^{+15}\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) -6.6e+28) (not (<= (/ x y) 2.1e+15)))
   (/ x y)
   (+ -2.0 (/ 2.0 t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x / y) <= -6.6e+28) || !((x / y) <= 2.1e+15)) {
		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) <= (-6.6d+28)) .or. (.not. ((x / y) <= 2.1d+15))) 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) <= -6.6e+28) || !((x / y) <= 2.1e+15)) {
		tmp = x / y;
	} else {
		tmp = -2.0 + (2.0 / t);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x / y) <= -6.6e+28) or not ((x / y) <= 2.1e+15):
		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) <= -6.6e+28) || !(Float64(x / y) <= 2.1e+15))
		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) <= -6.6e+28) || ~(((x / y) <= 2.1e+15)))
		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], -6.6e+28], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2.1e+15]], $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 -6.6 \cdot 10^{+28} \lor \neg \left(\frac{x}{y} \leq 2.1 \cdot 10^{+15}\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) < -6.6e28 or 2.1e15 < (/.f64 x y)

    1. Initial program 87.9%

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

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

    if -6.6e28 < (/.f64 x y) < 2.1e15

    1. Initial program 87.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 67.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 66.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -9 \cdot 10^{+28}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 0.000108:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (/ x y) -9e+28)
   (/ x y)
   (if (<= (/ x y) 0.000108) (+ -2.0 (/ 2.0 t)) (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x / y) <= -9e+28) {
		tmp = x / y;
	} else if ((x / y) <= 0.000108) {
		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) <= (-9d+28)) then
        tmp = x / y
    else if ((x / y) <= 0.000108d0) 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) <= -9e+28) {
		tmp = x / y;
	} else if ((x / y) <= 0.000108) {
		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) <= -9e+28:
		tmp = x / y
	elif (x / y) <= 0.000108:
		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) <= -9e+28)
		tmp = Float64(x / y);
	elseif (Float64(x / y) <= 0.000108)
		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) <= -9e+28)
		tmp = x / y;
	elseif ((x / y) <= 0.000108)
		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], -9e+28], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 0.000108], 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 -9 \cdot 10^{+28}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;\frac{x}{y} \leq 0.000108:\\
\;\;\;\;-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) < -8.9999999999999994e28

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

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

    if -8.9999999999999994e28 < (/.f64 x y) < 1.08e-4

    1. Initial program 87.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 66.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.08e-4 < (/.f64 x y)

    1. Initial program 86.1%

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

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

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

Alternative 14: 80.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -6.7 \lor \neg \left(t \leq 3000\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 -6.7) (not (<= t 3000.0)))
   (- (/ x y) 2.0)
   (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -6.7) || !(t <= 3000.0)) {
		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 <= (-6.7d0)) .or. (.not. (t <= 3000.0d0))) 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 <= -6.7) || !(t <= 3000.0)) {
		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 <= -6.7) or not (t <= 3000.0):
		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 <= -6.7) || !(t <= 3000.0))
		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 <= -6.7) || ~((t <= 3000.0)))
		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, -6.7], N[Not[LessEqual[t, 3000.0]], $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 -6.7 \lor \neg \left(t \leq 3000\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 < -6.70000000000000018 or 3e3 < t

    1. Initial program 77.5%

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

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

    if -6.70000000000000018 < t < 3e3

    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 t around 0 77.2%

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

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

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

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

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

Alternative 15: 80.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -400:\\
\;\;\;\;\frac{x + y \cdot -2}{y}\\

\mathbf{elif}\;t \leq 80000:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\

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


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

    1. Initial program 71.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 y around 0 98.5%

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

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

        \[\leadsto \frac{\color{blue}{-2 \cdot y + x}}{y} \]
      2. *-commutative81.5%

        \[\leadsto \frac{\color{blue}{y \cdot -2} + x}{y} \]
    6. Simplified81.5%

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

    if -400 < t < 8e4

    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 t around 0 77.2%

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

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

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

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

    if 8e4 < t

    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 inf 90.6%

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

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

Alternative 16: 36.3% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1:\\ \;\;\;\;-2\\ \mathbf{elif}\;t \leq 1.15 \cdot 10^{+26}:\\ \;\;\;\;\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 1.15e+26) (/ 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 <= 1.15e+26) {
		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 <= 1.15d+26) 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 <= 1.15e+26) {
		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 <= 1.15e+26:
		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 <= 1.15e+26)
		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 <= 1.15e+26)
		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, 1.15e+26], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq 1.15 \cdot 10^{+26}:\\
\;\;\;\;\frac{2}{t}\\

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


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

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

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

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

    if -1 < t < 1.15e26

    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 t around 0 76.6%

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

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

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

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

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

Alternative 17: 19.9% 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.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 t around inf 56.0%

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

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

Developer Target 1: 99.0% 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 2024145 
(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))))