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

Percentage Accurate: 86.1% → 99.2%
Time: 10.8s
Alternatives: 14
Speedup: 1.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 86.1% 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 85.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-neg85.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-in85.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-identity85.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+85.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-inv85.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-sub76.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*76.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/76.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. Simplified99.9%

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

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

Alternative 2: 63.9% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;\frac{x}{y} \leq -1.55 \cdot 10^{-15}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;\frac{x}{y} \leq -1.3 \cdot 10^{-119}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;\frac{x}{y} \leq 3.8 \cdot 10^{-12}:\\
\;\;\;\;t_2\\

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


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

    1. Initial program 83.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} + \left(\color{blue}{-2} + \frac{2 + z \cdot 2}{t \cdot z}\right) \]
      16. associate-/l/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 inf 89.2%

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

    if -3.8999999999999998e64 < (/.f64 x y) < -1.5499999999999999e-15 or -2.04999999999999997e-85 < (/.f64 x y) < -1.30000000000000006e-119 or 1.5e-102 < (/.f64 x y) < 3.79999999999999996e-12

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.5499999999999999e-15 < (/.f64 x y) < -2.04999999999999997e-85 or -1.30000000000000006e-119 < (/.f64 x y) < 1.5e-102

    1. Initial program 75.5%

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

        \[\leadsto \frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \color{blue}{\left(1 + \left(-t\right)\right)}}{t \cdot z} \]
      2. distribute-rgt-in75.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-identity75.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+75.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-inv75.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-sub63.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*63.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/63.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.79999999999999996e-12 < (/.f64 x y)

    1. Initial program 92.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-neg92.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-in92.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-identity92.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+92.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-inv92.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-sub88.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*88.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/88.0%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -3.9 \cdot 10^{+64}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -1.55 \cdot 10^{-15}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{elif}\;\frac{x}{y} \leq -2.05 \cdot 10^{-85}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq -1.3 \cdot 10^{-119}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{elif}\;\frac{x}{y} \leq 1.5 \cdot 10^{-102}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 3.8 \cdot 10^{-12}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]

Alternative 3: 63.7% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;\frac{x}{y} \leq -1.5 \cdot 10^{-15}:\\
\;\;\;\;\frac{\frac{-2}{t}}{-z}\\

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

\mathbf{elif}\;\frac{x}{y} \leq -1.3 \cdot 10^{-119}:\\
\;\;\;\;t_2\\

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

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

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


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

    1. Initial program 83.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} + \left(\color{blue}{-2} + \frac{2 + z \cdot 2}{t \cdot z}\right) \]
      16. associate-/l/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 inf 89.2%

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

    if -5.4999999999999996e64 < (/.f64 x y) < -1.5e-15

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-2}}{-t \cdot z} \]
      4. distribute-rgt-neg-in57.3%

        \[\leadsto \frac{-2}{\color{blue}{t \cdot \left(-z\right)}} \]
    7. Applied egg-rr57.3%

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

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

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

    if -1.5e-15 < (/.f64 x y) < -6.3999999999999998e-71 or -1.30000000000000006e-119 < (/.f64 x y) < 2.20000000000000013e-102

    1. Initial program 75.5%

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

        \[\leadsto \frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \color{blue}{\left(1 + \left(-t\right)\right)}}{t \cdot z} \]
      2. distribute-rgt-in75.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-identity75.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+75.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-inv75.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-sub63.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*63.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/63.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.3999999999999998e-71 < (/.f64 x y) < -1.30000000000000006e-119 or 2.20000000000000013e-102 < (/.f64 x y) < 1.99999999999999988e-11

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

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

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

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

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

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

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

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

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

    if 1.99999999999999988e-11 < (/.f64 x y)

    1. Initial program 92.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-neg92.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-in92.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-identity92.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+92.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-inv92.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-sub88.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*88.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/88.0%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -5.5 \cdot 10^{+64}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -1.5 \cdot 10^{-15}:\\ \;\;\;\;\frac{\frac{-2}{t}}{-z}\\ \mathbf{elif}\;\frac{x}{y} \leq -6.4 \cdot 10^{-71}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq -1.3 \cdot 10^{-119}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{elif}\;\frac{x}{y} \leq 2.2 \cdot 10^{-102}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-11}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]

