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

Percentage Accurate: 86.3% → 99.3%
Time: 11.9s
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.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: 99.3% accurate, 0.4× speedup?

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

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

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


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

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

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

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

Alternative 2: 67.6% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := -2 + \frac{2}{t}\\
t_2 := \frac{x}{y} + \frac{2}{t}\\
\mathbf{if}\;\frac{x}{y} \leq -70:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;\frac{x}{y} \leq -3.1 \cdot 10^{-114}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;\frac{x}{y} \leq 3.9 \cdot 10^{-83}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{x}{y} \leq 86000000000000:\\
\;\;\;\;\frac{2}{t \cdot z}\\

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


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

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

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

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

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

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

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

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

    if -70 < (/.f64 x y) < -3.1e-114 or -1e-179 < (/.f64 x y) < 3.9e-83

    1. Initial program 85.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.1e-114 < (/.f64 x y) < -1e-179

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.9e-83 < (/.f64 x y) < 8.6e13

    1. Initial program 99.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 100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -70:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq -3.1 \cdot 10^{-114}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{-179}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;\frac{x}{y} \leq 3.9 \cdot 10^{-83}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 86000000000000:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 63.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} - 2\\ t_2 := \frac{2}{t \cdot z}\\ \mathbf{if}\;\frac{x}{y} \leq -3 \cdot 10^{+115}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -1.18 \cdot 10^{+89}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;\frac{x}{y} \leq -1.6 \cdot 10^{-15}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{x}{y} \leq 1.12 \cdot 10^{-81}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 4.2 \cdot 10^{+15}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (/ x y) 2.0)) (t_2 (/ 2.0 (* t z))))
   (if (<= (/ x y) -3e+115)
     (/ x y)
     (if (<= (/ x y) -1.18e+89)
       t_2
       (if (<= (/ x y) -1.6e-15)
         t_1
         (if (<= (/ x y) 1.12e-81)
           (+ -2.0 (/ 2.0 t))
           (if (<= (/ x y) 4.2e+15) t_2 t_1)))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / y) - 2.0;
	double t_2 = 2.0 / (t * z);
	double tmp;
	if ((x / y) <= -3e+115) {
		tmp = x / y;
	} else if ((x / y) <= -1.18e+89) {
		tmp = t_2;
	} else if ((x / y) <= -1.6e-15) {
		tmp = t_1;
	} else if ((x / y) <= 1.12e-81) {
		tmp = -2.0 + (2.0 / t);
	} else if ((x / y) <= 4.2e+15) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (x / y) - 2.0d0
    t_2 = 2.0d0 / (t * z)
    if ((x / y) <= (-3d+115)) then
        tmp = x / y
    else if ((x / y) <= (-1.18d+89)) then
        tmp = t_2
    else if ((x / y) <= (-1.6d-15)) then
        tmp = t_1
    else if ((x / y) <= 1.12d-81) then
        tmp = (-2.0d0) + (2.0d0 / t)
    else if ((x / y) <= 4.2d+15) then
        tmp = t_2
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (x / y) - 2.0;
	double t_2 = 2.0 / (t * z);
	double tmp;
	if ((x / y) <= -3e+115) {
		tmp = x / y;
	} else if ((x / y) <= -1.18e+89) {
		tmp = t_2;
	} else if ((x / y) <= -1.6e-15) {
		tmp = t_1;
	} else if ((x / y) <= 1.12e-81) {
		tmp = -2.0 + (2.0 / t);
	} else if ((x / y) <= 4.2e+15) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / y) - 2.0
	t_2 = 2.0 / (t * z)
	tmp = 0
	if (x / y) <= -3e+115:
		tmp = x / y
	elif (x / y) <= -1.18e+89:
		tmp = t_2
	elif (x / y) <= -1.6e-15:
		tmp = t_1
	elif (x / y) <= 1.12e-81:
		tmp = -2.0 + (2.0 / t)
	elif (x / y) <= 4.2e+15:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x / y) - 2.0)
	t_2 = Float64(2.0 / Float64(t * z))
	tmp = 0.0
	if (Float64(x / y) <= -3e+115)
		tmp = Float64(x / y);
	elseif (Float64(x / y) <= -1.18e+89)
		tmp = t_2;
	elseif (Float64(x / y) <= -1.6e-15)
		tmp = t_1;
	elseif (Float64(x / y) <= 1.12e-81)
		tmp = Float64(-2.0 + Float64(2.0 / t));
	elseif (Float64(x / y) <= 4.2e+15)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x / y) - 2.0;
	t_2 = 2.0 / (t * z);
	tmp = 0.0;
	if ((x / y) <= -3e+115)
		tmp = x / y;
	elseif ((x / y) <= -1.18e+89)
		tmp = t_2;
	elseif ((x / y) <= -1.6e-15)
		tmp = t_1;
	elseif ((x / y) <= 1.12e-81)
		tmp = -2.0 + (2.0 / t);
	elseif ((x / y) <= 4.2e+15)
		tmp = t_2;
	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]}, Block[{t$95$2 = N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -3e+115], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -1.18e+89], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], -1.6e-15], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 1.12e-81], N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 4.2e+15], t$95$2, t$95$1]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;\frac{x}{y} \leq -1.18 \cdot 10^{+89}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;\frac{x}{y} \leq -1.6 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{x}{y} \leq 1.12 \cdot 10^{-81}:\\
