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

Percentage Accurate: 86.4% → 99.5%
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.4% 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.5% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(x, \frac{1}{y}, -2 + \frac{2 + \frac{2}{z}}{t}\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (fma x (/ 1.0 y) (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))))
double code(double x, double y, double z, double t) {
	return fma(x, (1.0 / y), (-2.0 + ((2.0 + (2.0 / z)) / t)));
}
function code(x, y, z, t)
	return fma(x, Float64(1.0 / y), Float64(-2.0 + Float64(Float64(2.0 + Float64(2.0 / z)) / t)))
end
code[x_, y_, z_, t_] := N[(x * N[(1.0 / y), $MachinePrecision] + N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

      \[\leadsto \frac{x}{y} + \frac{\color{blue}{\left(2 + z \cdot 2\right) - t \cdot \left(z \cdot 2\right)}}{t \cdot z} \]
    6. div-sub79.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*79.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/79.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.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 49.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -2:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -4.2 \cdot 10^{-177}:\\ \;\;\;\;-2\\ \mathbf{elif}\;\frac{x}{y} \leq 3.6 \cdot 10^{-289}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 2.5 \cdot 10^{-170}:\\ \;\;\;\;-2\\ \mathbf{elif}\;\frac{x}{y} \leq 6.5 \cdot 10^{-94}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 2.1 \cdot 10^{-26}:\\ \;\;\;\;-2\\ \mathbf{elif}\;\frac{x}{y} \leq 4.5 \cdot 10^{+36}:\\ \;\;\;\;\frac{2}{t}\\ \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) -4.2e-177)
     -2.0
     (if (<= (/ x y) 3.6e-289)
       (/ 2.0 t)
       (if (<= (/ x y) 2.5e-170)
         -2.0
         (if (<= (/ x y) 6.5e-94)
           (/ 2.0 t)
           (if (<= (/ x y) 2.1e-26)
             -2.0
             (if (<= (/ x y) 4.5e+36) (/ 2.0 t) (/ 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) <= -4.2e-177) {
		tmp = -2.0;
	} else if ((x / y) <= 3.6e-289) {
		tmp = 2.0 / t;
	} else if ((x / y) <= 2.5e-170) {
		tmp = -2.0;
	} else if ((x / y) <= 6.5e-94) {
		tmp = 2.0 / t;
	} else if ((x / y) <= 2.1e-26) {
		tmp = -2.0;
	} else if ((x / y) <= 4.5e+36) {
		tmp = 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) <= (-2.0d0)) then
        tmp = x / y
    else if ((x / y) <= (-4.2d-177)) then
        tmp = -2.0d0
    else if ((x / y) <= 3.6d-289) then
        tmp = 2.0d0 / t
    else if ((x / y) <= 2.5d-170) then
        tmp = -2.0d0
    else if ((x / y) <= 6.5d-94) then
        tmp = 2.0d0 / t
    else if ((x / y) <= 2.1d-26) then
        tmp = -2.0d0
    else if ((x / y) <= 4.5d+36) then
        tmp = 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) <= -2.0) {
		tmp = x / y;
	} else if ((x / y) <= -4.2e-177) {
		tmp = -2.0;
	} else if ((x / y) <= 3.6e-289) {
		tmp = 2.0 / t;
	} else if ((x / y) <= 2.5e-170) {
		tmp = -2.0;
	} else if ((x / y) <= 6.5e-94) {
		tmp = 2.0 / t;
	} else if ((x / y) <= 2.1e-26) {
		tmp = -2.0;
	} else if ((x / y) <= 4.5e+36) {
		tmp = 2.0 / t;
	} 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) <= -4.2e-177:
		tmp = -2.0
	elif (x / y) <= 3.6e-289:
		tmp = 2.0 / t
	elif (x / y) <= 2.5e-170:
		tmp = -2.0
	elif (x / y) <= 6.5e-94:
		tmp = 2.0 / t
	elif (x / y) <= 2.1e-26:
		tmp = -2.0
	elif (x / y) <= 4.5e+36:
		tmp = 2.0 / t
	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) <= -4.2e-177)
		tmp = -2.0;
	elseif (Float64(x / y) <= 3.6e-289)
		tmp = Float64(2.0 / t);
	elseif (Float64(x / y) <= 2.5e-170)
		tmp = -2.0;
	elseif (Float64(x / y) <= 6.5e-94)
		tmp = Float64(2.0 / t);
	elseif (Float64(x / y) <= 2.1e-26)
		tmp = -2.0;
	elseif (Float64(x / y) <= 4.5e+36)
		tmp = 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) <= -2.0)
		tmp = x / y;
	elseif ((x / y) <= -4.2e-177)
		tmp = -2.0;
	elseif ((x / y) <= 3.6e-289)
		tmp = 2.0 / t;
	elseif ((x / y) <= 2.5e-170)
		tmp = -2.0;
	elseif ((x / y) <= 6.5e-94)
		tmp = 2.0 / t;
	elseif ((x / y) <= 2.1e-26)
		tmp = -2.0;
	elseif ((x / y) <= 4.5e+36)
		tmp = 2.0 / t;
	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], -4.2e-177], -2.0, If[LessEqual[N[(x / y), $MachinePrecision], 3.6e-289], N[(2.0 / t), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2.5e-170], -2.0, If[LessEqual[N[(x / y), $MachinePrecision], 6.5e-94], N[(2.0 / t), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2.1e-26], -2.0, If[LessEqual[N[(x / y), $MachinePrecision], 4.5e+36], N[(2.0 / t), $MachinePrecision], 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 -4.2 \cdot 10^{-177}:\\
\;\;\;\;-2\\

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

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

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

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

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

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


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

    1. Initial program 88.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-neg88.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-in88.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-identity88.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+88.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-inv88.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-sub77.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*77.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/77.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. *-inverses98.2%

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

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

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

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

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

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

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

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

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

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

    if -2 < (/.f64 x y) < -4.20000000000000002e-177 or 3.6e-289 < (/.f64 x y) < 2.50000000000000005e-170 or 6.4999999999999996e-94 < (/.f64 x y) < 2.10000000000000008e-26

    1. Initial program 82.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. clear-num82.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(2, \frac{\left(1 - t\right) \cdot z}{x}, 2 \cdot \frac{1}{x}\right)}}{\frac{t \cdot z}{x}} \]
      4. associate-/l*64.1%

        \[\leadsto \frac{\mathsf{fma}\left(2, \color{blue}{\frac{1 - t}{\frac{x}{z}}}, 2 \cdot \frac{1}{x}\right)}{\frac{t \cdot z}{x}} \]
      5. associate-*r/64.1%

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

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

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

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

    if -4.20000000000000002e-177 < (/.f64 x y) < 3.6e-289 or 2.50000000000000005e-170 < (/.f64 x y) < 6.4999999999999996e-94 or 2.10000000000000008e-26 < (/.f64 x y) < 4.49999999999999997e36

    1. Initial program 92.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-neg92.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-in92.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-identity92.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+92.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-inv92.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.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*82.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/82.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/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 t around 0 81.3%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -2:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -4.2 \cdot 10^{-177}:\\ \;\;\;\;-2\\ \mathbf{elif}\;\frac{x}{y} \leq 3.6 \cdot 10^{-289}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 2.5 \cdot 10^{-170}:\\ \;\;\;\;-2\\ \mathbf{elif}\;\frac{x}{y} \leq 6.5 \cdot 10^{-94}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 2.1 \cdot 10^{-26}:\\ \;\;\;\;-2\\ \mathbf{elif}\;\frac{x}{y} \leq 4.5 \cdot 10^{+36}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 3: 69.5% accurate, 0.8× speedup?

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

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

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

