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

Percentage Accurate: 86.5% → 99.0%
Time: 9.8s
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.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.0% accurate, 1.3× speedup?

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

\\
\frac{x}{y} + \left(-2 + \frac{2 + \frac{2}{z}}{t}\right)
\end{array}
Derivation
  1. Initial program 88.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-neg88.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-in88.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-identity88.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+88.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-inv88.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-sub81.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*81.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/81.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.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.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. Final simplification99.9%

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

Alternative 2: 70.4% accurate, 0.7× speedup?

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

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

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

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

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

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


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

    1. Initial program 86.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-neg86.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-in86.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-identity86.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+86.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-inv86.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-sub81.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*81.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/81.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. Simplified100.0%

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

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

    if -0.089999999999999997 < (/.f64 x y) < -3.1e-299 or 0.0 < (/.f64 x y) < 1.9e15

    1. Initial program 85.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-neg85.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-in85.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-identity85.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+85.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-inv85.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-sub77.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*77.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/77.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.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 0 77.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.1e-299 < (/.f64 x y) < 0.0

    1. Initial program 96.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-neg96.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-in96.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-identity96.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+96.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-inv96.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-sub88.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*88.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/88.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.7%

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

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

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

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

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

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

        \[\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 x around 0 99.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{2}{t \cdot z} + \left(\frac{2}{t} + -2\right)} \]
    7. Taylor expanded in z around inf 79.4%

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

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

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

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

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

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

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

    if 1.9e15 < (/.f64 x y)

    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.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*87.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/87.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 x around inf 70.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -0.09:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;\frac{x}{y} \leq -3.1 \cdot 10^{-299}:\\ \;\;\;\;-2 + \frac{2}{z \cdot t}\\ \mathbf{elif}\;\frac{x}{y} \leq 0:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 1.9 \cdot 10^{+15}:\\ \;\;\;\;-2 + \frac{2}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 3: 51.4% accurate, 0.9× speedup?

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

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

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

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

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

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


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

    1. Initial program 90.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-neg90.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-in90.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-identity90.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+90.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-inv90.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-sub84.8%

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

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

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

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

    if -2 < (/.f64 x y) < -3.7e-302 or 7.00000000000000003e-258 < (/.f64 x y) < 2

    1. Initial program 83.3%

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

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

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

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

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

        \[\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-sub75.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*75.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/75.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.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.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 0 98.8%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{2}{t \cdot z} + \left(\frac{2}{t} + -2\right)} \]
    7. Taylor expanded in t around inf 40.4%

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

    if -3.7e-302 < (/.f64 x y) < 7.00000000000000003e-258

    1. Initial program 97.2%

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

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

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

        \[\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+97.2%

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

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

        \[\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*89.7%

        \[\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/89.7%

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

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

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

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

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

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

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

        \[\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 0 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -2:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -3.7 \cdot 10^{-302}:\\ \;\;\;\;-2\\ \mathbf{elif}\;\frac{x}{y} \leq 7 \cdot 10^{-258}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 2:\\ \;\;\;\;-2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 4: 98.0% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 78.3%

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

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

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

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

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

        \[\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.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*78.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/78.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.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/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 98.5%

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

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

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

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

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

    if -1 < z < 1.45000000000000009e-15

    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. sub-neg99.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-in99.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-identity99.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+99.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-inv99.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-sub85.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*85.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/85.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.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 0 99.4%

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

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

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

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

Alternative 5: 65.2% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -7.5 \cdot 10^{-16} \lor \neg \left(\frac{x}{y} \leq 7.2 \cdot 10^{-7}\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) -7.5e-16) (not (<= (/ x y) 7.2e-7)))
   (- (/ x y) 2.0)
   (+ -2.0 (/ 2.0 t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x / y) <= -7.5e-16) || !((x / y) <= 7.2e-7)) {
		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) <= (-7.5d-16)) .or. (.not. ((x / y) <= 7.2d-7))) 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) <= -7.5e-16) || !((x / y) <= 7.2e-7)) {
		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) <= -7.5e-16) or not ((x / y) <= 7.2e-7):
		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) <= -7.5e-16) || !(Float64(x / y) <= 7.2e-7))
		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) <= -7.5e-16) || ~(((x / y) <= 7.2e-7)))
		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], -7.5e-16], N[Not[LessEqual[N[(x / y), $MachinePrecision], 7.2e-7]], $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 -7.5 \cdot 10^{-16} \lor \neg \left(\frac{x}{y} \leq 7.2 \cdot 10^{-7}\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) < -7.5e-16 or 7.19999999999999989e-7 < (/.f64 x y)

    1. Initial program 89.3%

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

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

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

        \[\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+89.3%

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

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

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

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

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

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

    if -7.5e-16 < (/.f64 x y) < 7.19999999999999989e-7

    1. Initial program 88.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-neg88.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-in88.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-identity88.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+88.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-inv88.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-sub81.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*81.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/81.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.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.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 0 99.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{2}{t \cdot z} + \left(\frac{2}{t} + -2\right)} \]
    7. Taylor expanded in z around inf 64.5%

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

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

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

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

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

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

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

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

