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

Percentage Accurate: 86.2% → 99.0%
Time: 8.9s
Alternatives: 12
Speedup: 1.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 70.1% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;\frac{x}{y} \leq -4 \cdot 10^{-69}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+35}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 x y) < -1.99999999999999984e81

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.99999999999999984e81 < (/.f64 x y) < -3.9999999999999999e-69 or -4.9999999999999998e-241 < (/.f64 x y) < 1.9999999999999999e35

    1. Initial program 86.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. +-commutative86.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.9999999999999999e-69 < (/.f64 x y) < -4.9999999999999998e-241

    1. Initial program 91.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. sub-neg91.9%

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

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

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

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{\left(2 + z \cdot 2\right) + \left(-t\right) \cdot \left(z \cdot 2\right)}}{t \cdot z} \]
      5. cancel-sign-sub-inv91.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.9999999999999999e35 < (/.f64 x y)

    1. Initial program 92.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. sub-neg92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+81}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -4 \cdot 10^{-69}:\\ \;\;\;\;-2 + \frac{2}{z \cdot t}\\ \mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{-241}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+35}:\\ \;\;\;\;-2 + \frac{2}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]

Alternative 3: 62.4% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
t_1 := 2 \cdot \frac{1}{z \cdot t}\\
t_2 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -1.32 \cdot 10^{-115}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t \leq 1.62 \cdot 10^{-205}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 1.7 \cdot 10^{-198}:\\
\;\;\;\;\frac{2}{t}\\

\mathbf{elif}\;t \leq 2.45 \cdot 10^{+26}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.32e-115 or 2.44999999999999987e26 < t

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

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

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

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

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{\left(2 + z \cdot 2\right) + \left(-t\right) \cdot \left(z \cdot 2\right)}}{t \cdot z} \]
      5. cancel-sign-sub-inv84.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.32e-115 < t < 1.6200000000000001e-205 or 1.6999999999999999e-198 < t < 2.44999999999999987e26

    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. *-commutative99.7%

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

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

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

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

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

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

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

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

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

    if 1.6200000000000001e-205 < t < 1.6999999999999999e-198

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{\left(2 + z \cdot 2\right) + \left(-t\right) \cdot \left(z \cdot 2\right)}}{t \cdot z} \]
      5. cancel-sign-sub-inv100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.32 \cdot 10^{-115}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;t \leq 1.62 \cdot 10^{-205}:\\ \;\;\;\;2 \cdot \frac{1}{z \cdot t}\\ \mathbf{elif}\;t \leq 1.7 \cdot 10^{-198}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;t \leq 2.45 \cdot 10^{+26}:\\ \;\;\;\;2 \cdot \frac{1}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]

Alternative 4: 98.1% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 78.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1e12 < z < 0.0085000000000000006

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 65.5% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -6e7 or 2.90000000000000007e38 < (/.f64 x y)

    1. Initial program 94.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. sub-neg94.6%

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

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

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

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{\left(2 + z \cdot 2\right) + \left(-t\right) \cdot \left(z \cdot 2\right)}}{t \cdot z} \]
      5. cancel-sign-sub-inv94.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6e7 < (/.f64 x y) < 2.90000000000000007e38

    1. Initial program 86.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. sub-neg86.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 79.1% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -7.5000000000000002e27 or 2.44999999999999987e26 < t

    1. Initial program 81.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. sub-neg81.6%

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

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

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

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{\left(2 + z \cdot 2\right) + \left(-t\right) \cdot \left(z \cdot 2\right)}}{t \cdot z} \]
      5. cancel-sign-sub-inv81.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.5000000000000002e27 < t < 2.44999999999999987e26

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 79.1% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -7.19999999999999966e27 or 2.44999999999999987e26 < t

    1. Initial program 81.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. sub-neg81.6%

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

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

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

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{\left(2 + z \cdot 2\right) + \left(-t\right) \cdot \left(z \cdot 2\right)}}{t \cdot z} \]
      5. cancel-sign-sub-inv81.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.19999999999999966e27 < t < 2.44999999999999987e26

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \frac{\color{blue}{\frac{z + 1}{z}}}{t} \]
    8. Applied egg-rr77.8%

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

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

Alternative 8: 81.8% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.40000000000000018e-231 or 3.4000000000000003e-92 < z

    1. Initial program 86.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. sub-neg86.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.40000000000000018e-231 < z < 3.4000000000000003e-92

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 65.5% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -340000000:\\
\;\;\;\;\frac{x}{y}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -3.4e8 or 1.54999999999999993e35 < (/.f64 x y)

    1. Initial program 94.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. sub-neg94.6%

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

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

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

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{\left(2 + z \cdot 2\right) + \left(-t\right) \cdot \left(z \cdot 2\right)}}{t \cdot z} \]
      5. cancel-sign-sub-inv94.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.4e8 < (/.f64 x y) < 1.54999999999999993e35

    1. Initial program 86.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. sub-neg86.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -340000000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 1.55 \cdot 10^{+35}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 10: 53.0% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -60000000:\\
\;\;\;\;\frac{x}{y}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -6e7 or 1.25e12 < (/.f64 x y)

    1. Initial program 94.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. sub-neg94.9%

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

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

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

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{\left(2 + z \cdot 2\right) + \left(-t\right) \cdot \left(z \cdot 2\right)}}{t \cdot z} \]
      5. cancel-sign-sub-inv94.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6e7 < (/.f64 x y) < 1.25e12

    1. Initial program 85.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. sub-neg85.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -60000000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 1250000000000:\\ \;\;\;\;-2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 11: 37.0% accurate, 2.4× speedup?

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

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

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

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


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

    1. Initial program 83.0%

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

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

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

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

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{\left(2 + z \cdot 2\right) + \left(-t\right) \cdot \left(z \cdot 2\right)}}{t \cdot z} \]
      5. cancel-sign-sub-inv83.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.5e11 < t < 0.0519999999999999976

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{\left(2 + z \cdot 2\right) + \left(-t\right) \cdot \left(z \cdot 2\right)}}{t \cdot z} \]
      5. cancel-sign-sub-inv99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -350000000000:\\ \;\;\;\;-2\\ \mathbf{elif}\;t \leq 0.052:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;-2\\ \end{array} \]

Alternative 12: 20.3% 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 90.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-2} \]
  6. Final simplification22.6%

    \[\leadsto -2 \]

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

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

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