\mathbf{elif}\;\frac{x}{y} \leq 0.0155:\\
\;\;\;\;2 \cdot \frac{1 - t}{t}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 x y) < -3.30000000000000018e-9 or 2.4000000000000002e66 < (/.f64 x y)

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

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

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

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

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

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

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

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

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

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

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

    if -3.30000000000000018e-9 < (/.f64 x y) < 6.2000000000000003e-234

    1. Initial program 88.7%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Step-by-step derivation
      1. sub-neg88.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-in88.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-identity88.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+88.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-inv88.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-sub76.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*76.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/76.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.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 z around 0 72.0%

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

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

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

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

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

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

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

    if 6.2000000000000003e-234 < (/.f64 x y) < 0.0155

    1. Initial program 84.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. clear-num84.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(2, \frac{\left(1 - t\right) \cdot z}{x}, 2 \cdot \frac{1}{x}\right)}}{\frac{t \cdot z}{x}} \]
      4. associate-/l*58.1%

        \[\leadsto \frac{\mathsf{fma}\left(2, \color{blue}{\frac{1 - t}{\frac{x}{z}}}, 2 \cdot \frac{1}{x}\right)}{\frac{t \cdot z}{x}} \]
      5. associate-*r/58.1%

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

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

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

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

    if 0.0155 < (/.f64 x y) < 2.4000000000000002e66

    1. Initial program 99.8%

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

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

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

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

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

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{\left(2 + z \cdot 2\right) - t \cdot \left(z \cdot 2\right)}}{t \cdot z} \]
      6. div-sub88.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*88.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/88.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.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -3.3 \cdot 10^{-9}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;\frac{x}{y} \leq 6.2 \cdot 10^{-234}:\\ \;\;\;\;-2 + \frac{2}{z \cdot t}\\ \mathbf{elif}\;\frac{x}{y} \leq 0.0155:\\ \;\;\;\;2 \cdot \frac{1 - t}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 2.4 \cdot 10^{+66}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]

