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

Percentage Accurate: 86.5% → 99.0%
Time: 10.2s
Alternatives: 14
Speedup: 1.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 86.5% 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.0% 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 84.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 64.9% accurate, 0.7× speedup?

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

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

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

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

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


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

    1. Initial program 83.6%

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

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

    if -4.99999999999999973e65 < (/.f64 x y) < 5.00000000000000041e-6

    1. Initial program 85.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. +-commutative85.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-neg85.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-neg85.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-neg85.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000041e-6 < (/.f64 x y) < 4e3

    1. Initial program 99.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 99.7%

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

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

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

Alternative 3: 64.9% accurate, 0.7× speedup?

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

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

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

\mathbf{elif}\;\frac{x}{y} \leq 4000:\\
\;\;\;\;\frac{2}{z \cdot t}\\

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


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

    1. Initial program 83.6%

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

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

    if -4.99999999999999973e65 < (/.f64 x y) < 5.00000000000000041e-6

    1. Initial program 85.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. +-commutative85.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-neg85.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-neg85.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-neg85.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000041e-6 < (/.f64 x y) < 4e3

    1. Initial program 99.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 99.7%

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

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

Alternative 4: 51.8% accurate, 0.7× speedup?

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

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

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

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

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


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

    1. Initial program 84.0%

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

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

    if -4.99999999999999973e65 < (/.f64 x y) < -5.00000000000000011e-92

    1. Initial program 90.3%

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

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

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

        \[\leadsto \frac{2 + \frac{\color{blue}{2}}{z}}{t} \]
    5. Simplified78.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}} \]

    if -5.00000000000000011e-92 < (/.f64 x y) < 0.0200000000000000004

    1. Initial program 84.3%

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

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

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

Alternative 5: 88.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+119} \lor \neg \left(\frac{x}{y} \leq 4000\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) -1e+119) (not (<= (/ x y) 4000.0)))
   (+ (/ 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) <= -1e+119) || !((x / y) <= 4000.0)) {
		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) <= (-1d+119)) .or. (.not. ((x / y) <= 4000.0d0))) 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) <= -1e+119) || !((x / y) <= 4000.0)) {
		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) <= -1e+119) or not ((x / y) <= 4000.0):
		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) <= -1e+119) || !(Float64(x / y) <= 4000.0))
		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) <= -1e+119) || ~(((x / y) <= 4000.0)))
		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], -1e+119], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4000.0]], $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 -1 \cdot 10^{+119} \lor \neg \left(\frac{x}{y} \leq 4000\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) < -9.99999999999999944e118 or 4e3 < (/.f64 x y)

    1. Initial program 83.4%

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

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

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

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

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

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

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

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

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

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

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

    if -9.99999999999999944e118 < (/.f64 x y) < 4e3

    1. Initial program 85.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 94.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. sub-neg94.7%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+119} \lor \neg \left(\frac{x}{y} \leq 4000\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: 84.6% accurate, 0.7× speedup?

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

\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) < -9.99999999999999944e118 or 4e3 < (/.f64 x y)

    1. Initial program 83.4%

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

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

    if -9.99999999999999944e118 < (/.f64 x y) < 4e3

    1. Initial program 85.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 94.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. sub-neg94.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 65.1% accurate, 0.8× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.06e10 or 8.4999999999999999e-6 < t

    1. Initial program 68.6%

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

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

    if -1.06e10 < t < -3.80000000000000003e-210

    1. Initial program 97.5%

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

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

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

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

    if -3.80000000000000003e-210 < t < 8.4999999999999999e-6

    1. Initial program 99.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. +-commutative99.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-neg99.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-neg99.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-neg99.7%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -10600000000:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;t \leq -3.8 \cdot 10^{-210}:\\ \;\;\;\;\frac{\frac{2}{z}}{t}\\ \mathbf{elif}\;t \leq 8.5 \cdot 10^{-6}:\\ \;\;\;\;2 \cdot \frac{z}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 98.2% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.4e5 or 1 < z

    1. Initial program 72.7%

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

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

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

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

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

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

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

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

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

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

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

    if -2.4e5 < z < 1

    1. Initial program 98.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 70.4% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+119} \lor \neg \left(\frac{x}{y} \leq 4000\right):\\
\;\;\;\;\frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -9.99999999999999944e118 or 4e3 < (/.f64 x y)

    1. Initial program 83.4%

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

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

    if -9.99999999999999944e118 < (/.f64 x y) < 4e3

    1. Initial program 85.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 94.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. sub-neg94.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 64.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+65} \lor \neg \left(\frac{x}{y} \leq 0.02\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) -5e+65) (not (<= (/ x y) 0.02)))
   (/ x y)
   (+ -2.0 (/ 2.0 t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x / y) <= -5e+65) || !((x / y) <= 0.02)) {
		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) <= (-5d+65)) .or. (.not. ((x / y) <= 0.02d0))) 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) <= -5e+65) || !((x / y) <= 0.02)) {
		tmp = x / y;
	} else {
		tmp = -2.0 + (2.0 / t);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x / y) <= -5e+65) or not ((x / y) <= 0.02):
		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) <= -5e+65) || !(Float64(x / y) <= 0.02))
		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) <= -5e+65) || ~(((x / y) <= 0.02)))
		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], -5e+65], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.02]], $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 -5 \cdot 10^{+65} \lor \neg \left(\frac{x}{y} \leq 0.02\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) < -4.99999999999999973e65 or 0.0200000000000000004 < (/.f64 x y)

    1. Initial program 84.0%

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

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

    if -4.99999999999999973e65 < (/.f64 x y) < 0.0200000000000000004

    1. Initial program 85.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. +-commutative85.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-neg85.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-neg85.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-neg85.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 64.4% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 90.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 80.9%

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

    if -4.99999999999999973e65 < (/.f64 x y) < 2.00000000000000013e-37

    1. Initial program 87.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. +-commutative87.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-neg87.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-neg87.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-neg87.6%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(1 - t\right) \cdot z + 1, \frac{2}{t \cdot z}, -\frac{-x}{y}\right)} \]
      10. *-commutative87.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-define87.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. *-commutative87.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-neg87.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-neg87.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. Simplified87.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.00000000000000013e-37 < (/.f64 x y)

    1. Initial program 74.9%

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

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

Alternative 12: 80.5% accurate, 1.0× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.8e11 or 0.122 < t

    1. Initial program 68.6%

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

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

    if -1.8e11 < t < 0.122

    1. Initial program 98.9%

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

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

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

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

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

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

Alternative 13: 37.3% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 70.0%

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

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

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

    if -1.1600000000000001e-11 < t < 0.94999999999999996

    1. Initial program 98.9%

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

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

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

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

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

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

Alternative 14: 20.8% 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 84.9%

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

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

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

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

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

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