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

Percentage Accurate: 86.5% → 99.1%
Time: 13.2s
Alternatives: 15
Speedup: 1.1×

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 15 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.5% 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.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 69.9% accurate, 0.6× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 x y) < -1.9999999999999999e35 or 1.99999999999999991e-6 < (/.f64 x y)

    1. Initial program 83.0%

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

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

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

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

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

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

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

    if -1.9999999999999999e35 < (/.f64 x y) < -1e-3

    1. Initial program 88.9%

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

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

    if -1e-3 < (/.f64 x y) < 1.99999999999999991e-6

    1. Initial program 87.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\frac{2}{z}}{t} + \frac{2}{t}\right) + \color{blue}{-2} \]
      9. associate-+r+99.9%

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{z}}{t} \]
      12. associate-+l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.6% accurate, 0.6× speedup?

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

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

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


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

    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 0 97.2%

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

    if -5e6 < (/.f64 x y) < 1e-26

    1. Initial program 87.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\frac{2}{z}}{t} + \frac{2}{t}\right) + \color{blue}{-2} \]
      9. associate-+r+99.9%

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{z}}{t} \]
      12. associate-+l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 65.4% accurate, 0.7× speedup?

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

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

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

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

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


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

    1. Initial program 85.0%

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

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

    if -1.9999999999999999e35 < (/.f64 x y) < -1e-3

    1. Initial program 88.9%

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

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

    if -1e-3 < (/.f64 x y) < 1e6

    1. Initial program 87.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\frac{2}{z}}{t} + \frac{2}{t}\right) + \color{blue}{-2} \]
      9. associate-+r+99.9%

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{z}}{t} \]
      12. associate-+l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e6 < (/.f64 x y)

    1. Initial program 80.5%

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

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

Alternative 5: 90.7% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 85.0%

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

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

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

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

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

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

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

    if -1.9999999999999999e35 < (/.f64 x y) < 1e6

    1. Initial program 87.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\frac{2}{z}}{t} + \frac{2}{t}\right) + \color{blue}{-2} \]
      9. associate-+r+99.2%

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{z}}{t} \]
      12. associate-+l+99.2%

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

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

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

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

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

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

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

    if 1e6 < (/.f64 x y)

    1. Initial program 80.5%

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

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

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

Alternative 6: 51.1% accurate, 0.7× speedup?

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

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

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

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

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


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

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

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

    if -5.00000000000000024e-5 < (/.f64 x y) < 5.0000000000000002e-197

    1. Initial program 85.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\frac{2}{z}}{t} + \frac{2}{t}\right) + \color{blue}{-2} \]
      9. associate-+r+99.9%

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{z}}{t} \]
      12. associate-+l+99.9%

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

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

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

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

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

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

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

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

    if 5.0000000000000002e-197 < (/.f64 x y) < 1e6

    1. Initial program 94.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 78.6%

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

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

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

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

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

Alternative 7: 90.7% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 85.0%

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

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

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

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

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

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

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

    if -1.9999999999999999e35 < (/.f64 x y) < 1e6

    1. Initial program 87.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\frac{2}{z}}{t} + \frac{2}{t}\right) + \color{blue}{-2} \]
      9. associate-+r+99.2%

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{z}}{t} \]
      12. associate-+l+99.2%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(2 \cdot \frac{1}{t} + 2 \cdot \frac{1}{t \cdot z}\right) - 2} \]
    10. Step-by-step derivation
      1. associate--l+99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e6 < (/.f64 x y)

    1. Initial program 80.5%

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

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

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

Alternative 8: 75.0% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 83.7%

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

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

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

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

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

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

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

    if -1.9999999999999999e35 < (/.f64 x y) < 1.0000000000000001e-33

    1. Initial program 87.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\frac{2}{z}}{t} + \frac{2}{t}\right) + \color{blue}{-2} \]
      9. associate-+r+99.2%

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{z}}{t} \]
      12. associate-+l+99.2%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(2 \cdot \frac{1}{t} + 2 \cdot \frac{1}{t \cdot z}\right) - 2} \]
    10. Step-by-step derivation
      1. associate--l+99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 91.1% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.24999999999999994e-7 or 2.6499999999999998e-86 < z

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.24999999999999994e-7 < z < 2.6499999999999998e-86

    1. Initial program 96.8%

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

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

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

Alternative 10: 85.5% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.50000000000000006e-49 or 5.5000000000000003e-68 < z

    1. Initial program 78.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.50000000000000006e-49 < z < 5.5000000000000003e-68

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\frac{2}{z}}{t} + \frac{2}{t}\right) + \color{blue}{-2} \]
      9. associate-+r+79.3%

        \[\leadsto \color{blue}{\frac{\frac{2}{z}}{t} + \left(\frac{2}{t} + -2\right)} \]
      10. +-commutative79.3%

        \[\leadsto \color{blue}{\left(\frac{2}{t} + -2\right) + \frac{\frac{2}{z}}{t}} \]
      11. +-commutative79.3%

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{z}}{t} \]
      12. associate-+l+79.3%

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

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

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

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

        \[\leadsto -2 + \left(\frac{2}{t} + \color{blue}{\frac{1}{z} \cdot \frac{2}{t}}\right) \]
      17. distribute-rgt1-in79.3%

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

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

      \[\leadsto \color{blue}{\left(2 \cdot \frac{1}{t} + 2 \cdot \frac{1}{t \cdot z}\right) - 2} \]
    10. Step-by-step derivation
      1. associate--l+79.3%

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{t} + \left(\color{blue}{\frac{\frac{2}{z}}{t}} + \left(-2\right)\right) \]
      9. *-rgt-identity79.3%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{2 + \frac{2}{z}}}{t} + -2 \]
    11. Simplified79.3%

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

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

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

Alternative 11: 65.3% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -50000000 \lor \neg \left(\frac{x}{y} \leq 1000000\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) < -5e7 or 1e6 < (/.f64 x y)

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

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

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

    1. Initial program 88.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\frac{2}{z}}{t} + \frac{2}{t}\right) + \color{blue}{-2} \]
      9. associate-+r+99.9%

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{z}}{t} \]
      12. associate-+l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 65.1% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -50000000 \lor \neg \left(\frac{x}{y} \leq 1000000\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) < -5e7 or 1e6 < (/.f64 x y)

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

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

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

    1. Initial program 88.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\frac{2}{z}}{t} + \frac{2}{t}\right) + \color{blue}{-2} \]
      9. associate-+r+99.9%

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{z}}{t} \]
      12. associate-+l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 79.4% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.1499999999999999e-43 or 7.49999999999999959e32 < t

    1. Initial program 73.4%

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

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

    if -1.1499999999999999e-43 < t < 7.49999999999999959e32

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

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

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

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

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

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

Alternative 14: 37.2% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 73.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.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\frac{2}{z}}{t} + \frac{2}{t}\right) + \color{blue}{-2} \]
      9. associate-+r+56.5%

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{z}}{t} \]
      12. associate-+l+56.5%

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

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

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

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

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

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

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

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

    if -1.69999999999999996 < t < 9.50000000000000028e-10

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

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

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

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

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

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

Alternative 15: 20.5% accurate, 17.0× speedup?

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

\\
-2
\end{array}
Derivation
  1. Initial program 85.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\frac{\frac{2}{z}}{t} + \frac{2}{t}\right) + \color{blue}{-2} \]
    9. associate-+r+67.6%

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

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

      \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{z}}{t} \]
    12. associate-+l+67.6%

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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

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

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