Alternative 4: 63.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} - 2\\ \mathbf{if}\;z \leq -2.5 \cdot 10^{+60}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{+43}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{-104}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.9 \cdot 10^{-96}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{elif}\;z \leq 4.1 \cdot 10^{+15} \lor \neg \left(z \leq 1.4 \cdot 10^{+57}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (/ x y) 2.0)))
   (if (<= z -2.5e+60)
     t_1
     (if (<= z -1.6e+43)
       (/ 2.0 t)
       (if (<= z -5.2e-104)
         t_1
         (if (<= z 2.9e-96)
           (/ 2.0 (* z t))
           (if (or (<= z 4.1e+15) (not (<= z 1.4e+57))) t_1 (/ 2.0 t))))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / y) - 2.0;
	double tmp;
	if (z <= -2.5e+60) {
		tmp = t_1;
	} else if (z <= -1.6e+43) {
		tmp = 2.0 / t;
	} else if (z <= -5.2e-104) {
		tmp = t_1;
	} else if (z <= 2.9e-96) {
		tmp = 2.0 / (z * t);
	} else if ((z <= 4.1e+15) || !(z <= 1.4e+57)) {
		tmp = t_1;
	} else {
		tmp = 2.0 / t;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (x / y) - 2.0d0
    if (z <= (-2.5d+60)) then
        tmp = t_1
    else if (z <= (-1.6d+43)) then
        tmp = 2.0d0 / t
    else if (z <= (-5.2d-104)) then
        tmp = t_1
    else if (z <= 2.9d-96) then
        tmp = 2.0d0 / (z * t)
    else if ((z <= 4.1d+15) .or. (.not. (z <= 1.4d+57))) then
        tmp = t_1
    else
        tmp = 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 <= -2.5e+60) {
		tmp = t_1;
	} else if (z <= -1.6e+43) {
		tmp = 2.0 / t;
	} else if (z <= -5.2e-104) {
		tmp = t_1;
	} else if (z <= 2.9e-96) {
		tmp = 2.0 / (z * t);
	} else if ((z <= 4.1e+15) || !(z <= 1.4e+57)) {
		tmp = t_1;
	} else {
		tmp = 2.0 / t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / y) - 2.0
	tmp = 0
	if z <= -2.5e+60:
		tmp = t_1
	elif z <= -1.6e+43:
		tmp = 2.0 / t
	elif z <= -5.2e-104:
		tmp = t_1
	elif z <= 2.9e-96:
		tmp = 2.0 / (z * t)
	elif (z <= 4.1e+15) or not (z <= 1.4e+57):
		tmp = t_1
	else:
		tmp = 2.0 / t
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x / y) - 2.0)
	tmp = 0.0
	if (z <= -2.5e+60)
		tmp = t_1;
	elseif (z <= -1.6e+43)
		tmp = Float64(2.0 / t);
	elseif (z <= -5.2e-104)
		tmp = t_1;
	elseif (z <= 2.9e-96)
		tmp = Float64(2.0 / Float64(z * t));
	elseif ((z <= 4.1e+15) || !(z <= 1.4e+57))
		tmp = t_1;
	else
		tmp = 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 <= -2.5e+60)
		tmp = t_1;
	elseif (z <= -1.6e+43)
		tmp = 2.0 / t;
	elseif (z <= -5.2e-104)
		tmp = t_1;
	elseif (z <= 2.9e-96)
		tmp = 2.0 / (z * t);
	elseif ((z <= 4.1e+15) || ~((z <= 1.4e+57)))
		tmp = t_1;
	else
		tmp = 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, -2.5e+60], t$95$1, If[LessEqual[z, -1.6e+43], N[(2.0 / t), $MachinePrecision], If[LessEqual[z, -5.2e-104], t$95$1, If[LessEqual[z, 2.9e-96], N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 4.1e+15], N[Not[LessEqual[z, 1.4e+57]], $MachinePrecision]], t$95$1, N[(2.0 / t), $MachinePrecision]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq -5.2 \cdot 10^{-104}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;z \leq 4.1 \cdot 10^{+15} \lor \neg \left(z \leq 1.4 \cdot 10^{+57}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.49999999999999987e60 or -1.60000000000000007e43 < z < -5.20000000000000005e-104 or 2.89999999999999994e-96 < z < 4.1e15 or 1.4e57 < z

    1. Initial program 81.6%

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

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

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

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

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

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{\left(2 + z \cdot 2\right) - t \cdot \left(z \cdot 2\right)}}{t \cdot z} \]
      6. div-sub80.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*80.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/80.9%

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

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

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

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

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

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

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

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

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

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

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

    if -2.49999999999999987e60 < z < -1.60000000000000007e43 or 4.1e15 < z < 1.4e57

    1. Initial program 99.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-neg99.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-in99.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-identity99.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+99.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-inv99.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-sub99.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*99.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/99.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.5%

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

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

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

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

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

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

        \[\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 t around 0 94.9%

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

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

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

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

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

    if -5.20000000000000005e-104 < z < 2.89999999999999994e-96

    1. Initial program 97.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-neg97.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-in97.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-identity97.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+97.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-inv97.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-sub71.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*71.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/71.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. *-inverses97.5%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.5 \cdot 10^{+60}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{+43}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{-104}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq 2.9 \cdot 10^{-96}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{elif}\;z \leq 4.1 \cdot 10^{+15} \lor \neg \left(z \leq 1.4 \cdot 10^{+57}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t}\\ \end{array} \]

