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

Percentage Accurate: 86.7% → 99.1%
Time: 13.6s
Alternatives: 14
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 14 alternatives:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 78.4% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t \leq 1.8 \cdot 10^{-56}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;t \leq 1080000000000:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -4.80000000000000017e-44 or 1.08e12 < 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 88.7%

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

    if -4.80000000000000017e-44 < t < 1.79999999999999989e-56 or 4.69999999999999992e-24 < t < 1.08e12

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

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

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

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

      \[\leadsto \color{blue}{\frac{2 + \frac{2}{z}}{t}} \]
    6. Step-by-step derivation
      1. div-inv83.2%

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

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

    if 1.79999999999999989e-56 < t < 4.69999999999999992e-24

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

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

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

Alternative 3: 78.5% accurate, 0.6× speedup?

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

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

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

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

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -6.0000000000000005e-44 or 1.08e12 < 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 88.7%

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

    if -6.0000000000000005e-44 < t < 8.99999999999999945e-57

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.99999999999999945e-57 < t < 2.40000000000000002e-22

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

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

    if 2.40000000000000002e-22 < t < 1.08e12

    1. Initial program 99.7%

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

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

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

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

      \[\leadsto \color{blue}{\frac{2 + \frac{2}{z}}{t}} \]
    6. Step-by-step derivation
      1. div-inv85.9%

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

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

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

Alternative 4: 78.4% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t \leq 1.82 \cdot 10^{-56}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 10^{-21}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;t \leq 1080000000000:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.49999999999999988e-45 or 1.08e12 < 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 88.7%

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

    if -2.49999999999999988e-45 < t < 1.82000000000000007e-56 or 9.99999999999999908e-22 < t < 1.08e12

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

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

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

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

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

    if 1.82000000000000007e-56 < t < 9.99999999999999908e-22

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

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

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

Alternative 5: 65.4% accurate, 0.7× speedup?

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

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

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

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

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -1.85e-45 or 1.05000000000000003e-56 < t

    1. Initial program 75.3%

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

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

    if -1.85e-45 < t < -7.6000000000000001e-245

    1. Initial program 97.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.6000000000000001e-245 < t < 1.92e-84

    1. Initial program 93.5%

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

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

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

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

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

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

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

    if 1.92e-84 < t < 1.05000000000000003e-56

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.85 \cdot 10^{-45}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;t \leq -7.6 \cdot 10^{-245}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;t \leq 1.92 \cdot 10^{-84}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{elif}\;t \leq 1.05 \cdot 10^{-56}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 98.2% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 84.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -32000 < (/.f64 x y) < 3.7999999999999998e-11

    1. Initial program 83.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 61.1% accurate, 0.8× speedup?

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

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

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

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.89999999999999999e-45 or 9.99999999999999915e-146 < t

    1. Initial program 78.8%

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

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

    if -1.89999999999999999e-45 < t < -7.5000000000000004e-294

    1. Initial program 96.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.5000000000000004e-294 < t < 9.99999999999999915e-146

    1. Initial program 90.1%

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

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

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

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

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

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

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

Alternative 8: 60.9% accurate, 0.8× speedup?

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

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

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

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -4.39999999999999987e-45 or 2.8999999999999998e-150 < t

    1. Initial program 78.8%

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

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

    if -4.39999999999999987e-45 < t < -8.99999999999999963e-294

    1. Initial program 96.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.99999999999999963e-294 < t < 2.8999999999999998e-150

    1. Initial program 90.1%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4.4 \cdot 10^{-45}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;t \leq -9 \cdot 10^{-294}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;t \leq 2.9 \cdot 10^{-150}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 65.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -3500000000 \lor \neg \left(\frac{x}{y} \leq 9500000\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) -3500000000.0) (not (<= (/ x y) 9500000.0)))
   (/ x y)
   (+ (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x / y) <= -3500000000.0) || !((x / y) <= 9500000.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) <= (-3500000000.0d0)) .or. (.not. ((x / y) <= 9500000.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) <= -3500000000.0) || !((x / y) <= 9500000.0)) {
		tmp = x / y;
	} else {
		tmp = (2.0 / t) + -2.0;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x / y) <= -3500000000.0) or not ((x / y) <= 9500000.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) <= -3500000000.0) || !(Float64(x / y) <= 9500000.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) <= -3500000000.0) || ~(((x / y) <= 9500000.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], -3500000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 9500000.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 -3500000000 \lor \neg \left(\frac{x}{y} \leq 9500000\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) < -3.5e9 or 9.5e6 < (/.f64 x y)

    1. Initial program 84.5%

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

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

    if -3.5e9 < (/.f64 x y) < 9.5e6

    1. Initial program 83.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 80.3% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.4999999999999999e-45 or 4.85e-57 < t

    1. Initial program 75.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.4999999999999999e-45 < t < 4.85e-57

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 92.3% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.69999999999999987e-7 or 3.6e-10 < z

    1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.69999999999999987e-7 < z < 3.6e-10

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

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

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

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

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

Alternative 12: 65.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -5800000000000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 8500000:\\ \;\;\;\;\frac{2}{t} + -2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (/ x y) -5800000000000.0)
   (/ x y)
   (if (<= (/ x y) 8500000.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) <= -5800000000000.0) {
		tmp = x / y;
	} else if ((x / y) <= 8500000.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) <= (-5800000000000.0d0)) then
        tmp = x / y
    else if ((x / y) <= 8500000.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) <= -5800000000000.0) {
		tmp = x / y;
	} else if ((x / y) <= 8500000.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) <= -5800000000000.0:
		tmp = x / y
	elif (x / y) <= 8500000.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) <= -5800000000000.0)
		tmp = Float64(x / y);
	elseif (Float64(x / y) <= 8500000.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) <= -5800000000000.0)
		tmp = x / y;
	elseif ((x / y) <= 8500000.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], -5800000000000.0], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 8500000.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 -5800000000000:\\
\;\;\;\;\frac{x}{y}\\

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

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


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

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

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

    if -5.8e12 < (/.f64 x y) < 8.5e6

    1. Initial program 83.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.5e6 < (/.f64 x y)

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

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

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

Alternative 13: 47.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -3900000000000 \lor \neg \left(\frac{x}{y} \leq 370000\right):\\
\;\;\;\;\frac{x}{y}\\

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


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

    1. Initial program 84.5%

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

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

    if -3.9e12 < (/.f64 x y) < 3.7e5

    1. Initial program 83.9%

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

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

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

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

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

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

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

Alternative 14: 18.5% accurate, 5.7× speedup?

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

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

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

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

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

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

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

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

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

Developer target: 99.1% accurate, 1.3× speedup?

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

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

Reproduce

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

  :herbie-target
  (- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y)))

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