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

Percentage Accurate: 86.3% → 99.2%
Time: 12.8s
Alternatives: 14
Speedup: 1.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 86.3% accurate, 1.0× speedup?

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

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

Alternative 1: 99.2% accurate, 1.3× speedup?

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

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

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

    \[\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. sub-neg99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \frac{1}{t} \cdot \left(2 + \frac{2}{z}\right)\right)\right)} - 1} \]
    3. associate-*l/42.1%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \color{blue}{\frac{1 \cdot \left(2 + \frac{2}{z}\right)}{t}}\right)\right)} - 1 \]
    4. *-un-lft-identity42.1%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \frac{\color{blue}{2 + \frac{2}{z}}}{t}\right)\right)} - 1 \]
  7. Applied egg-rr42.1%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \frac{2 + \frac{2}{z}}{t}\right)\right)} - 1} \]
  8. Step-by-step derivation
    1. expm1-def42.1%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \frac{2 + \frac{2}{z}}{t}\right)\right)\right)} \]
    2. expm1-log1p99.5%

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

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

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

Alternative 2: 62.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := -2 + \frac{2}{t}\\ t_2 := \frac{2}{z \cdot t}\\ t_3 := \frac{x}{y} + -2\\ \mathbf{if}\;t \leq -3.3 \cdot 10^{-12}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq -1.16 \cdot 10^{-48}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -7.5 \cdot 10^{-194}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -4.5 \cdot 10^{-250}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 0.00092:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ -2.0 (/ 2.0 t))) (t_2 (/ 2.0 (* z t))) (t_3 (+ (/ x y) -2.0)))
   (if (<= t -3.3e-12)
     t_3
     (if (<= t -1.16e-48)
       t_1
       (if (<= t -7.5e-194)
         t_2
         (if (<= t -4.5e-250) t_1 (if (<= t 0.00092) t_2 t_3)))))))
