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

Percentage Accurate: 86.3% → 98.5%
Time: 10.3s
Alternatives: 14
Speedup: 0.8×

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 14 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.3% 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: 98.5% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 80.9%

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

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

    if -2.00000000000000004e95 < (/.f64 x y) < 1e12

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

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

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

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

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

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

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

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

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

Alternative 2: 99.4% accurate, 0.4× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 51.7% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -200:\\
\;\;\;\;\frac{x}{y}\\

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

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

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


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

    1. Initial program 79.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 73.2%

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

    if -200 < (/.f64 x y) < 1e-242

    1. Initial program 86.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e-242 < (/.f64 x y) < 2e9

    1. Initial program 91.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 52.0%

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

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

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

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

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

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

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

Alternative 4: 98.2% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 71.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} + \left(-2 + \frac{\frac{2}{z}}{\color{blue}{-\left(-t\right)}}\right) \]
      11. distribute-neg-frac299.4%

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

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

        \[\leadsto \frac{x}{y} + \left(-2 - \color{blue}{\left(-\frac{\frac{2}{z}}{t}\right)}\right) \]
      14. distribute-neg-frac99.4%

        \[\leadsto \frac{x}{y} + \left(-2 - \color{blue}{\frac{-\frac{2}{z}}{t}}\right) \]
      15. distribute-neg-frac99.4%

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

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

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

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

    if -3.2e14 < t < 1

    1. Initial program 97.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 0 96.8%

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

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

Alternative 5: 67.0% accurate, 0.8× speedup?

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

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

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

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

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


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

    1. Initial program 74.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 85.2%

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

    if -1.15000000000000006e-55 < t < 2.5e-225

    1. Initial program 95.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 95.3%

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

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

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

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

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

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

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

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

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

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

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

    if 2.5e-225 < t < 1

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x + \color{blue}{y \cdot \frac{2}{t}}}{y} \]
    11. Simplified46.5%

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

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

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

        \[\leadsto \frac{\color{blue}{2}}{t} + \frac{x}{y} \]
      3. +-commutative65.7%

        \[\leadsto \color{blue}{\frac{x}{y} + \frac{2}{t}} \]
    14. Simplified65.7%

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

Alternative 6: 97.6% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.9e10 or 8.19999999999999988e-21 < z

    1. Initial program 72.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.9e10 < z < 8.19999999999999988e-21

    1. Initial program 97.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 87.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} + \left(-2 + \color{blue}{\frac{\frac{2}{z}}{t}}\right) \]
      10. remove-double-neg96.0%

        \[\leadsto \frac{x}{y} + \left(-2 + \frac{\frac{2}{z}}{\color{blue}{-\left(-t\right)}}\right) \]
      11. distribute-neg-frac296.0%

        \[\leadsto \frac{x}{y} + \left(-2 + \color{blue}{\left(-\frac{\frac{2}{z}}{-t}\right)}\right) \]
      12. unsub-neg96.0%

        \[\leadsto \frac{x}{y} + \color{blue}{\left(-2 - \frac{\frac{2}{z}}{-t}\right)} \]
      13. distribute-frac-neg296.0%

        \[\leadsto \frac{x}{y} + \left(-2 - \color{blue}{\left(-\frac{\frac{2}{z}}{t}\right)}\right) \]
      14. distribute-neg-frac96.0%

        \[\leadsto \frac{x}{y} + \left(-2 - \color{blue}{\frac{-\frac{2}{z}}{t}}\right) \]
      15. distribute-neg-frac96.0%

        \[\leadsto \frac{x}{y} + \left(-2 - \frac{\color{blue}{\frac{-2}{z}}}{t}\right) \]
      16. metadata-eval96.0%

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

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

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

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

Alternative 7: 62.0% accurate, 0.8× speedup?

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

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

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

\mathbf{elif}\;t \leq 65:\\
\;\;\;\;\frac{2}{t} + -2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.1000000000000002e-55 or 65 < t

    1. Initial program 73.9%

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

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

    if -2.1000000000000002e-55 < t < 4.79999999999999992e-225

    1. Initial program 95.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 95.3%

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

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

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

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

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

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

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

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

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

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

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

    if 4.79999999999999992e-225 < t < 65

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 61.9% accurate, 0.8× speedup?

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

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

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

\mathbf{elif}\;t \leq 65:\\
\;\;\;\;\frac{2}{t} + -2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.40000000000000009e-60 or 65 < t

    1. Initial program 73.9%

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

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

    if -2.40000000000000009e-60 < t < 1.10000000000000001e-221

    1. Initial program 95.2%

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

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

    if 1.10000000000000001e-221 < t < 65

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 81.2% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.45e-61 or 3.90000000000000006e-57 < t

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.45e-61 < t < 3.90000000000000006e-57

    1. Initial program 96.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 0 89.1%

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

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

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

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

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

Alternative 10: 65.9% accurate, 0.9× speedup?

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

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

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


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

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

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

    if -2e-31 < (/.f64 x y) < 2e9

    1. Initial program 88.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 65.7% accurate, 0.9× speedup?

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

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

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


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

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

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

    if -5.0000000000000004e43 < (/.f64 x y) < 2e9

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 79.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -2 \cdot 10^{-55} \lor \neg \left(t \leq 0.0048\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 -2e-55) (not (<= t 0.0048)))
   (- (/ x y) 2.0)
   (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -2e-55) || !(t <= 0.0048)) {
		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 <= (-2d-55)) .or. (.not. (t <= 0.0048d0))) 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 <= -2e-55) || !(t <= 0.0048)) {
		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 <= -2e-55) or not (t <= 0.0048):
		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 <= -2e-55) || !(t <= 0.0048))
		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 <= -2e-55) || ~((t <= 0.0048)))
		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, -2e-55], N[Not[LessEqual[t, 0.0048]], $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 -2 \cdot 10^{-55} \lor \neg \left(t \leq 0.0048\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 < -1.99999999999999999e-55 or 0.00479999999999999958 < t

    1. Initial program 74.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 85.2%

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

    if -1.99999999999999999e-55 < t < 0.00479999999999999958

    1. Initial program 97.0%

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

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

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

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

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

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

Alternative 13: 37.4% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{+14}:\\
\;\;\;\;-2\\

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

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


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

    1. Initial program 71.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 87.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.2e14 < t < 1.39999999999999998e-5

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

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

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

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

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

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

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

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

Alternative 14: 20.7% 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 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 z around inf 72.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-2} \]
  10. 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 2024180 
(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))))