Alternative 4: 73.1% accurate, 0.7× speedup?

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

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

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

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

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

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


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

    1. Initial program 89.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-neg89.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-in89.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-identity89.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+89.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-inv89.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-sub84.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*84.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/84.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/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 85.9%

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

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

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

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

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

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

    if -2.3999999999999999e55 < (/.f64 x y) < -3.69999999999999978e-227 or 0.0 < (/.f64 x y) < 5.7e20

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.69999999999999978e-227 < (/.f64 x y) < 0.0

    1. Initial program 82.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-neg82.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-in82.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-identity82.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+82.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-inv82.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-sub67.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -2.4 \cdot 10^{+55}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq -3.7 \cdot 10^{-227}:\\ \;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;\frac{x}{y} \leq 0:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 5.7 \cdot 10^{+20}:\\ \;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \end{array} \]

Alternative 5: 51.6% accurate, 0.9× speedup?

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

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

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

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

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

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


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

    1. Initial program 89.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-neg89.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-in89.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-identity89.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+89.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-inv89.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1e11 < (/.f64 x y) < -1.64999999999999995e-273 or 0.0 < (/.f64 x y) < 2

    1. Initial program 78.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y} + \left(-2 + \frac{2 + \frac{2}{z}}{t}\right)} \]
    4. Taylor expanded in x around 0 98.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. associate-*r/98.5%

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

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

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

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

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

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

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

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

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

    if -1.64999999999999995e-273 < (/.f64 x y) < 0.0

    1. Initial program 86.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-neg86.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-in86.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-identity86.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+86.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-inv86.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-sub70.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*70.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/70.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 z around inf 70.2%

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

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

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{2}{t}} \]
    8. Taylor expanded in x around 0 42.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -100000000000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -1.65 \cdot 10^{-273}:\\ \;\;\;\;-2\\ \mathbf{elif}\;\frac{x}{y} \leq 0:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 2:\\ \;\;\;\;-2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 6: 92.8% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 89.6%

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

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

    if -1e20 < (/.f64 x y) < 5.00000000000000031e-10

    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-sub68.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*68.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/68.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 79.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x}{y} + \left(\frac{2}{t} - 2\right)\\
\mathbf{if}\;t \leq -9 \cdot 10^{-97}:\\
\;\;\;\;t_1\\

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -9.0000000000000002e-97 or 1.50000000000000003e-17 < t

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.0000000000000002e-97 < t < 5.20000000000000015e-148

    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-sub74.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*74.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/74.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.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. associate-*r/86.3%

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.20000000000000015e-148 < t < 1.2500000000000001e-34

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.2500000000000001e-34 < t < 1.50000000000000003e-17

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -9 \cdot 10^{-97}:\\ \;\;\;\;\frac{x}{y} + \left(\frac{2}{t} - 2\right)\\ \mathbf{elif}\;t \leq 5.2 \cdot 10^{-148}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{elif}\;t \leq 1.25 \cdot 10^{-34}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{elif}\;t \leq 1.5 \cdot 10^{-17}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + \left(\frac{2}{t} - 2\right)\\ \end{array} \]

Alternative 8: 67.3% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;t \leq -2 \cdot 10^{-108}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;t \leq 1.2 \cdot 10^{-34}:\\
\;\;\;\;t_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -6.6e14 or 4.8000000000000001e-16 < t

    1. Initial program 71.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-neg71.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-in71.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-identity71.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+71.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-inv71.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-sub71.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*71.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/71.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 t around inf 85.4%

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

    if -6.6e14 < t < -2.00000000000000008e-108 or 9.4999999999999996e-235 < t < 1.19999999999999996e-34

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.00000000000000008e-108 < t < 9.4999999999999996e-235

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{2}{t \cdot z}} \]
      2. frac-2neg56.4%

        \[\leadsto \color{blue}{\frac{-2}{-t \cdot z}} \]
      3. metadata-eval56.4%

        \[\leadsto \frac{\color{blue}{-2}}{-t \cdot z} \]
      4. distribute-rgt-neg-in56.4%

        \[\leadsto \frac{-2}{\color{blue}{t \cdot \left(-z\right)}} \]
    7. Applied egg-rr56.4%

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

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

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

    if 1.19999999999999996e-34 < t < 4.8000000000000001e-16

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -6.6 \cdot 10^{+14}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;t \leq -2 \cdot 10^{-108}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{elif}\;t \leq 9.5 \cdot 10^{-235}:\\ \;\;\;\;\frac{\frac{-2}{t}}{-z}\\ \mathbf{elif}\;t \leq 1.2 \cdot 10^{-34}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{elif}\;t \leq 4.8 \cdot 10^{-16}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]

