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

Percentage Accurate: 87.0% → 99.2%
Time: 9.1s
Alternatives: 11
Speedup: 1.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 87.0% accurate, 1.0× speedup?

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

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

Alternative 1: 99.2% accurate, 1.3× speedup?

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

\\
\frac{x}{y} + \left(-2 + \frac{2 + \frac{2}{z}}{t}\right)
\end{array}
Derivation
  1. Initial program 90.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-neg90.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-in90.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-identity90.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+90.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-inv90.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-sub82.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*82.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/82.2%

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 64.3% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;\frac{x}{y} \leq -1.35 \cdot 10^{+78} \lor \neg \left(\frac{x}{y} \leq -2.2 \cdot 10^{+18}\right) \land \frac{x}{y} \leq 550000000:\\
\;\;\;\;-2 + \frac{2}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -7.8000000000000004e130 or -1.35000000000000002e78 < (/.f64 x y) < -2.2e18 or 5.5e8 < (/.f64 x y)

    1. Initial program 93.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-neg93.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-in93.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-identity93.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+93.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-inv93.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-sub87.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*87.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/87.2%

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

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

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

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

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

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

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

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

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

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

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

    if -7.8000000000000004e130 < (/.f64 x y) < -1.35000000000000002e78 or -2.2e18 < (/.f64 x y) < 5.5e8

    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. sub-neg87.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -7.8 \cdot 10^{+130}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -1.35 \cdot 10^{+78} \lor \neg \left(\frac{x}{y} \leq -2.2 \cdot 10^{+18}\right) \land \frac{x}{y} \leq 550000000:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 3: 51.3% accurate, 0.9× speedup?

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

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

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

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

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

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


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

    1. Initial program 93.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-neg93.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-in93.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-identity93.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+93.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-inv93.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-sub87.9%

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

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

        \[\leadsto \frac{x}{y} + \left(\frac{2 + z \cdot 2}{t \cdot z} - \color{blue}{\frac{t \cdot z}{t \cdot z} \cdot 2}\right) \]
      9. *-inverses99.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.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. Taylor expanded in x around inf 65.9%

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

    if -7.8000000000000004e130 < (/.f64 x y) < -1.4000000000000001e78

    1. Initial program 91.7%

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

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

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

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

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

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

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

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

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

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

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

    if -4.8e8 < (/.f64 x y) < 2

    1. Initial program 86.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -7.8 \cdot 10^{+130}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -1.4 \cdot 10^{+78}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq -480000000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 2:\\ \;\;\;\;-2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 4: 81.6% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -8.6000000000000002e-7 or 1.35e-49 < t

    1. Initial program 83.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. sub-neg83.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.6000000000000002e-7 < t < 1.35e-49

    1. Initial program 99.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-neg99.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-in99.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-identity99.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+99.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-inv99.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.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 92.1% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7.79999999999999982e-41 or 2.89999999999999996e-32 < z

    1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.79999999999999982e-41 < z < 2.89999999999999996e-32

    1. Initial program 99.8%

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

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

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

Alternative 6: 62.8% accurate, 1.5× speedup?

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

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

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

\mathbf{elif}\;z \leq 1.55 \cdot 10^{+75}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.40000000000000024e-41 or 2.5000000000000001e-174 < z < 1.5500000000000001e75

    1. Initial program 89.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-neg89.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-in89.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-identity89.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+89.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-inv89.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-sub87.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*87.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/87.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.9%

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

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

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

    if -6.40000000000000024e-41 < z < 2.5000000000000001e-174

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{2}{t \cdot z}} \]
      2. *-commutative67.0%

        \[\leadsto \frac{2}{\color{blue}{z \cdot t}} \]
    7. Applied egg-rr67.0%

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

    if 1.5500000000000001e75 < z

    1. Initial program 69.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. sub-neg69.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.4 \cdot 10^{-41}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-174}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{+75}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \end{array} \]

Alternative 7: 62.9% accurate, 1.5× speedup?

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

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

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

\mathbf{elif}\;z \leq 1.2 \cdot 10^{+73}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.80000000000000044e-41 or 1.45000000000000003e-176 < z < 1.20000000000000001e73

    1. Initial program 89.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-neg89.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-in89.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-identity89.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+89.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-inv89.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-sub87.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*87.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/87.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.9%

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

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

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

    if -4.80000000000000044e-41 < z < 1.45000000000000003e-176

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \color{blue}{\frac{1}{t \cdot z}} \]
    6. Step-by-step derivation
      1. expm1-log1p-u30.6%

        \[\leadsto 2 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{t \cdot z}\right)\right)} \]
      2. expm1-udef30.6%

        \[\leadsto 2 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{1}{t \cdot z}\right)} - 1\right)} \]
      3. *-commutative30.6%

        \[\leadsto 2 \cdot \left(e^{\mathsf{log1p}\left(\frac{1}{\color{blue}{z \cdot t}}\right)} - 1\right) \]
    7. Applied egg-rr30.6%

      \[\leadsto 2 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{1}{z \cdot t}\right)} - 1\right)} \]
    8. Step-by-step derivation
      1. expm1-def30.6%

        \[\leadsto 2 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{z \cdot t}\right)\right)} \]
      2. expm1-log1p67.0%

        \[\leadsto 2 \cdot \color{blue}{\frac{1}{z \cdot t}} \]
      3. *-commutative67.0%

        \[\leadsto 2 \cdot \frac{1}{\color{blue}{t \cdot z}} \]
      4. associate-/r*67.0%

        \[\leadsto 2 \cdot \color{blue}{\frac{\frac{1}{t}}{z}} \]
    9. Simplified67.0%

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

        \[\leadsto \color{blue}{\frac{2 \cdot \frac{1}{t}}{z}} \]
      2. div-inv67.0%

        \[\leadsto \frac{\color{blue}{\frac{2}{t}}}{z} \]
    11. Applied egg-rr67.0%

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

    if 1.20000000000000001e73 < z

    1. Initial program 69.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. sub-neg69.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.8 \cdot 10^{-41}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-176}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{+73}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \end{array} \]

Alternative 8: 78.5% accurate, 1.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -8.50000000000000014e-7 or 6.2e78 < t

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

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

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

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

    if -8.50000000000000014e-7 < t < 6.2e78

    1. Initial program 98.1%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Step-by-step derivation
      1. sub-neg98.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-in98.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-identity98.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+98.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-inv98.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 60.2% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 84.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-neg84.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-in84.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-identity84.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+84.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-inv84.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-sub82.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*82.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/82.2%

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

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

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

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

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

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

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

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

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

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

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

    if -1.95e-138 < t < 8.9999999999999999e-11

    1. Initial program 99.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-neg99.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-in99.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-identity99.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+99.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-inv99.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-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.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 36.9% accurate, 2.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1:\\ \;\;\;\;-2\\ \mathbf{elif}\;t \leq 2.85 \cdot 10^{-5}:\\ \;\;\;\;\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 2.85e-5) (/ 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 <= 2.85e-5) {
		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 <= 2.85d-5) 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 <= 2.85e-5) {
		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 <= 2.85e-5:
		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 <= 2.85e-5)
		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 <= 2.85e-5)
		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, 2.85e-5], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < t < 2.8500000000000002e-5

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 20.0% accurate, 17.0× speedup?

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

\\
-2
\end{array}
Derivation
  1. Initial program 90.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-neg90.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-in90.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-identity90.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+90.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-inv90.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-sub82.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*82.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/82.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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