\;\;\;\;-2 + \frac{2}{t}\\

\mathbf{elif}\;\frac{x}{y} \leq 4.2 \cdot 10^{+15}:\\
\;\;\;\;t\_2\\

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


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

    1. Initial program 83.7%

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

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

    if -3e115 < (/.f64 x y) < -1.17999999999999993e89 or 1.1200000000000001e-81 < (/.f64 x y) < 4.2e15

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

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

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

        \[\leadsto \frac{2}{\color{blue}{z \cdot t}} \]
    6. Simplified68.0%

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

    if -1.17999999999999993e89 < (/.f64 x y) < -1.6e-15 or 4.2e15 < (/.f64 x y)

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

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

    if -1.6e-15 < (/.f64 x y) < 1.1200000000000001e-81

    1. Initial program 87.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -3 \cdot 10^{+115}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -1.18 \cdot 10^{+89}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{elif}\;\frac{x}{y} \leq -1.6 \cdot 10^{-15}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;\frac{x}{y} \leq 1.12 \cdot 10^{-81}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 4.2 \cdot 10^{+15}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 64.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} - 2\\ \mathbf{if}\;\frac{x}{y} \leq -2.8 \cdot 10^{+115}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -2.8 \cdot 10^{+83}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;\frac{x}{y} \leq -8 \cdot 10^{-16}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{x}{y} \leq 1.02 \cdot 10^{-81}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 2.7 \cdot 10^{+14}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (/ x y) 2.0)))
   (if (<= (/ x y) -2.8e+115)
     (/ x y)
     (if (<= (/ x y) -2.8e+83)
       (/ (/ 2.0 t) z)
       (if (<= (/ x y) -8e-16)
         t_1
         (if (<= (/ x y) 1.02e-81)
           (+ -2.0 (/ 2.0 t))
           (if (<= (/ x y) 2.7e+14) (/ 2.0 (* t z)) t_1)))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / y) - 2.0;
	double tmp;
	if ((x / y) <= -2.8e+115) {
		tmp = x / y;
	} else if ((x / y) <= -2.8e+83) {
		tmp = (2.0 / t) / z;
	} else if ((x / y) <= -8e-16) {
		tmp = t_1;
	} else if ((x / y) <= 1.02e-81) {
		tmp = -2.0 + (2.0 / t);
	} else if ((x / y) <= 2.7e+14) {
		tmp = 2.0 / (t * z);
	} 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 ((x / y) <= (-2.8d+115)) then
        tmp = x / y
    else if ((x / y) <= (-2.8d+83)) then
        tmp = (2.0d0 / t) / z
    else if ((x / y) <= (-8d-16)) then
        tmp = t_1
    else if ((x / y) <= 1.02d-81) then
        tmp = (-2.0d0) + (2.0d0 / t)
    else if ((x / y) <= 2.7d+14) then
        tmp = 2.0d0 / (t * z)
    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 ((x / y) <= -2.8e+115) {
		tmp = x / y;
	} else if ((x / y) <= -2.8e+83) {
		tmp = (2.0 / t) / z;
	} else if ((x / y) <= -8e-16) {
		tmp = t_1;
	} else if ((x / y) <= 1.02e-81) {
		tmp = -2.0 + (2.0 / t);
	} else if ((x / y) <= 2.7e+14) {
		tmp = 2.0 / (t * z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / y) - 2.0
	tmp = 0
	if (x / y) <= -2.8e+115:
		tmp = x / y
	elif (x / y) <= -2.8e+83:
		tmp = (2.0 / t) / z
	elif (x / y) <= -8e-16:
		tmp = t_1
	elif (x / y) <= 1.02e-81:
		tmp = -2.0 + (2.0 / t)
	elif (x / y) <= 2.7e+14:
		tmp = 2.0 / (t * z)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x / y) - 2.0)
	tmp = 0.0
	if (Float64(x / y) <= -2.8e+115)
		tmp = Float64(x / y);
	elseif (Float64(x / y) <= -2.8e+83)
		tmp = Float64(Float64(2.0 / t) / z);
	elseif (Float64(x / y) <= -8e-16)
		tmp = t_1;
	elseif (Float64(x / y) <= 1.02e-81)
		tmp = Float64(-2.0 + Float64(2.0 / t));
	elseif (Float64(x / y) <= 2.7e+14)
		tmp = Float64(2.0 / Float64(t * z));
	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 ((x / y) <= -2.8e+115)
		tmp = x / y;
	elseif ((x / y) <= -2.8e+83)
		tmp = (2.0 / t) / z;
	elseif ((x / y) <= -8e-16)
		tmp = t_1;
	elseif ((x / y) <= 1.02e-81)
		tmp = -2.0 + (2.0 / t);
	elseif ((x / y) <= 2.7e+14)
		tmp = 2.0 / (t * z);
	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[N[(x / y), $MachinePrecision], -2.8e+115], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -2.8e+83], N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -8e-16], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 1.02e-81], N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2.7e+14], N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}

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

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

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

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

