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

Percentage Accurate: 85.9% → 99.2%
Time: 11.5s
Alternatives: 11
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 11 alternatives:

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

Initial Program: 85.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.2% accurate, 1.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(1 - t\right) \cdot z + 1, \frac{2}{t \cdot z}, -\frac{-x}{y}\right)} \]
    10. *-commutative85.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-define85.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. *-commutative85.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-neg85.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-neg85.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. Simplified85.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 99.1%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 50.4% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.75 \cdot 10^{-11}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;\frac{x}{y} \leq -9.6 \cdot 10^{-191}:\\
\;\;\;\;-2\\

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

\mathbf{elif}\;\frac{x}{y} \leq 6.2 \cdot 10^{-149}:\\
\;\;\;\;-2\\

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

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

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


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

    1. Initial program 79.9%

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

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

    if -1.7500000000000001e-11 < (/.f64 x y) < -9.5999999999999997e-191 or 3.8000000000000002e-285 < (/.f64 x y) < 6.19999999999999974e-149 or 2.20000000000000018e-53 < (/.f64 x y) < 2

    1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.5999999999999997e-191 < (/.f64 x y) < 3.8000000000000002e-285 or 6.19999999999999974e-149 < (/.f64 x y) < 2.20000000000000018e-53

    1. Initial program 95.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 80.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1.75 \cdot 10^{-11}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -9.6 \cdot 10^{-191}:\\ \;\;\;\;-2\\ \mathbf{elif}\;\frac{x}{y} \leq 3.8 \cdot 10^{-285}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 6.2 \cdot 10^{-149}:\\ \;\;\;\;-2\\ \mathbf{elif}\;\frac{x}{y} \leq 2.2 \cdot 10^{-53}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 2:\\ \;\;\;\;-2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 71.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} - 2\\ t_2 := -2 + \frac{\frac{2}{z}}{t}\\ \mathbf{if}\;\frac{x}{y} \leq -1580:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{x}{y} \leq -1.6 \cdot 10^{-176}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;\frac{x}{y} \leq -1.55 \cdot 10^{-208}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 1.7 \cdot 10^{+97}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (/ x y) 2.0)) (t_2 (+ -2.0 (/ (/ 2.0 z) t))))
   (if (<= (/ x y) -1580.0)
     t_1
     (if (<= (/ x y) -1.6e-176)
       t_2
       (if (<= (/ x y) -1.55e-208)
         (+ -2.0 (/ 2.0 t))
         (if (<= (/ x y) 1.7e+97) t_2 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / y) - 2.0;
	double t_2 = -2.0 + ((2.0 / z) / t);
	double tmp;
	if ((x / y) <= -1580.0) {
		tmp = t_1;
	} else if ((x / y) <= -1.6e-176) {
		tmp = t_2;
	} else if ((x / y) <= -1.55e-208) {
		tmp = -2.0 + (2.0 / t);
	} else if ((x / y) <= 1.7e+97) {
		tmp = t_2;
	} 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) :: t_2
    real(8) :: tmp
    t_1 = (x / y) - 2.0d0
    t_2 = (-2.0d0) + ((2.0d0 / z) / t)
    if ((x / y) <= (-1580.0d0)) then
        tmp = t_1
    else if ((x / y) <= (-1.6d-176)) then
        tmp = t_2
    else if ((x / y) <= (-1.55d-208)) then
        tmp = (-2.0d0) + (2.0d0 / t)
    else if ((x / y) <= 1.7d+97) then
        tmp = t_2
    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 t_2 = -2.0 + ((2.0 / z) / t);
	double tmp;
	if ((x / y) <= -1580.0) {
		tmp = t_1;
	} else if ((x / y) <= -1.6e-176) {
		tmp = t_2;
	} else if ((x / y) <= -1.55e-208) {
		tmp = -2.0 + (2.0 / t);
	} else if ((x / y) <= 1.7e+97) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / y) - 2.0
	t_2 = -2.0 + ((2.0 / z) / t)
	tmp = 0
	if (x / y) <= -1580.0:
		tmp = t_1
	elif (x / y) <= -1.6e-176:
		tmp = t_2
	elif (x / y) <= -1.55e-208:
		tmp = -2.0 + (2.0 / t)
	elif (x / y) <= 1.7e+97:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x / y) - 2.0)
	t_2 = Float64(-2.0 + Float64(Float64(2.0 / z) / t))
	tmp = 0.0
	if (Float64(x / y) <= -1580.0)
		tmp = t_1;
	elseif (Float64(x / y) <= -1.6e-176)
		tmp = t_2;
	elseif (Float64(x / y) <= -1.55e-208)
		tmp = Float64(-2.0 + Float64(2.0 / t));
	elseif (Float64(x / y) <= 1.7e+97)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x / y) - 2.0;
	t_2 = -2.0 + ((2.0 / z) / t);
	tmp = 0.0;
	if ((x / y) <= -1580.0)
		tmp = t_1;
	elseif ((x / y) <= -1.6e-176)
		tmp = t_2;
	elseif ((x / y) <= -1.55e-208)
		tmp = -2.0 + (2.0 / t);
	elseif ((x / y) <= 1.7e+97)
		tmp = t_2;
	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]}, Block[{t$95$2 = N[(-2.0 + N[(N[(2.0 / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -1580.0], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -1.6e-176], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], -1.55e-208], N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1.7e+97], t$95$2, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
t_2 := -2 + \frac{\frac{2}{z}}{t}\\
\mathbf{if}\;\frac{x}{y} \leq -1580:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{x}{y} \leq -1.6 \cdot 10^{-176}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;\frac{x}{y} \leq 1.7 \cdot 10^{+97}:\\
\;\;\;\;t\_2\\

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


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

    1. Initial program 77.5%

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

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

    if -1580 < (/.f64 x y) < -1.59999999999999992e-176 or -1.5499999999999999e-208 < (/.f64 x y) < 1.70000000000000005e97

    1. Initial program 91.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. +-commutative91.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-neg91.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-neg91.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-neg91.3%

        \[\leadsto \color{blue}{\frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} - \frac{-x}{y}} \]
      5. *-commutative91.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*91.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-in91.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*91.2%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(1 - t\right) \cdot z + 1, \frac{2}{t \cdot z}, -\frac{-x}{y}\right)} \]
      10. *-commutative91.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-define91.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. *-commutative91.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-neg91.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-neg91.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. Simplified91.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 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.59999999999999992e-176 < (/.f64 x y) < -1.5499999999999999e-208

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(1 - t\right) \cdot z + 1, \frac{2}{t \cdot z}, -\frac{-x}{y}\right)} \]
      10. *-commutative99.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-define99.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. *-commutative99.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-neg99.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-neg99.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. Simplified99.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 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1580:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;\frac{x}{y} \leq -1.6 \cdot 10^{-176}:\\ \;\;\;\;-2 + \frac{\frac{2}{z}}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq -1.55 \cdot 10^{-208}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 1.7 \cdot 10^{+97}:\\ \;\;\;\;-2 + \frac{\frac{2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 84.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -10000 \lor \neg \left(\frac{x}{y} \leq 4.8 \cdot 10^{+97}\right):\\
\;\;\;\;\frac{x}{y} - 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -1e4 or 4.8e97 < (/.f64 x y)

    1. Initial program 77.5%

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

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

    if -1e4 < (/.f64 x y) < 4.8e97

    1. Initial program 91.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(1 - t\right) \cdot z + 1, \frac{2}{t \cdot z}, -\frac{-x}{y}\right)} \]
      10. *-commutative91.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-define91.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. *-commutative91.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-neg91.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-neg91.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. Simplified91.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 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 88.8% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -810 or 1.12e98 < (/.f64 x y)

    1. Initial program 77.5%

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

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

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

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

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

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

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

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

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

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

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

    if -810 < (/.f64 x y) < 1.12e98

    1. Initial program 91.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(1 - t\right) \cdot z + 1, \frac{2}{t \cdot z}, -\frac{-x}{y}\right)} \]
      10. *-commutative91.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-define91.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. *-commutative91.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-neg91.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-neg91.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. Simplified91.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 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 91.4% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -1e4 or 3.4999999999999998e90 < (/.f64 x y)

    1. Initial program 77.7%

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

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

    if -1e4 < (/.f64 x y) < 3.4999999999999998e90

    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.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 63.6% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.75 \cdot 10^{-11} \lor \neg \left(\frac{x}{y} \leq 2.45 \cdot 10^{+91}\right):\\