Alternative 9: 77.7% accurate, 1.3× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -3.39999999999999973e-58 or 9.4999999999999999e-14 < t

    1. Initial program 74.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-neg74.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-in74.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-identity74.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+74.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-inv74.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-sub74.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*74.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/74.4%

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

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

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

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

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

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

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

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

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

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

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

    if -3.39999999999999973e-58 < t < 1.4e-148

    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-sub75.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*75.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/75.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.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.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4e-148 < t < 9.99999999999999928e-35

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.99999999999999928e-35 < t < 9.4999999999999999e-14

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.4 \cdot 10^{-58}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;t \leq 1.4 \cdot 10^{-148}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{elif}\;t \leq 10^{-34}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{elif}\;t \leq 9.5 \cdot 10^{-14}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]

Alternative 10: 92.0% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+19} \lor \neg \left(z \leq 1.15 \cdot 10^{-10}\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} - 2\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 < -4.2e19 or 1.15000000000000004e-10 < z

    1. Initial program 69.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-neg69.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-in69.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-identity69.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+69.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-inv69.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-sub69.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*69.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/69.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/100.0%

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

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

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

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

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

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

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

    if -4.2e19 < z < 1.15000000000000004e-10

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

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

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

Alternative 11: 65.9% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1.75 \cdot 10^{+14}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 245:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (/ x y) -1.75e+14)
   (/ x y)
   (if (<= (/ x y) 245.0) (+ -2.0 (/ 2.0 t)) (/ x y))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x / y) <= -1.75e+14) {
		tmp = x / y;
	} else if ((x / y) <= 245.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) <= (-1.75d+14)) then
        tmp = x / y
    else if ((x / y) <= 245.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) <= -1.75e+14) {
		tmp = x / y;
	} else if ((x / y) <= 245.0) {
		tmp = -2.0 + (2.0 / t);
	} else {
		tmp = x / y;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x / y) <= -1.75e+14:
		tmp = x / y
	elif (x / y) <= 245.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) <= -1.75e+14)
		tmp = Float64(x / y);
	elseif (Float64(x / y) <= 245.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) <= -1.75e+14)
		tmp = x / y;
	elseif ((x / y) <= 245.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], -1.75e+14], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 245.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 -1.75 \cdot 10^{+14}:\\
\;\;\;\;\frac{x}{y}\\

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

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


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

    1. Initial program 89.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-neg89.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-in89.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-identity89.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+89.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-inv89.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.75e14 < (/.f64 x y) < 245

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 65.4% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 85.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-neg85.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-in85.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-identity85.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+85.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-inv85.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-sub80.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.6e12 < (/.f64 x y) < 9.0000000000000005e-43

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.0000000000000005e-43 < (/.f64 x y)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 36.3% accurate, 2.4× speedup?

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

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

\mathbf{elif}\;t \leq 7.2 \cdot 10^{+18}:\\
\;\;\;\;\frac{2}{t}\\

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


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

    1. Initial program 71.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-neg71.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-in71.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-identity71.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+71.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-inv71.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-sub71.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*71.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/71.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y} + \left(-2 + \frac{2 + \frac{2}{z}}{t}\right)} \]
    4. Taylor expanded in x around 0 50.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. associate-*r/50.5%

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

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

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

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

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

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

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

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

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

    if -1.4e-11 < t < 7.2e18

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{2}{t}} \]
    8. Taylor expanded in x around 0 31.1%

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

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

Alternative 14: 19.7% accurate, 17.0× speedup?

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

\\
-2
\end{array}
Derivation
  1. Initial program 85.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-neg85.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-in85.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-identity85.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+85.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-inv85.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-sub76.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*76.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/76.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. Simplified99.9%

    \[\leadsto \color{blue}{\frac{x}{y} + \left(-2 + \frac{2 + \frac{2}{z}}{t}\right)} \]
  4. Taylor expanded in x around 0 63.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. associate-*r/63.0%

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

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

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

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

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

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

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

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

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

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