\mathbf{elif}\;\frac{x}{y} \leq 2.7 \cdot 10^{+14}:\\
\;\;\;\;\frac{2}{t \cdot z}\\

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


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

    1. Initial program 83.7%

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

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

    if -2.8e115 < (/.f64 x y) < -2.8e83

    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
    3. Taylor expanded in t around 0 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.8e83 < (/.f64 x y) < -7.9999999999999998e-16 or 2.7e14 < (/.f64 x y)

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

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

    if -7.9999999999999998e-16 < (/.f64 x y) < 1.01999999999999998e-81

    1. Initial program 87.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.01999999999999998e-81 < (/.f64 x y) < 2.7e14

    1. Initial program 99.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 100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -2.8 \cdot 10^{+115}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -2.8 \cdot 10^{+83}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;\frac{x}{y} \leq -8 \cdot 10^{-16}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;\frac{x}{y} \leq 1.02 \cdot 10^{-81}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 2.7 \cdot 10^{+14}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 97.9% accurate, 0.6× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{t\_1 + 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) < -2e30 or 4.99999999999999991e76 < (/.f64 x y)

    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 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2e30 < (/.f64 x y) < 4.99999999999999991e76

    1. Initial program 88.3%

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

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

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

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

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

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

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

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

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

Alternative 6: 98.0% accurate, 0.7× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5e3 < (/.f64 x y) < 1

    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 x around 0 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 97.3% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 75.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.7e33 < z < 1

    1. Initial program 98.4%

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

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

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

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

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

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

Alternative 8: 97.4% accurate, 0.7× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -50 < (/.f64 x y) < 1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1 < (/.f64 x y)

    1. Initial program 88.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 65.4% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -7600 \lor \neg \left(\frac{x}{y} \leq 10000000000\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) < -7600 or 1e10 < (/.f64 x y)

    1. Initial program 85.8%

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

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

    if -7600 < (/.f64 x y) < 1e10

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 65.6% accurate, 0.9× speedup?

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

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

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


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

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

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

    if -1.6e-15 < (/.f64 x y) < 1.15e10

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 81.6% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.70000000000000008e-44 or 7.50000000000000051e-91 < 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 x around 0 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.70000000000000008e-44 < z < 7.50000000000000051e-91

    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 97.9%

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

      \[\leadsto \color{blue}{\frac{2}{t \cdot z}} \]
    5. Step-by-step derivation
      1. *-commutative67.9%

        \[\leadsto \frac{2}{\color{blue}{z \cdot t}} \]
    6. Simplified67.9%

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

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

Alternative 12: 92.1% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 77.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.70000000000000001e-14 < z < 0.00205000000000000017

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

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

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

Alternative 13: 99.0% accurate, 0.9× speedup?

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

\\
2 \cdot \frac{1}{t \cdot z} + \left(2 \cdot \frac{1 - t}{t} + \frac{x}{y}\right)
\end{array}
Derivation
  1. Initial program 87.4%

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

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

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

Alternative 14: 52.6% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 87.0%

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

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

    if -70 < (/.f64 x y) < 1.8499999999999999e-31

    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 t around inf 34.0%

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

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

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

Alternative 15: 80.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1.45 \cdot 10^{-35} \lor \neg \left(t \leq 2.85 \cdot 10^{-15}\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 -1.45e-35) (not (<= t 2.85e-15)))
   (- (/ 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-35) || !(t <= 2.85e-15)) {
		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 <= (-1.45d-35)) .or. (.not. (t <= 2.85d-15))) 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 <= -1.45e-35) || !(t <= 2.85e-15)) {
		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 <= -1.45e-35) or not (t <= 2.85e-15):
		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 <= -1.45e-35) || !(t <= 2.85e-15))
		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 <= -1.45e-35) || ~((t <= 2.85e-15)))
		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, -1.45e-35], N[Not[LessEqual[t, 2.85e-15]], $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 -1.45 \cdot 10^{-35} \lor \neg \left(t \leq 2.85 \cdot 10^{-15}\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.4500000000000001e-35 or 2.8500000000000002e-15 < t

    1. Initial program 78.0%

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

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

    if -1.4500000000000001e-35 < t < 2.8500000000000002e-15

    1. Initial program 98.1%

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

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

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

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

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

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

Alternative 16: 36.2% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 76.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 79.8%

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

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

    if -1 < t < 1.05e9

    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 98.2%

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} + \frac{2}{t}} \]
    6. Simplified60.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1:\\ \;\;\;\;-2\\ \mathbf{elif}\;t \leq 1050000000:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;-2\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 19.6% 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.4%

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

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

    \[\leadsto \color{blue}{-2} \]
  5. Final simplification15.4%

    \[\leadsto -2 \]
  6. Add Preprocessing

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

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

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