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

Percentage Accurate: 86.7% → 99.2%
Time: 10.0s
Alternatives: 12
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 12 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.7% accurate, 1.0× speedup?

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

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

Alternative 1: 99.2% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \frac{x}{y} + \left(\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 89.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 66.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} - 2\\ \mathbf{if}\;z \leq -4.2 \cdot 10^{+48}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -580000000000:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;z \leq -1.02 \cdot 10^{-43}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{-71}:\\ \;\;\;\;-2 + \frac{\frac{2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (/ x y) 2.0)))
   (if (<= z -4.2e+48)
     t_1
     (if (<= z -580000000000.0)
       (/ 2.0 t)
       (if (<= z -1.02e-43)
         (/ x y)
         (if (<= z 4.2e-71) (+ -2.0 (/ (/ 2.0 z) t)) t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / y) - 2.0;
	double tmp;
	if (z <= -4.2e+48) {
		tmp = t_1;
	} else if (z <= -580000000000.0) {
		tmp = 2.0 / t;
	} else if (z <= -1.02e-43) {
		tmp = x / y;
	} else if (z <= 4.2e-71) {
		tmp = -2.0 + ((2.0 / z) / t);
	} 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 (z <= (-4.2d+48)) then
        tmp = t_1
    else if (z <= (-580000000000.0d0)) then
        tmp = 2.0d0 / t
    else if (z <= (-1.02d-43)) then
        tmp = x / y
    else if (z <= 4.2d-71) then
        tmp = (-2.0d0) + ((2.0d0 / z) / t)
    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 (z <= -4.2e+48) {
		tmp = t_1;
	} else if (z <= -580000000000.0) {
		tmp = 2.0 / t;
	} else if (z <= -1.02e-43) {
		tmp = x / y;
	} else if (z <= 4.2e-71) {
		tmp = -2.0 + ((2.0 / z) / t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / y) - 2.0
	tmp = 0
	if z <= -4.2e+48:
		tmp = t_1
	elif z <= -580000000000.0:
		tmp = 2.0 / t
	elif z <= -1.02e-43:
		tmp = x / y
	elif z <= 4.2e-71:
		tmp = -2.0 + ((2.0 / z) / t)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x / y) - 2.0)
	tmp = 0.0
	if (z <= -4.2e+48)
		tmp = t_1;
	elseif (z <= -580000000000.0)
		tmp = Float64(2.0 / t);
	elseif (z <= -1.02e-43)
		tmp = Float64(x / y);
	elseif (z <= 4.2e-71)
		tmp = Float64(-2.0 + Float64(Float64(2.0 / z) / t));
	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 (z <= -4.2e+48)
		tmp = t_1;
	elseif (z <= -580000000000.0)
		tmp = 2.0 / t;
	elseif (z <= -1.02e-43)
		tmp = x / y;
	elseif (z <= 4.2e-71)
		tmp = -2.0 + ((2.0 / z) / t);
	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[z, -4.2e+48], t$95$1, If[LessEqual[z, -580000000000.0], N[(2.0 / t), $MachinePrecision], If[LessEqual[z, -1.02e-43], N[(x / y), $MachinePrecision], If[LessEqual[z, 4.2e-71], N[(-2.0 + N[(N[(2.0 / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq -1.02 \cdot 10^{-43}:\\
\;\;\;\;\frac{x}{y}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -4.1999999999999997e48 or 4.2000000000000002e-71 < z

    1. Initial program 79.8%

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

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

    if -4.1999999999999997e48 < z < -5.8e11

    1. Initial program 99.1%

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

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

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

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

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

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

    if -5.8e11 < z < -1.0200000000000001e-43

    1. Initial program 100.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 75.6%

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

    if -1.0200000000000001e-43 < z < 4.2000000000000002e-71

    1. Initial program 97.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(1 - t\right) \cdot z + 1, \frac{2}{t \cdot z}, -\frac{-x}{y}\right)} \]
      10. *-commutative97.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-define97.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. *-commutative97.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-neg97.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-neg97.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. Simplified97.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 97.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{z \cdot t} + \color{blue}{-2} \]
      6. +-commutative84.5%

        \[\leadsto \color{blue}{-2 + \frac{2}{z \cdot t}} \]
      7. associate-/r*84.5%

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

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

Alternative 3: 62.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} - 2\\ \mathbf{if}\;z \leq -1.18 \cdot 10^{+51}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -135000000000:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;z \leq -2.9 \cdot 10^{-44}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;z \leq 6.8 \cdot 10^{-72}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (/ x y) 2.0)))
   (if (<= z -1.18e+51)
     t_1
     (if (<= z -135000000000.0)
       (/ 2.0 t)
       (if (<= z -2.9e-44) (/ x y) (if (<= z 6.8e-72) (/ (/ 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 (z <= -1.18e+51) {
		tmp = t_1;
	} else if (z <= -135000000000.0) {
		tmp = 2.0 / t;
	} else if (z <= -2.9e-44) {
		tmp = x / y;
	} else if (z <= 6.8e-72) {
		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 (z <= (-1.18d+51)) then
        tmp = t_1
    else if (z <= (-135000000000.0d0)) then
        tmp = 2.0d0 / t
    else if (z <= (-2.9d-44)) then
        tmp = x / y
    else if (z <= 6.8d-72) 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 (z <= -1.18e+51) {
		tmp = t_1;
	} else if (z <= -135000000000.0) {
		tmp = 2.0 / t;
	} else if (z <= -2.9e-44) {
		tmp = x / y;
	} else if (z <= 6.8e-72) {
		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 z <= -1.18e+51:
		tmp = t_1
	elif z <= -135000000000.0:
		tmp = 2.0 / t
	elif z <= -2.9e-44:
		tmp = x / y
	elif z <= 6.8e-72:
		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 (z <= -1.18e+51)
		tmp = t_1;
	elseif (z <= -135000000000.0)
		tmp = Float64(2.0 / t);
	elseif (z <= -2.9e-44)
		tmp = Float64(x / y);
	elseif (z <= 6.8e-72)
		tmp = Float64(Float64(2.0 / 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 (z <= -1.18e+51)
		tmp = t_1;
	elseif (z <= -135000000000.0)
		tmp = 2.0 / t;
	elseif (z <= -2.9e-44)
		tmp = x / y;
	elseif (z <= 6.8e-72)
		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[z, -1.18e+51], t$95$1, If[LessEqual[z, -135000000000.0], N[(2.0 / t), $MachinePrecision], If[LessEqual[z, -2.9e-44], N[(x / y), $MachinePrecision], If[LessEqual[z, 6.8e-72], N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq -2.9 \cdot 10^{-44}:\\
\;\;\;\;\frac{x}{y}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.18e51 or 6.7999999999999997e-72 < z

    1. Initial program 79.8%

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

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

    if -1.18e51 < z < -1.35e11

    1. Initial program 99.1%

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

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

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

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

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

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

    if -1.35e11 < z < -2.9000000000000001e-44

    1. Initial program 100.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 75.6%

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

    if -2.9000000000000001e-44 < z < 6.7999999999999997e-72

    1. Initial program 97.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(1 - t\right) \cdot z + 1, \frac{2}{t \cdot z}, -\frac{-x}{y}\right)} \]
      10. *-commutative97.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-define97.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. *-commutative97.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-neg97.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-neg97.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. Simplified97.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 97.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{2}{t}}{z}} \]
    10. Simplified71.1%

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

Alternative 4: 62.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} - 2\\ \mathbf{if}\;z \leq -4.2 \cdot 10^{+48}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -115000000:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{-44}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-71}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (/ x y) 2.0)))
   (if (<= z -4.2e+48)
     t_1
     (if (<= z -115000000.0)
       (/ 2.0 t)
       (if (<= z -3.6e-44)
         (/ x y)
         (if (<= z 1.65e-71) (/ 2.0 (* z t)) t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / y) - 2.0;
	double tmp;
	if (z <= -4.2e+48) {
		tmp = t_1;
	} else if (z <= -115000000.0) {
		tmp = 2.0 / t;
	} else if (z <= -3.6e-44) {
		tmp = x / y;
	} else if (z <= 1.65e-71) {
		tmp = 2.0 / (z * t);
	} 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 (z <= (-4.2d+48)) then
        tmp = t_1
    else if (z <= (-115000000.0d0)) then
        tmp = 2.0d0 / t
    else if (z <= (-3.6d-44)) then
        tmp = x / y
    else if (z <= 1.65d-71) then
        tmp = 2.0d0 / (z * t)
    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 (z <= -4.2e+48) {
		tmp = t_1;
	} else if (z <= -115000000.0) {
		tmp = 2.0 / t;
	} else if (z <= -3.6e-44) {
		tmp = x / y;
	} else if (z <= 1.65e-71) {
		tmp = 2.0 / (z * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / y) - 2.0
	tmp = 0
	if z <= -4.2e+48:
		tmp = t_1
	elif z <= -115000000.0:
		tmp = 2.0 / t
	elif z <= -3.6e-44:
		tmp = x / y
	elif z <= 1.65e-71:
		tmp = 2.0 / (z * t)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x / y) - 2.0)
	tmp = 0.0
	if (z <= -4.2e+48)
		tmp = t_1;
	elseif (z <= -115000000.0)
		tmp = Float64(2.0 / t);
	elseif (z <= -3.6e-44)
		tmp = Float64(x / y);
	elseif (z <= 1.65e-71)
		tmp = Float64(2.0 / Float64(z * t));
	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 (z <= -4.2e+48)
		tmp = t_1;
	elseif (z <= -115000000.0)
		tmp = 2.0 / t;
	elseif (z <= -3.6e-44)
		tmp = x / y;
	elseif (z <= 1.65e-71)
		tmp = 2.0 / (z * t);
	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[z, -4.2e+48], t$95$1, If[LessEqual[z, -115000000.0], N[(2.0 / t), $MachinePrecision], If[LessEqual[z, -3.6e-44], N[(x / y), $MachinePrecision], If[LessEqual[z, 1.65e-71], N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq -3.6 \cdot 10^{-44}:\\
\;\;\;\;\frac{x}{y}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -4.1999999999999997e48 or 1.6500000000000001e-71 < z

    1. Initial program 79.8%

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

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

    if -4.1999999999999997e48 < z < -1.15e8

    1. Initial program 99.1%

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

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

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

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

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

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

    if -1.15e8 < z < -3.5999999999999999e-44

    1. Initial program 100.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 75.6%

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

    if -3.5999999999999999e-44 < z < 1.6500000000000001e-71

    1. Initial program 97.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(1 - t\right) \cdot z + 1, \frac{2}{t \cdot z}, -\frac{-x}{y}\right)} \]
      10. *-commutative97.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-define97.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. *-commutative97.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-neg97.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-neg97.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. Simplified97.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 97.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 91.3% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{if}\;z \leq -0.00094:\\
\;\;\;\;t\_1\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -9.39999999999999972e-4 or 1.8e-71 < z

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

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

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

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

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

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

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

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

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

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

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

    if -9.39999999999999972e-4 < z < 8.50000000000000038e-105

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

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

    if 8.50000000000000038e-105 < z < 1.8e-71

    1. Initial program 88.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(1 - t\right) \cdot z + 1, \frac{2}{t \cdot z}, -\frac{-x}{y}\right)} \]
      10. *-commutative88.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-define88.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. *-commutative88.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-neg88.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-neg88.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. Simplified88.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 inf 88.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-neg88.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-2 + \frac{2}{z \cdot t}} \]
      7. associate-/r*100.0%

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

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

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

Alternative 6: 50.7% accurate, 0.7× speedup?

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

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

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

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

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


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

    1. Initial program 84.5%

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

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

    if -6.99999999999999999e25 < (/.f64 x y) < -2.75000000000000015e-297

    1. Initial program 95.7%

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

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

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

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

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

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

    if -2.75000000000000015e-297 < (/.f64 x y) < 4.2e13

    1. Initial program 91.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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. Taylor expanded in z around 0 77.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-2 + \frac{2}{z \cdot t}} \]
      7. associate-/r*77.3%

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

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

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