double code(double x, double y, double z, double t) {
	double t_1 = -2.0 + (2.0 / t);
	double t_2 = 2.0 / (z * t);
	double t_3 = (x / y) + -2.0;
	double tmp;
	if (t <= -3.3e-12) {
		tmp = t_3;
	} else if (t <= -1.16e-48) {
		tmp = t_1;
	} else if (t <= -7.5e-194) {
		tmp = t_2;
	} else if (t <= -4.5e-250) {
		tmp = t_1;
	} else if (t <= 0.00092) {
		tmp = t_2;
	} else {
		tmp = t_3;
	}
	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) :: t_3
    real(8) :: tmp
    t_1 = (-2.0d0) + (2.0d0 / t)
    t_2 = 2.0d0 / (z * t)
    t_3 = (x / y) + (-2.0d0)
    if (t <= (-3.3d-12)) then
        tmp = t_3
    else if (t <= (-1.16d-48)) then
        tmp = t_1
    else if (t <= (-7.5d-194)) then
        tmp = t_2
    else if (t <= (-4.5d-250)) then
        tmp = t_1
    else if (t <= 0.00092d0) then
        tmp = t_2
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = -2.0 + (2.0 / t);
	double t_2 = 2.0 / (z * t);
	double t_3 = (x / y) + -2.0;
	double tmp;
	if (t <= -3.3e-12) {
		tmp = t_3;
	} else if (t <= -1.16e-48) {
		tmp = t_1;
	} else if (t <= -7.5e-194) {
		tmp = t_2;
	} else if (t <= -4.5e-250) {
		tmp = t_1;
	} else if (t <= 0.00092) {
		tmp = t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = -2.0 + (2.0 / t)
	t_2 = 2.0 / (z * t)
	t_3 = (x / y) + -2.0
	tmp = 0
	if t <= -3.3e-12:
		tmp = t_3
	elif t <= -1.16e-48:
		tmp = t_1
	elif t <= -7.5e-194:
		tmp = t_2
	elif t <= -4.5e-250:
		tmp = t_1
	elif t <= 0.00092:
		tmp = t_2
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t)
	t_1 = Float64(-2.0 + Float64(2.0 / t))
	t_2 = Float64(2.0 / Float64(z * t))
	t_3 = Float64(Float64(x / y) + -2.0)
	tmp = 0.0
	if (t <= -3.3e-12)
		tmp = t_3;
	elseif (t <= -1.16e-48)
		tmp = t_1;
	elseif (t <= -7.5e-194)
		tmp = t_2;
	elseif (t <= -4.5e-250)
		tmp = t_1;
	elseif (t <= 0.00092)
		tmp = t_2;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = -2.0 + (2.0 / t);
	t_2 = 2.0 / (z * t);
	t_3 = (x / y) + -2.0;
	tmp = 0.0;
	if (t <= -3.3e-12)
		tmp = t_3;
	elseif (t <= -1.16e-48)
		tmp = t_1;
	elseif (t <= -7.5e-194)
		tmp = t_2;
	elseif (t <= -4.5e-250)
		tmp = t_1;
	elseif (t <= 0.00092)
		tmp = t_2;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x / y), $MachinePrecision] + -2.0), $MachinePrecision]}, If[LessEqual[t, -3.3e-12], t$95$3, If[LessEqual[t, -1.16e-48], t$95$1, If[LessEqual[t, -7.5e-194], t$95$2, If[LessEqual[t, -4.5e-250], t$95$1, If[LessEqual[t, 0.00092], t$95$2, t$95$3]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq -1.16 \cdot 10^{-48}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq -7.5 \cdot 10^{-194}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t \leq -4.5 \cdot 10^{-250}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 0.00092:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.3000000000000001e-12 or 9.2000000000000003e-4 < t

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

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

    if -3.3000000000000001e-12 < t < -1.16e-48 or -7.4999999999999998e-194 < t < -4.49999999999999993e-250

    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 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. sub-neg100.0%

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

        \[\leadsto \frac{x}{y} + \left(\left(2 \cdot \frac{1}{t \cdot z} + \frac{\color{blue}{2 \cdot 1}}{t}\right) + \left(-2\right)\right) \]
      3. 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) + \left(-2\right)\right) \]
      4. +-commutative100.0%

        \[\leadsto \frac{x}{y} + \left(\color{blue}{\left(2 \cdot \frac{1}{t} + 2 \cdot \frac{1}{t \cdot z}\right)} + \left(-2\right)\right) \]
      5. 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) + \left(-2\right)\right) \]
      6. metadata-eval100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.16e-48 < t < -7.4999999999999998e-194 or -4.49999999999999993e-250 < t < 9.2000000000000003e-4

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.3 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{y} + -2\\ \mathbf{elif}\;t \leq -1.16 \cdot 10^{-48}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;t \leq -7.5 \cdot 10^{-194}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{elif}\;t \leq -4.5 \cdot 10^{-250}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;t \leq 0.00092:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + -2\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 63.0% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t \leq -5.2 \cdot 10^{-49}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;t \leq -2.15 \cdot 10^{-249}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 0.013:\\
\;\;\;\;\frac{\frac{2}{t}}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -3.4e-15 or 0.0129999999999999994 < t

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

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

    if -3.4e-15 < t < -5.1999999999999999e-49 or -1.8999999999999999e-197 < t < -2.1500000000000001e-249

    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 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. sub-neg100.0%

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

        \[\leadsto \frac{x}{y} + \left(\left(2 \cdot \frac{1}{t \cdot z} + \frac{\color{blue}{2 \cdot 1}}{t}\right) + \left(-2\right)\right) \]
      3. 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) + \left(-2\right)\right) \]
      4. +-commutative100.0%

        \[\leadsto \frac{x}{y} + \left(\color{blue}{\left(2 \cdot \frac{1}{t} + 2 \cdot \frac{1}{t \cdot z}\right)} + \left(-2\right)\right) \]
      5. 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) + \left(-2\right)\right) \]
      6. metadata-eval100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.1999999999999999e-49 < t < -1.8999999999999999e-197

    1. Initial program 96.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.1500000000000001e-249 < t < 0.0129999999999999994

    1. Initial program 99.8%

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

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

        \[\leadsto \frac{x}{y} + \left(\left(2 \cdot \frac{1}{t \cdot z} + \frac{\color{blue}{2 \cdot 1}}{t}\right) + \left(-2\right)\right) \]
      3. 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) + \left(-2\right)\right) \]
      4. +-commutative99.9%

        \[\leadsto \frac{x}{y} + \left(\color{blue}{\left(2 \cdot \frac{1}{t} + 2 \cdot \frac{1}{t \cdot z}\right)} + \left(-2\right)\right) \]
      5. 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) + \left(-2\right)\right) \]
      6. metadata-eval99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \frac{1}{t} \cdot \left(2 + \frac{2}{z}\right)\right)\right)} - 1} \]
      3. associate-*l/67.3%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \color{blue}{\frac{1 \cdot \left(2 + \frac{2}{z}\right)}{t}}\right)\right)} - 1 \]
      4. *-un-lft-identity67.3%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \frac{\color{blue}{2 + \frac{2}{z}}}{t}\right)\right)} - 1 \]
    7. Applied egg-rr67.3%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \frac{2 + \frac{2}{z}}{t}\right)\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def67.3%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.4 \cdot 10^{-15}:\\ \;\;\;\;\frac{x}{y} + -2\\ \mathbf{elif}\;t \leq -5.2 \cdot 10^{-49}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;t \leq -1.9 \cdot 10^{-197}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{elif}\;t \leq -2.15 \cdot 10^{-249}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;t \leq 0.013:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + -2\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 62.9% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t \leq -3.05 \cdot 10^{-49}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq -5.8 \cdot 10^{-198}:\\
