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

Percentage Accurate: 86.4% → 99.0%
Time: 11.4s
Alternatives: 11
Speedup: 1.1×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 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.4% 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.0% accurate, 1.1× speedup?

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

\\
\frac{x}{y} + \left(-2 + \frac{1}{t} \cdot \left(2 + \frac{2}{z}\right)\right)
\end{array}
Derivation
  1. Initial program 86.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 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.7%

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

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

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

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

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

Alternative 2: 84.3% accurate, 0.5× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 x y) < -3.80000000000000022e73 or 1.3199999999999999e156 < (/.f64 x y)

    1. Initial program 82.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 x around inf 85.0%

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

    if -3.80000000000000022e73 < (/.f64 x y) < 1e-13

    1. Initial program 88.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e-13 < (/.f64 x y) < 3.6999999999999998e126

    1. Initial program 87.9%

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

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

    if 3.6999999999999998e126 < (/.f64 x y) < 1.3199999999999999e156

    1. Initial program 99.6%

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

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

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

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

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

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

Alternative 3: 60.6% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;z \leq -2.7 \cdot 10^{-162}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 8.2 \cdot 10^{+26}:\\
\;\;\;\;\frac{2}{t \cdot z}\\

\mathbf{elif}\;z \leq 5.5 \cdot 10^{+215} \lor \neg \left(z \leq 7.6 \cdot 10^{+283}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.04999999999999995e145 or 5.5e215 < z < 7.6000000000000004e283

    1. Initial program 58.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 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 79.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2 + \frac{2}{z}}{t} + \color{blue}{-2} \]
      10. +-commutative79.0%

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

      \[\leadsto \color{blue}{-2 + \frac{2 + \frac{2}{z}}{t}} \]
    9. Step-by-step derivation
      1. *-un-lft-identity79.0%

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

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

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

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

    if -1.04999999999999995e145 < z < -2.69999999999999984e-162 or 8.19999999999999967e26 < z < 5.5e215 or 7.6000000000000004e283 < z

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

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

    if -2.69999999999999984e-162 < z < 8.19999999999999967e26

    1. Initial program 96.7%

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

        \[\leadsto \frac{x}{y} + \left(\left(2 \cdot \frac{1}{t} + \frac{2}{t \cdot z}\right) + \color{blue}{-2}\right) \]
      8. +-commutative96.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/96.7%

        \[\leadsto \frac{x}{y} + \left(-2 + \left(2 \cdot \frac{1}{t} + \color{blue}{\frac{\frac{2}{z}}{t}}\right)\right) \]
      10. metadata-eval96.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/96.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-identity96.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/96.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-out96.7%

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

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

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

      \[\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 69.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.05 \cdot 10^{+145}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;z \leq -2.7 \cdot 10^{-162}:\\ \;\;\;\;\frac{x}{y} + -2\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{+26}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{+215} \lor \neg \left(z \leq 7.6 \cdot 10^{+283}\right):\\ \;\;\;\;\frac{x}{y} + -2\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 60.6% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;z \leq -1.25 \cdot 10^{-161}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 8.2 \cdot 10^{+26}:\\
\;\;\;\;\frac{\frac{2}{z}}{t}\\

\mathbf{elif}\;z \leq 5.5 \cdot 10^{+215} \lor \neg \left(z \leq 2.5 \cdot 10^{+284}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.9999999999999996e144 or 5.5e215 < z < 2.5e284

    1. Initial program 58.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 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 79.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2 + \frac{2}{z}}{t} + \color{blue}{-2} \]
      10. +-commutative79.0%

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

      \[\leadsto \color{blue}{-2 + \frac{2 + \frac{2}{z}}{t}} \]
    9. Step-by-step derivation
      1. *-un-lft-identity79.0%

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

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

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

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

    if -6.9999999999999996e144 < z < -1.25e-161 or 8.19999999999999967e26 < z < 5.5e215 or 2.5e284 < z

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

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

    if -1.25e-161 < z < 8.19999999999999967e26

    1. Initial program 96.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \color{blue}{\frac{\frac{1}{t}}{z}} \]
    8. Simplified69.3%

      \[\leadsto 2 \cdot \color{blue}{\frac{\frac{1}{t}}{z}} \]
    9. Taylor expanded in t around 0 69.3%

      \[\leadsto \color{blue}{\frac{2}{t \cdot z}} \]
    10. Step-by-step derivation
      1. associate-/l/69.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7 \cdot 10^{+144}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;z \leq -1.25 \cdot 10^{-161}:\\ \;\;\;\;\frac{x}{y} + -2\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{+26}:\\ \;\;\;\;\frac{\frac{2}{z}}{t}\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{+215} \lor \neg \left(z \leq 2.5 \cdot 10^{+284}\right):\\ \;\;\;\;\frac{x}{y} + -2\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 93.3% accurate, 0.7× speedup?

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

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

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


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

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

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

    if -4.2e12 < (/.f64 x y) < 245

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 93.3% accurate, 0.7× speedup?

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

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

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

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


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

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

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

    if -4.2e12 < (/.f64 x y) < 3550

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3550 < (/.f64 x y)

    1. Initial program 90.7%

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

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

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

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

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

