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

Percentage Accurate: 86.8% → 99.1%
Time: 15.2s
Alternatives: 14
Speedup: 1.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 63.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} - 2\\ \mathbf{if}\;z \leq -1.55 \cdot 10^{-75}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{-88}:\\ \;\;\;\;2 \cdot \frac{1}{t \cdot z}\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{+68} \lor \neg \left(z \leq 3.3 \cdot 10^{+162}\right):\\ \;\;\;\;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 -1.55e-75)
     t_1
     (if (<= z 4.5e-88)
       (* 2.0 (/ 1.0 (* t z)))
       (if (or (<= z 4.3e+68) (not (<= z 3.3e+162)))
         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 <= -1.55e-75) {
		tmp = t_1;
	} else if (z <= 4.5e-88) {
		tmp = 2.0 * (1.0 / (t * z));
	} else if ((z <= 4.3e+68) || !(z <= 3.3e+162)) {
		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 <= (-1.55d-75)) then
        tmp = t_1
    else if (z <= 4.5d-88) then
        tmp = 2.0d0 * (1.0d0 / (t * z))
    else if ((z <= 4.3d+68) .or. (.not. (z <= 3.3d+162))) 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 <= -1.55e-75) {
		tmp = t_1;
	} else if (z <= 4.5e-88) {
		tmp = 2.0 * (1.0 / (t * z));
	} else if ((z <= 4.3e+68) || !(z <= 3.3e+162)) {
		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 <= -1.55e-75:
		tmp = t_1
	elif z <= 4.5e-88:
		tmp = 2.0 * (1.0 / (t * z))
	elif (z <= 4.3e+68) or not (z <= 3.3e+162):
		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 <= -1.55e-75)
		tmp = t_1;
	elseif (z <= 4.5e-88)
		tmp = Float64(2.0 * Float64(1.0 / Float64(t * z)));
	elseif ((z <= 4.3e+68) || !(z <= 3.3e+162))
		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 <= -1.55e-75)
		tmp = t_1;
	elseif (z <= 4.5e-88)
		tmp = 2.0 * (1.0 / (t * z));
	elseif ((z <= 4.3e+68) || ~((z <= 3.3e+162)))
		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, -1.55e-75], t$95$1, If[LessEqual[z, 4.5e-88], N[(2.0 * N[(1.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 4.3e+68], N[Not[LessEqual[z, 3.3e+162]], $MachinePrecision]], 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 -1.55 \cdot 10^{-75}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 4.3 \cdot 10^{+68} \lor \neg \left(z \leq 3.3 \cdot 10^{+162}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.55000000000000003e-75 or 4.49999999999999991e-88 < z < 4.3000000000000001e68 or 3.29999999999999987e162 < z

    1. Initial program 75.9%

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

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

    if -1.55000000000000003e-75 < z < 4.49999999999999991e-88

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.3000000000000001e68 < z < 3.29999999999999987e162

    1. Initial program 84.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.55 \cdot 10^{-75}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{-88}:\\ \;\;\;\;2 \cdot \frac{1}{t \cdot z}\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{+68} \lor \neg \left(z \leq 3.3 \cdot 10^{+162}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t} + -2\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 92.6% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -3.99999999999999978e58 or 1e11 < (/.f64 x y)

    1. Initial program 86.4%

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

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

    if -3.99999999999999978e58 < (/.f64 x y) < 1e11

    1. Initial program 84.6%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 50.9% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;\frac{x}{y} \leq -3.1 \cdot 10^{-174}:\\
\;\;\;\;\frac{2}{t}\\

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

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


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

    1. Initial program 86.3%

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

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

    if -1.05999999999999997e58 < (/.f64 x y) < -3.0999999999999999e-174

    1. Initial program 94.2%

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

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

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

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

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

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

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

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

    if -3.0999999999999999e-174 < (/.f64 x y) < 0.0539999999999999994

    1. Initial program 81.3%

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

      \[\leadsto \color{blue}{\frac{x}{y} - 2} \]
    4. Taylor expanded in x around 0 43.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1.06 \cdot 10^{+58}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -3.1 \cdot 10^{-174}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 0.054:\\ \;\;\;\;-2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 92.6% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -6.4999999999999997e57 or 6.7e10 < (/.f64 x y)

    1. Initial program 86.4%

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

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

    if -6.4999999999999997e57 < (/.f64 x y) < 6.7e10

    1. Initial program 84.6%

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

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

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

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

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

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

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

Alternative 6: 69.8% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 93.9%

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

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

    if -4.1999999999999997e141 < (/.f64 x y) < 15

    1. Initial program 84.6%

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

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

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

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

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

    if 15 < (/.f64 x y)

    1. Initial program 82.9%

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

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

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

Alternative 7: 64.4% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -6.5 \cdot 10^{+57} \lor \neg \left(\frac{x}{y} \leq 1950000000000\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) < -6.4999999999999997e57 or 1.95e12 < (/.f64 x y)

    1. Initial program 86.4%

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

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

    if -6.4999999999999997e57 < (/.f64 x y) < 1.95e12

    1. Initial program 84.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 85.1% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6.00000000000000024e-61 or 3.15e-86 < z

    1. Initial program 76.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 z around inf 94.1%

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \frac{1 - t}{t}} \]
    4. Step-by-step derivation
      1. div-sub94.1%

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

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

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

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

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

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

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

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

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

    if -6.00000000000000024e-61 < z < 3.15e-86

    1. Initial program 99.8%

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{2}{t}}{z}} - 2 \]
    6. Simplified77.9%

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

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

