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

Percentage Accurate: 86.1% → 99.1%
Time: 9.1s
Alternatives: 10
Speedup: 1.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 86.1% accurate, 1.0× speedup?

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

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

Alternative 1: 99.1% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \frac{x}{y} + \left(\frac{\frac{2}{t}}{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(Float64(2.0 / 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[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 92.6% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -1e21 or 5.00000000000000022e41 < (/.f64 x y)

    1. Initial program 83.4%

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

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

    if -1e21 < (/.f64 x y) < 5.00000000000000022e41

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 62.9% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} - 2\\ \mathbf{if}\;z \leq -2.4 \cdot 10^{+113}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.4 \cdot 10^{+43}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;z \leq -3 \cdot 10^{-28} \lor \neg \left(z \leq 1.55 \cdot 10^{-81}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (/ x y) 2.0)))
   (if (<= z -2.4e+113)
     t_1
     (if (<= z -2.4e+43)
       (/ 2.0 t)
       (if (or (<= z -3e-28) (not (<= z 1.55e-81))) t_1 (/ 2.0 (* t z)))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / y) - 2.0;
	double tmp;
	if (z <= -2.4e+113) {
		tmp = t_1;
	} else if (z <= -2.4e+43) {
		tmp = 2.0 / t;
	} else if ((z <= -3e-28) || !(z <= 1.55e-81)) {
		tmp = t_1;
	} else {
		tmp = 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) :: t_1
    real(8) :: tmp
    t_1 = (x / y) - 2.0d0
    if (z <= (-2.4d+113)) then
        tmp = t_1
    else if (z <= (-2.4d+43)) then
        tmp = 2.0d0 / t
    else if ((z <= (-3d-28)) .or. (.not. (z <= 1.55d-81))) then
        tmp = t_1
    else
        tmp = 2.0d0 / (t * z)
    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+113) {
		tmp = t_1;
	} else if (z <= -2.4e+43) {
		tmp = 2.0 / t;
	} else if ((z <= -3e-28) || !(z <= 1.55e-81)) {
		tmp = t_1;
	} else {
		tmp = 2.0 / (t * z);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / y) - 2.0
	tmp = 0
	if z <= -2.4e+113:
		tmp = t_1
	elif z <= -2.4e+43:
		tmp = 2.0 / t
	elif (z <= -3e-28) or not (z <= 1.55e-81):
		tmp = t_1
	else:
		tmp = 2.0 / (t * z)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x / y) - 2.0)
	tmp = 0.0
	if (z <= -2.4e+113)
		tmp = t_1;
	elseif (z <= -2.4e+43)
		tmp = Float64(2.0 / t);
	elseif ((z <= -3e-28) || !(z <= 1.55e-81))
		tmp = t_1;
	else
		tmp = Float64(2.0 / Float64(t * z));
	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+113)
		tmp = t_1;
	elseif (z <= -2.4e+43)
		tmp = 2.0 / t;
	elseif ((z <= -3e-28) || ~((z <= 1.55e-81)))
		tmp = t_1;
	else
		tmp = 2.0 / (t * z);
	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+113], t$95$1, If[LessEqual[z, -2.4e+43], N[(2.0 / t), $MachinePrecision], If[Or[LessEqual[z, -3e-28], N[Not[LessEqual[z, 1.55e-81]], $MachinePrecision]], t$95$1, N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq -3 \cdot 10^{-28} \lor \neg \left(z \leq 1.55 \cdot 10^{-81}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.39999999999999983e113 or -2.40000000000000023e43 < z < -3.00000000000000003e-28 or 1.54999999999999994e-81 < z

    1. Initial program 74.1%

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

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

    if -2.39999999999999983e113 < z < -2.40000000000000023e43

    1. Initial program 93.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.00000000000000003e-28 < z < 1.54999999999999994e-81

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.4 \cdot 10^{+113}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq -2.4 \cdot 10^{+43}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;z \leq -3 \cdot 10^{-28} \lor \neg \left(z \leq 1.55 \cdot 10^{-81}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \end{array} \]

Alternative 4: 81.7% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.80000000000000026e-28 or 5.39999999999999985e-86 < z

    1. Initial program 76.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.80000000000000026e-28 < z < 5.39999999999999985e-86

    1. Initial program 97.8%

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

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

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

        \[\leadsto \frac{2 + \frac{\color{blue}{2}}{z}}{t} \]
    4. Simplified68.4%

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

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

Alternative 5: 92.3% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.0999999999999998e-27 or 4.69999999999999969e-30 < z

    1. Initial program 74.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.0999999999999998e-27 < z < 4.69999999999999969e-30

    1. Initial program 98.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.1 \cdot 10^{-27} \lor \neg \left(z \leq 4.7 \cdot 10^{-30}\right):\\ \;\;\;\;\frac{x}{y} + \left(\frac{2}{t} + -2\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t \cdot z}\\ \end{array} \]

Alternative 6: 69.5% accurate, 1.5× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -7.2000000000000002e-24 or 4e10 < t

    1. Initial program 68.8%

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

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

    if -7.2000000000000002e-24 < t < 5.50000000000000005e-38

    1. Initial program 98.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.50000000000000005e-38 < t < 4e10

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -7.2 \cdot 10^{-24}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;t \leq 5.5 \cdot 10^{-38}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{elif}\;t \leq 40000000000:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]

Alternative 7: 46.9% accurate, 1.5× speedup?

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

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

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


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

    1. Initial program 84.3%

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

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

    if -8.0000000000000006e-18 < (/.f64 x y) < 1.4e42

    1. Initial program 84.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -8 \cdot 10^{-18} \lor \neg \left(\frac{x}{y} \leq 1.4 \cdot 10^{+42}\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t}\\ \end{array} \]

Alternative 8: 80.5% accurate, 1.5× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.9999999999999999e33 or 3.6e10 < t

    1. Initial program 66.3%

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

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

    if -1.9999999999999999e33 < t < 3.6e10

    1. Initial program 98.3%

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

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

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

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

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

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

Alternative 9: 60.3% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.1 \cdot 10^{-94} \lor \neg \left(t \leq 1.35 \cdot 10^{-149}\right):\\
\;\;\;\;\frac{x}{y} - 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.10000000000000001e-94 or 1.35000000000000007e-149 < t

    1. Initial program 77.7%

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

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

    if -4.10000000000000001e-94 < t < 1.35000000000000007e-149

    1. Initial program 98.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4.1 \cdot 10^{-94} \lor \neg \left(t \leq 1.35 \cdot 10^{-149}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t}\\ \end{array} \]

Alternative 10: 19.6% accurate, 5.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{2}{t}} \]
  10. Final simplification21.0%

    \[\leadsto \frac{2}{t} \]

Developer target: 99.1% accurate, 1.3× speedup?

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

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

Reproduce

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

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

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