Alternative 6: 85.2% accurate, 1.3× speedup?

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

    1. Initial program 81.3%

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

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

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

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

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

        \[\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.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*81.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/81.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.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/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 95.2%

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

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

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

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

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

    if -3.4000000000000001e-96 < z < 4.00000000000000029e-17

    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. sub-neg99.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-in99.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-identity99.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+99.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-inv99.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-sub82.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 91.3% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.4500000000000001e-54 or 7.00000000000000035e-16 < z

    1. Initial program 80.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-neg80.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-in80.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-identity80.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+80.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-inv80.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-sub80.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*80.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/80.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.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/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 97.7%

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

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

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

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

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

    if -2.4500000000000001e-54 < z < 7.00000000000000035e-16

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{z + \color{blue}{\frac{2 \cdot y}{t \cdot x}}}{\frac{y}{x} \cdot z} \]
    7. Taylor expanded in z around 0 88.5%

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

        \[\leadsto \color{blue}{\frac{2 \cdot 1}{t \cdot z}} + \frac{x}{y} \]
      2. metadata-eval88.5%

        \[\leadsto \frac{\color{blue}{2}}{t \cdot z} + \frac{x}{y} \]
      3. +-commutative88.5%

        \[\leadsto \color{blue}{\frac{x}{y} + \frac{2}{t \cdot z}} \]
      4. associate-/r*88.5%

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

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

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

Alternative 8: 65.1% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1750000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 1850000000000:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (/ x y) -1750000.0)
   (/ x y)
   (if (<= (/ x y) 1850000000000.0) (+ -2.0 (/ 2.0 t)) (/ x y))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x / y) <= -1750000.0) {
		tmp = x / y;
	} else if ((x / y) <= 1850000000000.0) {
		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) <= (-1750000.0d0)) then
        tmp = x / y
    else if ((x / y) <= 1850000000000.0d0) 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) <= -1750000.0) {
		tmp = x / y;
	} else if ((x / y) <= 1850000000000.0) {
		tmp = -2.0 + (2.0 / t);
	} else {
		tmp = x / y;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x / y) <= -1750000.0:
		tmp = x / y
	elif (x / y) <= 1850000000000.0:
		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) <= -1750000.0)
		tmp = Float64(x / y);
	elseif (Float64(x / y) <= 1850000000000.0)
		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) <= -1750000.0)
		tmp = x / y;
	elseif ((x / y) <= 1850000000000.0)
		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], -1750000.0], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1850000000000.0], 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 -1750000:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;\frac{x}{y} \leq 1850000000000:\\
\;\;\;\;-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) < -1.75e6 or 1.85e12 < (/.f64 x y)

    1. Initial program 90.3%

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

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

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

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

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

        \[\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 x around inf 70.7%

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

    if -1.75e6 < (/.f64 x y) < 1.85e12

    1. Initial program 87.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-neg87.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-in87.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-identity87.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+87.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-inv87.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-sub79.2%

        \[\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*79.2%

        \[\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/79.2%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{2}{t \cdot z} + \left(\frac{2}{t} + -2\right)} \]
    7. Taylor expanded in z around inf 63.1%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1750000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 1850000000000:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 9: 62.9% accurate, 1.5× speedup?

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

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

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

\mathbf{elif}\;z \leq 3.9 \cdot 10^{+91}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.0500000000000001e-97 or 1.24999999999999993e-107 < z < 3.89999999999999968e91

    1. Initial program 87.6%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Step-by-step derivation
      1. sub-neg87.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-in87.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-identity87.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+87.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-inv87.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-sub86.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*86.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/86.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 t around inf 67.0%

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

    if -1.0500000000000001e-97 < z < 1.24999999999999993e-107

    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 0 70.7%

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

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

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

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

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

    if 3.89999999999999968e91 < z

    1. Initial program 74.2%

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

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

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

        \[\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+74.2%

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

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

        \[\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*74.2%

        \[\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/74.2%

        \[\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/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 x around 0 71.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{2}{t \cdot z} + \left(\frac{2}{t} + -2\right)} \]
    7. Taylor expanded in z around inf 71.2%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.05 \cdot 10^{-97}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-107}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{+91}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \end{array} \]

Alternative 10: 80.6% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.02 \cdot 10^{-11} \lor \neg \left(t \leq 24\right):\\
\;\;\;\;\frac{x}{y} - 2\\

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


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

    1. Initial program 79.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-neg79.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-in79.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-identity79.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+79.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-inv79.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-sub79.5%

        \[\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*79.5%

        \[\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/79.5%

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

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

    if -1.01999999999999994e-11 < t < 24

    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. sub-neg99.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-in99.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-identity99.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+99.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-inv99.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-sub84.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*84.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/84.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.7%

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

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

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

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

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

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

        \[\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 0 84.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 36.0% accurate, 2.4× speedup?

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

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

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

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


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

    1. Initial program 79.2%

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

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

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

        \[\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+79.2%

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

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

        \[\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*79.2%

        \[\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/79.2%

        \[\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 0 54.7%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{2}{t \cdot z} + \left(\frac{2}{t} + -2\right)} \]
    7. Taylor expanded in t around inf 38.1%

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

    if -4.60000000000000027e-11 < t < 2.1e10

    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. sub-neg99.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-in99.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-identity99.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+99.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-inv99.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-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. *-inverses99.7%

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

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

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

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

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

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

        \[\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 0 83.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4.6 \cdot 10^{-11}:\\ \;\;\;\;-2\\ \mathbf{elif}\;t \leq 21000000000:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;-2\\ \end{array} \]

Alternative 12: 19.6% accurate, 17.0× speedup?

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

\\
-2
\end{array}
Derivation
  1. Initial program 88.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-neg88.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-in88.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-identity88.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+88.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-inv88.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-sub81.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*81.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/81.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.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.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 0 68.4%

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{2}{t \cdot z} + \left(\frac{2}{t} + -2\right)} \]
  7. Taylor expanded in t around inf 21.4%

    \[\leadsto \color{blue}{-2} \]
  8. Final simplification21.4%

    \[\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 2023229 
(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))))