Alternative 9: 91.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.9 \cdot 10^{-5} \lor \neg \left(z \leq 4.1 \cdot 10^{-57}\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 -4.9e-5) (not (<= z 4.1e-57)))
   (+ (/ 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 <= -4.9e-5) || !(z <= 4.1e-57)) {
		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 <= (-4.9d-5)) .or. (.not. (z <= 4.1d-57))) 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 <= -4.9e-5) || !(z <= 4.1e-57)) {
		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 <= -4.9e-5) or not (z <= 4.1e-57):
		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 <= -4.9e-5) || !(z <= 4.1e-57))
		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 <= -4.9e-5) || ~((z <= 4.1e-57)))
		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, -4.9e-5], N[Not[LessEqual[z, 4.1e-57]], $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 -4.9 \cdot 10^{-5} \lor \neg \left(z \leq 4.1 \cdot 10^{-57}\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 < -4.9e-5 or 4.1000000000000001e-57 < z

    1. Initial program 73.1%

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

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \frac{1 - t}{t}} \]
    4. Step-by-step derivation
      1. div-sub98.1%

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

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

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

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

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

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

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

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

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

    if -4.9e-5 < z < 4.1000000000000001e-57

    1. Initial program 99.8%

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

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

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

Alternative 10: 64.5% accurate, 0.9× speedup?

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

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

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

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


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

    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 x around inf 70.3%

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

    if -6.4999999999999997e57 < (/.f64 x y) < 5.9e10

    1. Initial program 84.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.9e10 < (/.f64 x y)

    1. Initial program 83.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 85.6%

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

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

Alternative 11: 80.4% accurate, 1.0× speedup?

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

    1. Initial program 72.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 83.9%

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

    if -9.1999999999999997e-20 < t < 8.1999999999999993

    1. Initial program 99.8%

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

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

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

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

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

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

Alternative 12: 36.5% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.95 \cdot 10^{-19}:\\
\;\;\;\;-2\\

\mathbf{elif}\;t \leq 0.95:\\
\;\;\;\;\frac{2}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.94999999999999998e-19 or 0.94999999999999996 < t

    1. Initial program 72.9%

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

      \[\leadsto \color{blue}{\frac{x}{y} - 2} \]
    4. Taylor expanded in x around 0 37.1%

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

    if -1.94999999999999998e-19 < t < 0.94999999999999996

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.95 \cdot 10^{-19}:\\ \;\;\;\;-2\\ \mathbf{elif}\;t \leq 0.95:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;-2\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 99.1% accurate, 1.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 19.6% accurate, 17.0× speedup?

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

\\
-2
\end{array}
Derivation
  1. Initial program 85.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 55.9%

    \[\leadsto \color{blue}{\frac{x}{y} - 2} \]
  4. Taylor expanded in x around 0 21.1%

    \[\leadsto \color{blue}{-2} \]
  5. Final simplification21.1%

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

Developer target: 99.1% accurate, 1.3× speedup?

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

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

Reproduce

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