Alternative 5: 65.2% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;\frac{x}{y} \leq 7.2 \cdot 10^{+67}:\\
\;\;\;\;\frac{2}{z \cdot t}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


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

    1. Initial program 87.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-neg87.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-in87.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-identity87.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+87.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-inv87.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-sub78.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*78.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/78.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. *-inverses98.1%

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

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

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

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

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

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

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

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

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

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

    if -0.209999999999999992 < (/.f64 x y) < 6.99999999999999989e-6

    1. Initial program 87.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(2, \frac{\left(1 - t\right) \cdot z}{x}, 2 \cdot \frac{1}{x}\right)}}{\frac{t \cdot z}{x}} \]
      4. associate-/l*63.2%

        \[\leadsto \frac{\mathsf{fma}\left(2, \color{blue}{\frac{1 - t}{\frac{x}{z}}}, 2 \cdot \frac{1}{x}\right)}{\frac{t \cdot z}{x}} \]
      5. associate-*r/63.2%

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

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

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

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

    if 6.99999999999999989e-6 < (/.f64 x y) < 7.1999999999999998e67

    1. Initial program 99.8%

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

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

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

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

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

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{\left(2 + z \cdot 2\right) - t \cdot \left(z \cdot 2\right)}}{t \cdot z} \]
      6. div-sub88.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*88.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/88.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.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -0.21:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;\frac{x}{y} \leq 7 \cdot 10^{-6}:\\ \;\;\;\;2 \cdot \frac{1 - t}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 7.2 \cdot 10^{+67}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]

Alternative 6: 79.3% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;t \leq -1.9 \cdot 10^{-127}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq -9 \cdot 10^{-148}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;t \leq 4.2 \cdot 10^{+37}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.50000000000000014e-20 or 4.2000000000000002e37 < t

    1. Initial program 75.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-neg75.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-in75.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-identity75.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+75.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-inv75.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-sub75.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*75.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/75.6%

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

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

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

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

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

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

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

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

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

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

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

    if -1.50000000000000014e-20 < t < -1.90000000000000001e-127 or -9.00000000000000029e-148 < t < 4.2000000000000002e37

    1. Initial program 98.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-neg98.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-in98.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-identity98.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+98.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-inv98.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.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*81.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/81.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. *-inverses98.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.90000000000000001e-127 < t < -9.00000000000000029e-148

    1. Initial program 99.8%

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

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

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

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

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

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{\left(2 + z \cdot 2\right) - t \cdot \left(z \cdot 2\right)}}{t \cdot z} \]
      6. div-sub99.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*99.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/99.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.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 x around inf 85.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.5 \cdot 10^{-20}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;t \leq -1.9 \cdot 10^{-127}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{elif}\;t \leq -9 \cdot 10^{-148}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t \leq 4.2 \cdot 10^{+37}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]