\;\;\;\;\frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -1.7500000000000001e-11 or 2.45000000000000015e91 < (/.f64 x y)

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

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

    if -1.7500000000000001e-11 < (/.f64 x y) < 2.45000000000000015e91

    1. Initial program 91.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 64.1% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.75 \cdot 10^{-11} \lor \neg \left(\frac{x}{y} \leq 3.5 \cdot 10^{+90}\right):\\
\;\;\;\;\frac{x}{y} - 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -1.7500000000000001e-11 or 3.4999999999999998e90 < (/.f64 x y)

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

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

    if -1.7500000000000001e-11 < (/.f64 x y) < 3.4999999999999998e90

    1. Initial program 91.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 80.7% accurate, 1.0× speedup?

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

    1. Initial program 74.4%

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

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

    if -320 < t < 0.00125000000000000003

    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 t around 0 83.9%

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

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

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

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

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

Alternative 10: 36.6% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -82000 or 900 < t

    1. Initial program 73.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(1 - t\right) \cdot z + 1, \frac{2}{t \cdot z}, -\frac{-x}{y}\right)} \]
      10. *-commutative73.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-define73.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. *-commutative73.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-neg73.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-neg73.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. Simplified73.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -82000 < t < 900

    1. Initial program 98.2%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -82000:\\ \;\;\;\;-2\\ \mathbf{elif}\;t \leq 900:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;-2\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 19.9% accurate, 17.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(1 - t\right) \cdot z + 1, \frac{2}{t \cdot z}, -\frac{-x}{y}\right)} \]
    10. *-commutative85.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-define85.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. *-commutative85.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-neg85.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-neg85.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. Simplified85.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 99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-2} \]
  13. Final simplification19.2%

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

Developer target: 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 2024039 
(FPCore (x y z t)
  :name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
  :precision binary64

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

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