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

Percentage Accurate: 86.9% → 99.1%
Time: 13.5s
Alternatives: 17
Speedup: 1.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 17 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 86.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.1% accurate, 1.0× speedup?

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

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

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

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

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

Alternative 2: 62.9% accurate, 0.5× speedup?

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

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

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

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

\mathbf{elif}\;\frac{x}{y} \leq 1.85 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\

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


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

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

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

    if -2.9000000000000002e106 < (/.f64 x y) < -9.99999999999999999e-15 or 3.2999999999999998e-60 < (/.f64 x y) < 1.85e21

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

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

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

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

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

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

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

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

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

    if -9.99999999999999999e-15 < (/.f64 x y) < 3.2999999999999998e-60

    1. Initial program 83.6%

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

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

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

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

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

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

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

    if 1.85e21 < (/.f64 x y)

    1. Initial program 76.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -2.9 \cdot 10^{+106}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{-14}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{elif}\;\frac{x}{y} \leq 3.3 \cdot 10^{-60}:\\ \;\;\;\;\frac{2}{t} - 2\\ \mathbf{elif}\;\frac{x}{y} \leq 1.85 \cdot 10^{+21}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 63.0% accurate, 0.5× speedup?

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

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

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

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

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

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


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

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

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

    if -7.79999999999999957e105 < (/.f64 x y) < -2.6999999999999999e-14

    1. Initial program 88.7%

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

      \[\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+92.7%

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

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

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

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

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

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

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

    if -2.6999999999999999e-14 < (/.f64 x y) < 1.89999999999999997e-60

    1. Initial program 83.6%

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

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

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

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

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

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

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

    if 1.89999999999999997e-60 < (/.f64 x y) < 2.8e22

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.8e22 < (/.f64 x y)

    1. Initial program 76.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -7.8 \cdot 10^{+105}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -2.7 \cdot 10^{-14}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{elif}\;\frac{x}{y} \leq 1.9 \cdot 10^{-60}:\\ \;\;\;\;\frac{2}{t} - 2\\ \mathbf{elif}\;\frac{x}{y} \leq 2.8 \cdot 10^{+22}:\\ \;\;\;\;\frac{\frac{2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 63.1% accurate, 0.5× speedup?

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

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

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

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

\mathbf{elif}\;\frac{x}{y} \leq 1.16 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\

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


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

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

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

    if -7.79999999999999957e105 < (/.f64 x y) < -2.50000000000000016e-10 or 3.6999999999999998e-62 < (/.f64 x y) < 1.16e23

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{2}{t \cdot z}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity60.2%

        \[\leadsto \color{blue}{1 \cdot \frac{2}{t \cdot z}} \]
      2. *-commutative60.2%

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

        \[\leadsto \color{blue}{\frac{\frac{2}{t}}{z}} \cdot 1 \]
    8. Applied egg-rr60.3%

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

    if -2.50000000000000016e-10 < (/.f64 x y) < 3.6999999999999998e-62

    1. Initial program 83.6%

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

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

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

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

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

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

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

    if 1.16e23 < (/.f64 x y)

    1. Initial program 76.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -7.8 \cdot 10^{+105}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -2.5 \cdot 10^{-10}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;\frac{x}{y} \leq 3.7 \cdot 10^{-62}:\\ \;\;\;\;\frac{2}{t} - 2\\ \mathbf{elif}\;\frac{x}{y} \leq 1.16 \cdot 10^{+23}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 77.9% accurate, 0.6× speedup?

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

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

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

\mathbf{elif}\;t \leq -1.8 \cdot 10^{+25} \lor \neg \left(t \leq 7 \cdot 10^{-19}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -7.7999999999999999e97 or -1.25000000000000005e35 < t < -1.80000000000000008e25 or 7.00000000000000031e-19 < t

    1. Initial program 68.3%

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

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

    if -7.7999999999999999e97 < t < -1.25000000000000005e35

    1. Initial program 99.7%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{2}{t \cdot z}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity74.3%

        \[\leadsto \color{blue}{1 \cdot \frac{2}{t \cdot z}} \]
      2. *-commutative74.3%

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

        \[\leadsto \color{blue}{\frac{\frac{2}{t}}{z}} \cdot 1 \]
    8. Applied egg-rr74.5%

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

    if -1.80000000000000008e25 < t < 7.00000000000000031e-19

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -7.8 \cdot 10^{+97}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;t \leq -1.25 \cdot 10^{+35}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;t \leq -1.8 \cdot 10^{+25} \lor \neg \left(t \leq 7 \cdot 10^{-19}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t \cdot z} + \frac{2}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 77.7% accurate, 0.6× speedup?

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

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

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

\mathbf{elif}\;t \leq -1.5 \cdot 10^{+26} \lor \neg \left(t \leq 1.4 \cdot 10^{-19}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.2999999999999999e100 or -2.1999999999999999e35 < t < -1.49999999999999999e26 or 1.40000000000000001e-19 < t

    1. Initial program 68.3%

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

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

    if -2.2999999999999999e100 < t < -2.1999999999999999e35

    1. Initial program 99.7%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{2}{t \cdot z}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity74.3%

        \[\leadsto \color{blue}{1 \cdot \frac{2}{t \cdot z}} \]
      2. *-commutative74.3%

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

        \[\leadsto \color{blue}{\frac{\frac{2}{t}}{z}} \cdot 1 \]
    8. Applied egg-rr74.5%

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

    if -1.49999999999999999e26 < t < 1.40000000000000001e-19

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.3 \cdot 10^{+100}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;t \leq -2.2 \cdot 10^{+35}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;t \leq -1.5 \cdot 10^{+26} \lor \neg \left(t \leq 1.4 \cdot 10^{-19}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 92.6% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 89.5%

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

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

    if -2e19 < (/.f64 x y) < 2.00000000000000016e-5

    1. Initial program 83.8%

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

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

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

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

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

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

    if 2.00000000000000016e-5 < (/.f64 x y)

    1. Initial program 77.7%

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

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

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

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

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

Alternative 8: 91.4% accurate, 0.7× speedup?

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

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

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

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


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

    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 z around 0 86.1%

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

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

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

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

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

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

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

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

    if -2e113 < (/.f64 x y) < 2.00000000000000016e-5

    1. Initial program 85.9%

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

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

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

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

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

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

    if 2.00000000000000016e-5 < (/.f64 x y)

    1. Initial program 77.7%

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

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

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

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

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

Alternative 9: 64.5% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 82.1%

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

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

    if -124000 < (/.f64 x y) < 8.8e20

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

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

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

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

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

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

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

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

Alternative 10: 64.7% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 81.6%

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

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

    if -0.115000000000000005 < (/.f64 x y) < 9.2e20

    1. Initial program 86.1%

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

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

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

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

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

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

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

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

Alternative 11: 79.9% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.7000000000000001e-189 or 7.0000000000000003e-38 < z

    1. Initial program 76.1%

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

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

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

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

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

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

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

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

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

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

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

    if -1.7000000000000001e-189 < z < 7.0000000000000003e-38

    1. Initial program 96.7%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{2}{t \cdot z}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity69.6%

        \[\leadsto \color{blue}{1 \cdot \frac{2}{t \cdot z}} \]
      2. *-commutative69.6%

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

        \[\leadsto \color{blue}{\frac{\frac{2}{t}}{z}} \cdot 1 \]
    8. Applied egg-rr69.7%

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

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

Alternative 12: 92.0% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.6000000000000001e-32 or 4.9000000000000002e-8 < z

    1. Initial program 69.9%

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

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

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

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

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

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

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

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

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

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

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

    if -1.6000000000000001e-32 < z < 4.9000000000000002e-8

    1. Initial program 97.5%

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

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

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

Alternative 13: 92.0% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -8.8 \cdot 10^{-33} \lor \neg \left(z \leq 8.5 \cdot 10^{-9}\right):\\ \;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= z -8.8e-33) (not (<= z 8.5e-9)))
   (+ (/ 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 <= -8.8e-33) || !(z <= 8.5e-9)) {
		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 <= (-8.8d-33)) .or. (.not. (z <= 8.5d-9))) 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 <= -8.8e-33) || !(z <= 8.5e-9)) {
		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 <= -8.8e-33) or not (z <= 8.5e-9):
		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 <= -8.8e-33) || !(z <= 8.5e-9))
		tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t)));
	else
		tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((z <= -8.8e-33) || ~((z <= 8.5e-9)))
		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, -8.8e-33], N[Not[LessEqual[z, 8.5e-9]], $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 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -8.80000000000000022e-33 or 8.5e-9 < z

    1. Initial program 69.9%

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

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

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

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

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

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

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

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

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

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

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

    if -8.80000000000000022e-33 < z < 8.5e-9

    1. Initial program 97.5%

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

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

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

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

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

Alternative 14: 92.1% accurate, 0.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.19999999999999982e-31

    1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

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

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

    if -4.19999999999999982e-31 < z < 7.19999999999999962e-8

    1. Initial program 97.5%

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

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

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

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

    if 7.19999999999999962e-8 < z

    1. Initial program 73.0%

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

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

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

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

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

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

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

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

Alternative 15: 47.2% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 81.6%

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

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

    if -0.105999999999999997 < (/.f64 x y) < 1.26e21

    1. Initial program 86.1%

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

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

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

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

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

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

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

Alternative 16: 99.1% accurate, 1.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \frac{x}{y}\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in t around inf 98.3%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 17: 19.7% accurate, 5.7× speedup?

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

\\
\frac{2}{t}
\end{array}
Derivation
  1. Initial program 83.8%

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{2}{t}} \]
  7. Final simplification18.0%

    \[\leadsto \frac{2}{t} \]
  8. Add Preprocessing

Developer target: 99.1% accurate, 1.3× speedup?

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

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

Reproduce

?
herbie shell --seed 2024053 
(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))))