\;\;\;\;\frac{2}{t} \cdot \frac{1}{z}\\

\mathbf{elif}\;t \leq -6.5 \cdot 10^{-253}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 0.00048:\\
\;\;\;\;\frac{\frac{2}{t}}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -7.5000000000000004e-13 or 4.80000000000000012e-4 < t

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

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

    if -7.5000000000000004e-13 < t < -3.04999999999999982e-49 or -5.80000000000000001e-198 < t < -6.4999999999999998e-253

    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 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. sub-neg100.0%

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

        \[\leadsto \frac{x}{y} + \left(\left(2 \cdot \frac{1}{t \cdot z} + \frac{\color{blue}{2 \cdot 1}}{t}\right) + \left(-2\right)\right) \]
      3. 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) + \left(-2\right)\right) \]
      4. +-commutative100.0%

        \[\leadsto \frac{x}{y} + \left(\color{blue}{\left(2 \cdot \frac{1}{t} + 2 \cdot \frac{1}{t \cdot z}\right)} + \left(-2\right)\right) \]
      5. 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) + \left(-2\right)\right) \]
      6. metadata-eval100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.04999999999999982e-49 < t < -5.80000000000000001e-198

    1. Initial program 96.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \frac{1}{t} \cdot \left(2 + \frac{2}{z}\right)\right)\right)} - 1} \]
      3. associate-*l/50.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \color{blue}{\frac{1 \cdot \left(2 + \frac{2}{z}\right)}{t}}\right)\right)} - 1 \]
      4. *-un-lft-identity50.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \frac{\color{blue}{2 + \frac{2}{z}}}{t}\right)\right)} - 1 \]
    7. Applied egg-rr50.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \frac{2 + \frac{2}{z}}{t}\right)\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def50.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \frac{2 + \frac{2}{z}}{t}\right)\right)\right)} \]
      2. expm1-log1p96.2%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{2}{t}}{z}} \]
    13. Step-by-step derivation
      1. div-inv63.3%

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

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

    if -6.4999999999999998e-253 < t < 4.80000000000000012e-4

    1. Initial program 99.8%

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

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

        \[\leadsto \frac{x}{y} + \left(\left(2 \cdot \frac{1}{t \cdot z} + \frac{\color{blue}{2 \cdot 1}}{t}\right) + \left(-2\right)\right) \]
      3. 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) + \left(-2\right)\right) \]
      4. +-commutative99.9%

        \[\leadsto \frac{x}{y} + \left(\color{blue}{\left(2 \cdot \frac{1}{t} + 2 \cdot \frac{1}{t \cdot z}\right)} + \left(-2\right)\right) \]
      5. 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) + \left(-2\right)\right) \]
      6. metadata-eval99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \frac{1}{t} \cdot \left(2 + \frac{2}{z}\right)\right)\right)} - 1} \]
      3. associate-*l/67.3%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \color{blue}{\frac{1 \cdot \left(2 + \frac{2}{z}\right)}{t}}\right)\right)} - 1 \]
      4. *-un-lft-identity67.3%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \frac{\color{blue}{2 + \frac{2}{z}}}{t}\right)\right)} - 1 \]
    7. Applied egg-rr67.3%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \frac{2 + \frac{2}{z}}{t}\right)\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def67.3%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -7.5 \cdot 10^{-13}:\\ \;\;\;\;\frac{x}{y} + -2\\ \mathbf{elif}\;t \leq -3.05 \cdot 10^{-49}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;t \leq -5.8 \cdot 10^{-198}:\\ \;\;\;\;\frac{2}{t} \cdot \frac{1}{z}\\ \mathbf{elif}\;t \leq -6.5 \cdot 10^{-253}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;t \leq 0.00048:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + -2\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 92.7% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 87.4%

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

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

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

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

    if -5e19 < (/.f64 x y) < 2.6500000000000001e50

    1. Initial program 84.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \frac{1}{t} \cdot \left(2 + \frac{2}{z}\right)\right)\right)} - 1} \]
      3. associate-*l/34.8%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \color{blue}{\frac{1 \cdot \left(2 + \frac{2}{z}\right)}{t}}\right)\right)} - 1 \]
      4. *-un-lft-identity34.8%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \frac{\color{blue}{2 + \frac{2}{z}}}{t}\right)\right)} - 1 \]
    7. Applied egg-rr34.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{y} + \left(-2 + \frac{2 + \frac{2}{z}}{t}\right)\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def34.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{1 \cdot \frac{2 + \frac{2}{z}}{t}} + -2 \]
      19. *-lft-identity96.5%

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

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

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