Alternative 7: 98.5% accurate, 1.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1 or 1 < 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 99.7%

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

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

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

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

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

    if -1 < z < 1

    1. Initial program 98.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-neg98.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-in98.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-identity98.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+98.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-inv98.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-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. *-inverses98.3%

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 60.3% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.55 \cdot 10^{-46} \lor \neg \left(t \leq -8.2 \cdot 10^{-97}\right) \land \left(t \leq -6.5 \cdot 10^{-168} \lor \neg \left(t \leq 2.1 \cdot 10^{-87}\right)\right):\\
\;\;\;\;\frac{x}{y} - 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.55e-46 or -8.19999999999999986e-97 < t < -6.4999999999999997e-168 or 2.10000000000000007e-87 < t

    1. Initial program 83.1%

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

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

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

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

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

        \[\leadsto \frac{x}{y} + \frac{\color{blue}{\left(2 + z \cdot 2\right) - t \cdot \left(z \cdot 2\right)}}{t \cdot z} \]
      6. div-sub80.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*80.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/80.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.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.1%

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

    if -1.55e-46 < t < -8.19999999999999986e-97 or -6.4999999999999997e-168 < t < 2.10000000000000007e-87

    1. Initial program 97.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-neg97.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-in97.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-identity97.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+97.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-inv97.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-sub76.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*76.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/76.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. *-inverses97.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.55 \cdot 10^{-46} \lor \neg \left(t \leq -8.2 \cdot 10^{-97}\right) \land \left(t \leq -6.5 \cdot 10^{-168} \lor \neg \left(t \leq 2.1 \cdot 10^{-87}\right)\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t}\\ \end{array} \]

Alternative 9: 85.1% accurate, 1.3× speedup?

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

    1. Initial program 81.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-neg81.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-in81.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-identity81.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+81.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-inv81.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.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*81.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/81.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.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. Simplified99.9%

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

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

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

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

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

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

    if -1.79999999999999991e-16 < z < 2.05000000000000012e-96

    1. Initial program 97.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-neg97.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-in97.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-identity97.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+97.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-inv97.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-sub75.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*75.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/75.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. *-inverses97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 99.2% accurate, 1.3× speedup?

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

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

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

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

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

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

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

      \[\leadsto \frac{x}{y} + \frac{\color{blue}{\left(2 + z \cdot 2\right) - t \cdot \left(z \cdot 2\right)}}{t \cdot z} \]
    6. div-sub79.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*79.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/79.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.1%

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

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

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

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

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

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

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

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

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

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

Alternative 11: 36.9% accurate, 2.4× speedup?

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

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

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

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


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

    1. Initial program 76.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. clear-num76.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(2, \frac{\left(1 - t\right) \cdot z}{x}, 2 \cdot \frac{1}{x}\right)}}{\frac{t \cdot z}{x}} \]
      4. associate-/l*34.3%

        \[\leadsto \frac{\mathsf{fma}\left(2, \color{blue}{\frac{1 - t}{\frac{x}{z}}}, 2 \cdot \frac{1}{x}\right)}{\frac{t \cdot z}{x}} \]
      5. associate-*r/34.3%

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

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

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

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

    if -1 < t < 750

    1. Initial program 98.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-neg98.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-in98.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-identity98.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+98.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-inv98.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.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*81.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/81.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. *-inverses98.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 19.7% 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.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(2, \frac{\left(1 - t\right) \cdot z}{x}, 2 \cdot \frac{1}{x}\right)}}{\frac{t \cdot z}{x}} \]
    4. associate-/l*49.2%

      \[\leadsto \frac{\mathsf{fma}\left(2, \color{blue}{\frac{1 - t}{\frac{x}{z}}}, 2 \cdot \frac{1}{x}\right)}{\frac{t \cdot z}{x}} \]
    5. associate-*r/49.2%

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

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

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

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

    \[\leadsto -2 \]

Developer target: 99.2% accurate, 1.3× speedup?

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

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

Reproduce

?
herbie shell --seed 2023240 
(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))))