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

Percentage Accurate: 85.9% → 99.2%
Time: 11.2s
Alternatives: 16
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 16 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: 85.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.2% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 54.1% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;\frac{x}{y} \leq 0.000118:\\
\;\;\;\;-2\\

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

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


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

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

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

    if -2 < (/.f64 x y) < 1.18e-4

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.18e-4 < (/.f64 x y) < 6.8e45

    1. Initial program 90.9%

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

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

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

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

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

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

Alternative 3: 98.5% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.7e5 or 0.160000000000000003 < t

    1. Initial program 71.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.7e5 < t < 0.160000000000000003

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

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

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

Alternative 4: 88.7% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 79.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 97.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.0000000000000001e-13 < (/.f64 x y) < 4.0000000000000001e85

    1. Initial program 90.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{\left(\frac{2}{t \cdot z} + \left(\frac{2}{t} + -2\right)\right)} \]
    6. Taylor expanded in x around 0 97.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-neg97.5%

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

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

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

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

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

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

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

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

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

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

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

    if 4.0000000000000001e85 < (/.f64 x y)

    1. Initial program 78.5%

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

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

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

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

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

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

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

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

Alternative 5: 71.3% accurate, 0.8× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.5999999999999999e-25 or 9.49999999999999947e101 < z

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

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

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

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

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

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

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

    if -3.5999999999999999e-25 < z < 6.8e10

    1. Initial program 97.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.8e10 < z < 9.49999999999999947e101

    1. Initial program 77.3%

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

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

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

Alternative 6: 71.3% accurate, 0.8× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.9e-25 or 7.7999999999999997e102 < z

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

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

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

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

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

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

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

    if -3.9e-25 < z < 6.8e10

    1. Initial program 97.5%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{1}{t \cdot z} - 2} \]
    7. Step-by-step derivation
      1. sub-neg78.6%

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

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

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

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

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

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

    if 6.8e10 < z < 7.7999999999999997e102

    1. Initial program 77.3%

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

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

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

Alternative 7: 67.0% accurate, 0.8× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.15e-25 or 1.5e103 < z

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

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

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

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

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

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

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

    if -1.15e-25 < z < 2.29999999999999978e-171

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

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

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

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

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

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

    if 2.29999999999999978e-171 < z < 1.5e103

    1. Initial program 90.0%

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

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

Alternative 8: 98.6% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.79999999999999982 or 4.3000000000000002e-5 < z

    1. Initial program 73.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.79999999999999982 < z < 4.3000000000000002e-5

    1. Initial program 97.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 63.9% accurate, 0.8× speedup?

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

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

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

\mathbf{elif}\;z \leq 1.2 \cdot 10^{+160}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -7.2000000000000004e-70 or 2.60000000000000005e-171 < z < 1.2000000000000001e160

    1. Initial program 83.8%

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

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

    if -7.2000000000000004e-70 < z < 2.60000000000000005e-171

    1. Initial program 97.4%

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

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

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

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

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

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

    if 1.2000000000000001e160 < z

    1. Initial program 66.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 63.9% accurate, 0.8× speedup?

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

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

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

\mathbf{elif}\;z \leq 1.25 \cdot 10^{+160}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.4000000000000001e-69 or 2.1e-171 < z < 1.25e160

    1. Initial program 83.8%

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

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

    if -2.4000000000000001e-69 < z < 2.1e-171

    1. Initial program 97.4%

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

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

    if 1.25e160 < z

    1. Initial program 66.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 85.3% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.8999999999999999e-25 or 1.0999999999999999e-8 < z

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8999999999999999e-25 < z < 1.0999999999999999e-8

    1. Initial program 97.4%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{\left(\frac{2}{t \cdot z} + \left(\frac{2}{t} + -2\right)\right)} \]
    6. Taylor expanded in x around 0 79.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-neg79.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 64.4% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -1.19999999999999996e96 or 7.9999999999999994e45 < (/.f64 x y)

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

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

    if -1.19999999999999996e96 < (/.f64 x y) < 7.9999999999999994e45

    1. Initial program 89.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 66.0% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -0.00115:\\
\;\;\;\;\frac{x}{y} - 2\\

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

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


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

    1. Initial program 79.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 65.9%

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

    if -0.00115 < (/.f64 x y) < 5.5999999999999999e45

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.5999999999999999e45 < (/.f64 x y)

    1. Initial program 80.8%

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

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

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

Alternative 14: 80.4% accurate, 1.0× speedup?

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

    1. Initial program 72.0%

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

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

    if -0.0019 < t < 2.1999999999999999e-10

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

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

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

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

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

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

Alternative 15: 35.5% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;t \leq 6.5 \cdot 10^{+30}:\\
\;\;\;\;\frac{2}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -11000 or 6.5e30 < t

    1. Initial program 70.6%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{\left(\frac{2}{t \cdot z} + \left(\frac{2}{t} + -2\right)\right)} \]
    6. Taylor expanded in x around 0 58.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-neg58.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -11000 < t < 6.5e30

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

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

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

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

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

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

Alternative 16: 20.2% accurate, 17.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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

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

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