Alternative 6: 71.3% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 87.2%

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

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

    if -7.2e19 < (/.f64 x y) < 8.40000000000000005e80

    1. Initial program 85.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.40000000000000005e80 < (/.f64 x y)

    1. Initial program 86.2%

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

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

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

Alternative 7: 65.7% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2.1 \cdot 10^{+16} \lor \neg \left(\frac{x}{y} \leq 2.65 \cdot 10^{+50}\right):\\
\;\;\;\;\frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -2.1e16 or 2.6500000000000001e50 < (/.f64 x y)

    1. Initial program 87.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 80.4%

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

    if -2.1e16 < (/.f64 x y) < 2.6500000000000001e50

    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 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. sub-neg99.9%

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

        \[\leadsto \frac{x}{y} + \left(\left(2 \cdot \frac{1}{t \cdot z} + \frac{\color{blue}{2 \cdot 1}}{t}\right) + \left(-2\right)\right) \]
      3. 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) + \left(-2\right)\right) \]
      4. +-commutative99.9%

        \[\leadsto \frac{x}{y} + \left(\color{blue}{\left(2 \cdot \frac{1}{t} + 2 \cdot \frac{1}{t \cdot z}\right)} + \left(-2\right)\right) \]
      5. 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) + \left(-2\right)\right) \]
      6. metadata-eval99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 66.5% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -4.2 \cdot 10^{-6} \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{-14}\right):\\
\;\;\;\;\frac{x}{y} + -2\\

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


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

    1. Initial program 88.9%

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

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

    if -4.1999999999999996e-6 < (/.f64 x y) < 4e-14

    1. Initial program 82.8%

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

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

        \[\leadsto \frac{x}{y} + \left(\left(2 \cdot \frac{1}{t \cdot z} + \frac{\color{blue}{2 \cdot 1}}{t}\right) + \left(-2\right)\right) \]
      3. 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) + \left(-2\right)\right) \]
      4. +-commutative99.9%

        \[\leadsto \frac{x}{y} + \left(\color{blue}{\left(2 \cdot \frac{1}{t} + 2 \cdot \frac{1}{t \cdot z}\right)} + \left(-2\right)\right) \]
      5. 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) + \left(-2\right)\right) \]
      6. metadata-eval99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 91.6% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.9000000000000001e-31 or 2.29999999999999996e-86 < z

    1. Initial program 76.1%

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

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

        \[\leadsto \frac{x}{y} + \left(\left(2 \cdot \frac{1}{t \cdot z} + \frac{\color{blue}{2 \cdot 1}}{t}\right) + \left(-2\right)\right) \]
      3. 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) + \left(-2\right)\right) \]
      4. +-commutative100.0%

        \[\leadsto \frac{x}{y} + \left(\color{blue}{\left(2 \cdot \frac{1}{t} + 2 \cdot \frac{1}{t \cdot z}\right)} + \left(-2\right)\right) \]
      5. 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) + \left(-2\right)\right) \]
      6. metadata-eval100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.9000000000000001e-31 < z < 2.29999999999999996e-86

    1. Initial program 98.9%

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

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

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

Alternative 10: 91.6% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.81999999999999987e-29 or 2.29999999999999996e-86 < z

    1. Initial program 76.1%

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

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

        \[\leadsto \frac{x}{y} + \left(\left(2 \cdot \frac{1}{t \cdot z} + \frac{\color{blue}{2 \cdot 1}}{t}\right) + \left(-2\right)\right) \]
      3. 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) + \left(-2\right)\right) \]
      4. +-commutative100.0%

        \[\leadsto \frac{x}{y} + \left(\color{blue}{\left(2 \cdot \frac{1}{t} + 2 \cdot \frac{1}{t \cdot z}\right)} + \left(-2\right)\right) \]
      5. 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) + \left(-2\right)\right) \]
      6. metadata-eval100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.81999999999999987e-29 < z < 2.29999999999999996e-86

    1. Initial program 98.9%

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

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

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

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

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

Alternative 11: 53.6% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 88.8%

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

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

    if -6.59999999999999954e-8 < (/.f64 x y) < 2

    1. Initial program 82.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 80.5% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.55000000000000002e-9 or 0.035000000000000003 < t

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

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

    if -1.55000000000000002e-9 < t < 0.035000000000000003

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

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

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

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

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

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

Alternative 13: 80.6% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;t \leq 0.043:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -7.50000000000000081e-68

    1. Initial program 81.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.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. sub-neg98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.50000000000000081e-68 < t < 0.042999999999999997

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

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

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

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

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

    if 0.042999999999999997 < t

    1. Initial program 72.6%

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

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

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

Alternative 14: 20.6% accurate, 17.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 2 \cdot \color{blue}{-1} \]
  7. Final simplification22.3%

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

Developer target: 99.2% 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 2024019 
(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))))