Alternative 7: 98.5% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 78.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.9%

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

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

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

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

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

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

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

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

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

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

    if -1 < z < 5.3000000000000001e-5

    1. Initial program 97.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 85.9% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.4000000000000003e-36 or 1.2000000000000001e-70 < z

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

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

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

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

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

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

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

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

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

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

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

    if -3.4000000000000003e-36 < z < 1.2000000000000001e-70

    1. Initial program 97.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(1 - t\right) \cdot z + 1, \frac{2}{t \cdot z}, -\frac{-x}{y}\right)} \]
      10. *-commutative97.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-define97.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. *-commutative97.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-neg97.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-neg97.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. Simplified97.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 97.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{z \cdot t} + \color{blue}{-2} \]
      6. +-commutative84.0%

        \[\leadsto \color{blue}{-2 + \frac{2}{z \cdot t}} \]
      7. associate-/r*84.0%

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

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

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

Alternative 9: 79.0% accurate, 1.0× speedup?

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

    1. Initial program 80.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 78.5%

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

    if -2.30000000000000012e45 < t < 2.3500000000000001e-37

    1. Initial program 96.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.2%

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

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

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

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

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

Alternative 10: 60.0% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.95 \cdot 10^{-20} \lor \neg \left(t \leq 2.9 \cdot 10^{-38}\right):\\
\;\;\;\;\frac{x}{y} - 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.94999999999999983e-20 or 2.89999999999999994e-38 < t

    1. Initial program 82.8%

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

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

    if -2.94999999999999983e-20 < t < 2.89999999999999994e-38

    1. Initial program 96.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 84.0%

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

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

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

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

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

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

Alternative 11: 36.3% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.4999999999999999e-18 or 0.69999999999999996 < t

    1. Initial program 82.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \frac{x}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in 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. Taylor expanded in z around 0 99.4%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-2 + \frac{2}{z \cdot t}} \]
      7. associate-/r*61.9%

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

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

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

    if -3.4999999999999999e-18 < t < 0.69999999999999996

    1. Initial program 96.5%

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

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

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

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

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

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

Alternative 12: 20.0% accurate, 17.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-2 + \frac{2}{z \cdot t}} \]
    7. associate-/r*54.7%

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

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

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

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

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

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

Reproduce

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

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

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