Alternative 7: 65.5% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -14000000000000 \lor \neg \left(\frac{x}{y} \leq 15500\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) < -1.4e13 or 15500 < (/.f64 x y)

    1. Initial program 86.9%

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

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

    if -1.4e13 < (/.f64 x y) < 15500

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-2 + \frac{2 + \frac{2}{z}}{t}} \]
    9. Step-by-step derivation
      1. *-un-lft-identity98.8%

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

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

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

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

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

Alternative 8: 65.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -3100000000000 \lor \neg \left(\frac{x}{y} \leq 10^{-13}\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) -3100000000000.0) (not (<= (/ x y) 1e-13)))
   (+ (/ x y) -2.0)
   (+ -2.0 (/ 2.0 t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x / y) <= -3100000000000.0) || !((x / y) <= 1e-13)) {
		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) <= (-3100000000000.0d0)) .or. (.not. ((x / y) <= 1d-13))) 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) <= -3100000000000.0) || !((x / y) <= 1e-13)) {
		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) <= -3100000000000.0) or not ((x / y) <= 1e-13):
		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) <= -3100000000000.0) || !(Float64(x / y) <= 1e-13))
		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) <= -3100000000000.0) || ~(((x / y) <= 1e-13)))
		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], -3100000000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1e-13]], $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 -3100000000000 \lor \neg \left(\frac{x}{y} \leq 10^{-13}\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) < -3.1e12 or 1e-13 < (/.f64 x y)

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

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

    if -3.1e12 < (/.f64 x y) < 1e-13

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-2 + \frac{2 + \frac{2}{z}}{t}} \]
    9. Step-by-step derivation
      1. *-un-lft-identity99.5%

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

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

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

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

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

Alternative 9: 52.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -46000 \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) -46000.0) (not (<= (/ x y) 2.0))) (/ x y) -2.0))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x / y) <= -46000.0) || !((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) <= (-46000.0d0)) .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) <= -46000.0) || !((x / y) <= 2.0)) {
		tmp = x / y;
	} else {
		tmp = -2.0;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x / y) <= -46000.0) 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) <= -46000.0) || !(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) <= -46000.0) || ~(((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], -46000.0], 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 -46000 \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) < -46000 or 2 < (/.f64 x y)

    1. Initial program 87.0%

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

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

    if -46000 < (/.f64 x y) < 2

    1. Initial program 86.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(1 - t\right) \cdot z + 1}, \frac{2}{t \cdot z}, -\frac{-x}{y}\right) \]
      12. *-commutative86.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-def86.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. *-commutative86.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-neg86.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-neg86.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. Simplified86.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 x around 0 85.2%

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

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

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

Alternative 10: 80.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -4.5 \cdot 10^{-21} \lor \neg \left(t \leq 0.0013\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 -4.5e-21) (not (<= t 0.0013)))
   (+ (/ x y) -2.0)
   (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -4.5e-21) || !(t <= 0.0013)) {
		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 <= (-4.5d-21)) .or. (.not. (t <= 0.0013d0))) 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 <= -4.5e-21) || !(t <= 0.0013)) {
		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 <= -4.5e-21) or not (t <= 0.0013):
		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 <= -4.5e-21) || !(t <= 0.0013))
		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 <= -4.5e-21) || ~((t <= 0.0013)))
		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, -4.5e-21], N[Not[LessEqual[t, 0.0013]], $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 -4.5 \cdot 10^{-21} \lor \neg \left(t \leq 0.0013\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 < -4.49999999999999968e-21 or 0.0012999999999999999 < t

    1. Initial program 78.2%

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

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

    if -4.49999999999999968e-21 < t < 0.0012999999999999999

    1. Initial program 97.2%

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

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

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

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

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

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

Alternative 11: 20.0% 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 86.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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 58.5%

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

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

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

Developer target: 99.0% accurate, 1.3× speedup?

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

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

Reproduce

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