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

Percentage Accurate: 86.8% → 99.2%
Time: 14.5s
Alternatives: 15
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 15 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.8% 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.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{x}{y} + \left(-2 + \frac{1}{t} \cdot \left(2 + \frac{2}{z}\right)\right) \]
  7. Add Preprocessing

Alternative 2: 61.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{2}{t \cdot z}\\ t_2 := \frac{x}{y} + -2\\ \mathbf{if}\;t \leq -0.00078:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t \leq -5 \cdot 10^{-137}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq -1.9 \cdot 10^{-180}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;t \leq -1.25 \cdot 10^{-272}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 2.45 \cdot 10^{-159}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;t \leq 1.55 \cdot 10^{+53} \lor \neg \left(t \leq 1.6 \cdot 10^{+63}\right):\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ 2.0 (* t z))) (t_2 (+ (/ x y) -2.0)))
   (if (<= t -0.00078)
     t_2
     (if (<= t -5e-137)
       t_1
       (if (<= t -1.9e-180)
         (/ 2.0 t)
         (if (<= t -1.25e-272)
           t_1
           (if (<= t 2.45e-159)
             (/ 2.0 t)
             (if (or (<= t 1.55e+53) (not (<= t 1.6e+63))) t_2 t_1))))))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 / (t * z);
	double t_2 = (x / y) + -2.0;
	double tmp;
	if (t <= -0.00078) {
		tmp = t_2;
	} else if (t <= -5e-137) {
		tmp = t_1;
	} else if (t <= -1.9e-180) {
		tmp = 2.0 / t;
	} else if (t <= -1.25e-272) {
		tmp = t_1;
	} else if (t <= 2.45e-159) {
		tmp = 2.0 / t;
	} else if ((t <= 1.55e+53) || !(t <= 1.6e+63)) {
		tmp = t_2;
	} 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) :: t_2
    real(8) :: tmp
    t_1 = 2.0d0 / (t * z)
    t_2 = (x / y) + (-2.0d0)
    if (t <= (-0.00078d0)) then
        tmp = t_2
    else if (t <= (-5d-137)) then
        tmp = t_1
    else if (t <= (-1.9d-180)) then
        tmp = 2.0d0 / t
    else if (t <= (-1.25d-272)) then
        tmp = t_1
    else if (t <= 2.45d-159) then
        tmp = 2.0d0 / t
    else if ((t <= 1.55d+53) .or. (.not. (t <= 1.6d+63))) then
        tmp = t_2
    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 = 2.0 / (t * z);
	double t_2 = (x / y) + -2.0;
	double tmp;
	if (t <= -0.00078) {
		tmp = t_2;
	} else if (t <= -5e-137) {
		tmp = t_1;
	} else if (t <= -1.9e-180) {
		tmp = 2.0 / t;
	} else if (t <= -1.25e-272) {
		tmp = t_1;
	} else if (t <= 2.45e-159) {
		tmp = 2.0 / t;
	} else if ((t <= 1.55e+53) || !(t <= 1.6e+63)) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 / (t * z)
	t_2 = (x / y) + -2.0
	tmp = 0
	if t <= -0.00078:
		tmp = t_2
	elif t <= -5e-137:
		tmp = t_1
	elif t <= -1.9e-180:
		tmp = 2.0 / t
	elif t <= -1.25e-272:
		tmp = t_1
	elif t <= 2.45e-159:
		tmp = 2.0 / t
	elif (t <= 1.55e+53) or not (t <= 1.6e+63):
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(2.0 / Float64(t * z))
	t_2 = Float64(Float64(x / y) + -2.0)
	tmp = 0.0
	if (t <= -0.00078)
		tmp = t_2;
	elseif (t <= -5e-137)
		tmp = t_1;
	elseif (t <= -1.9e-180)
		tmp = Float64(2.0 / t);
	elseif (t <= -1.25e-272)
		tmp = t_1;
	elseif (t <= 2.45e-159)
		tmp = Float64(2.0 / t);
	elseif ((t <= 1.55e+53) || !(t <= 1.6e+63))
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = 2.0 / (t * z);
	t_2 = (x / y) + -2.0;
	tmp = 0.0;
	if (t <= -0.00078)
		tmp = t_2;
	elseif (t <= -5e-137)
		tmp = t_1;
	elseif (t <= -1.9e-180)
		tmp = 2.0 / t;
	elseif (t <= -1.25e-272)
		tmp = t_1;
	elseif (t <= 2.45e-159)
		tmp = 2.0 / t;
	elseif ((t <= 1.55e+53) || ~((t <= 1.6e+63)))
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] + -2.0), $MachinePrecision]}, If[LessEqual[t, -0.00078], t$95$2, If[LessEqual[t, -5e-137], t$95$1, If[LessEqual[t, -1.9e-180], N[(2.0 / t), $MachinePrecision], If[LessEqual[t, -1.25e-272], t$95$1, If[LessEqual[t, 2.45e-159], N[(2.0 / t), $MachinePrecision], If[Or[LessEqual[t, 1.55e+53], N[Not[LessEqual[t, 1.6e+63]], $MachinePrecision]], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq -5 \cdot 10^{-137}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq -1.9 \cdot 10^{-180}:\\
\;\;\;\;\frac{2}{t}\\

\mathbf{elif}\;t \leq -1.25 \cdot 10^{-272}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 2.45 \cdot 10^{-159}:\\
\;\;\;\;\frac{2}{t}\\

\mathbf{elif}\;t \leq 1.55 \cdot 10^{+53} \lor \neg \left(t \leq 1.6 \cdot 10^{+63}\right):\\
\;\;\;\;t\_2\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -7.79999999999999986e-4 or 2.45000000000000007e-159 < t < 1.5500000000000001e53 or 1.60000000000000006e63 < t

    1. Initial program 79.5%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 78.3%

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

    if -7.79999999999999986e-4 < t < -5.00000000000000001e-137 or -1.9e-180 < t < -1.24999999999999995e-272 or 1.5500000000000001e53 < t < 1.60000000000000006e63

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.00000000000000001e-137 < t < -1.9e-180 or -1.24999999999999995e-272 < t < 2.45000000000000007e-159

    1. Initial program 94.3%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -0.00078:\\ \;\;\;\;\frac{x}{y} + -2\\ \mathbf{elif}\;t \leq -5 \cdot 10^{-137}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{elif}\;t \leq -1.9 \cdot 10^{-180}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;t \leq -1.25 \cdot 10^{-272}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{elif}\;t \leq 2.45 \cdot 10^{-159}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;t \leq 1.55 \cdot 10^{+53} \lor \neg \left(t \leq 1.6 \cdot 10^{+63}\right):\\ \;\;\;\;\frac{x}{y} + -2\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 61.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} + -2\\ t_2 := \frac{2}{t \cdot z}\\ \mathbf{if}\;t \leq -0.135:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq -1.3 \cdot 10^{-132}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;t \leq -8.5 \cdot 10^{-181}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;t \leq -1.2 \cdot 10^{-272}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t \leq 9.2 \cdot 10^{-159}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;t \leq 1.55 \cdot 10^{+53} \lor \neg \left(t \leq 1.6 \cdot 10^{+63}\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ (/ x y) -2.0)) (t_2 (/ 2.0 (* t z))))
   (if (<= t -0.135)
     t_1
     (if (<= t -1.3e-132)
       (/ (/ 2.0 t) z)
       (if (<= t -8.5e-181)
         (/ 2.0 t)
         (if (<= t -1.2e-272)
           t_2
           (if (<= t 9.2e-159)
             (/ 2.0 t)
             (if (or (<= t 1.55e+53) (not (<= t 1.6e+63))) t_1 t_2))))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / y) + -2.0;
	double t_2 = 2.0 / (t * z);
	double tmp;
	if (t <= -0.135) {
		tmp = t_1;
	} else if (t <= -1.3e-132) {
		tmp = (2.0 / t) / z;
	} else if (t <= -8.5e-181) {
		tmp = 2.0 / t;
	} else if (t <= -1.2e-272) {
		tmp = t_2;
	} else if (t <= 9.2e-159) {
		tmp = 2.0 / t;
	} else if ((t <= 1.55e+53) || !(t <= 1.6e+63)) {
		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 = (x / y) + (-2.0d0)
    t_2 = 2.0d0 / (t * z)
    if (t <= (-0.135d0)) then
        tmp = t_1
    else if (t <= (-1.3d-132)) then
        tmp = (2.0d0 / t) / z
    else if (t <= (-8.5d-181)) then
        tmp = 2.0d0 / t
    else if (t <= (-1.2d-272)) then
        tmp = t_2
    else if (t <= 9.2d-159) then
        tmp = 2.0d0 / t
    else if ((t <= 1.55d+53) .or. (.not. (t <= 1.6d+63))) 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 = (x / y) + -2.0;
	double t_2 = 2.0 / (t * z);
	double tmp;
	if (t <= -0.135) {
		tmp = t_1;
	} else if (t <= -1.3e-132) {
		tmp = (2.0 / t) / z;
	} else if (t <= -8.5e-181) {
		tmp = 2.0 / t;
	} else if (t <= -1.2e-272) {
		tmp = t_2;
	} else if (t <= 9.2e-159) {
		tmp = 2.0 / t;
	} else if ((t <= 1.55e+53) || !(t <= 1.6e+63)) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / y) + -2.0
	t_2 = 2.0 / (t * z)
	tmp = 0
	if t <= -0.135:
		tmp = t_1
	elif t <= -1.3e-132:
		tmp = (2.0 / t) / z
	elif t <= -8.5e-181:
		tmp = 2.0 / t
	elif t <= -1.2e-272:
		tmp = t_2
	elif t <= 9.2e-159:
		tmp = 2.0 / t
	elif (t <= 1.55e+53) or not (t <= 1.6e+63):
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x / y) + -2.0)
	t_2 = Float64(2.0 / Float64(t * z))
	tmp = 0.0
	if (t <= -0.135)
		tmp = t_1;
	elseif (t <= -1.3e-132)
		tmp = Float64(Float64(2.0 / t) / z);
	elseif (t <= -8.5e-181)
		tmp = Float64(2.0 / t);
	elseif (t <= -1.2e-272)
		tmp = t_2;
	elseif (t <= 9.2e-159)
		tmp = Float64(2.0 / t);
	elseif ((t <= 1.55e+53) || !(t <= 1.6e+63))
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x / y) + -2.0;
	t_2 = 2.0 / (t * z);
	tmp = 0.0;
	if (t <= -0.135)
		tmp = t_1;
	elseif (t <= -1.3e-132)
		tmp = (2.0 / t) / z;
	elseif (t <= -8.5e-181)
		tmp = 2.0 / t;
	elseif (t <= -1.2e-272)
		tmp = t_2;
	elseif (t <= 9.2e-159)
		tmp = 2.0 / t;
	elseif ((t <= 1.55e+53) || ~((t <= 1.6e+63)))
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] + -2.0), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -0.135], t$95$1, If[LessEqual[t, -1.3e-132], N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t, -8.5e-181], N[(2.0 / t), $MachinePrecision], If[LessEqual[t, -1.2e-272], t$95$2, If[LessEqual[t, 9.2e-159], N[(2.0 / t), $MachinePrecision], If[Or[LessEqual[t, 1.55e+53], N[Not[LessEqual[t, 1.6e+63]], $MachinePrecision]], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;t \leq -8.5 \cdot 10^{-181}:\\
\;\;\;\;\frac{2}{t}\\

\mathbf{elif}\;t \leq -1.2 \cdot 10^{-272}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t \leq 9.2 \cdot 10^{-159}:\\
\;\;\;\;\frac{2}{t}\\

\mathbf{elif}\;t \leq 1.55 \cdot 10^{+53} \lor \neg \left(t \leq 1.6 \cdot 10^{+63}\right):\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -0.13500000000000001 or 9.19999999999999914e-159 < t < 1.5500000000000001e53 or 1.60000000000000006e63 < t

    1. Initial program 79.5%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 78.3%

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

    if -0.13500000000000001 < t < -1.3e-132

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{2}{t}}{z}} \]
    11. Simplified65.3%

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

    if -1.3e-132 < t < -8.49999999999999953e-181 or -1.19999999999999995e-272 < t < 9.19999999999999914e-159

    1. Initial program 94.3%

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

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

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

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

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

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

    if -8.49999999999999953e-181 < t < -1.19999999999999995e-272 or 1.5500000000000001e53 < t < 1.60000000000000006e63

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -0.135:\\ \;\;\;\;\frac{x}{y} + -2\\ \mathbf{elif}\;t \leq -1.3 \cdot 10^{-132}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;t \leq -8.5 \cdot 10^{-181}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;t \leq -1.2 \cdot 10^{-272}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{elif}\;t \leq 9.2 \cdot 10^{-159}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;t \leq 1.55 \cdot 10^{+53} \lor \neg \left(t \leq 1.6 \cdot 10^{+63}\right):\\ \;\;\;\;\frac{x}{y} + -2\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 64.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{2}{t \cdot z}\\ t_2 := 2 \cdot \left(\frac{1}{t} + -1\right)\\ \mathbf{if}\;\frac{x}{y} \leq -4 \cdot 10^{+58}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 9.2 \cdot 10^{-181}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;\frac{x}{y} \leq 7.8 \cdot 10^{-71}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{x}{y} \leq 2.9 \cdot 10^{-5}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;\frac{x}{y} \leq 6.8 \cdot 10^{+16}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ 2.0 (* t z))) (t_2 (* 2.0 (+ (/ 1.0 t) -1.0))))
   (if (<= (/ x y) -4e+58)
     (/ x y)
     (if (<= (/ x y) 9.2e-181)
       t_2
       (if (<= (/ x y) 7.8e-71)
         t_1
         (if (<= (/ x y) 2.9e-5)
           t_2
           (if (<= (/ x y) 6.8e+16) t_1 (/ x y))))))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 / (t * z);
	double t_2 = 2.0 * ((1.0 / t) + -1.0);
	double tmp;
	if ((x / y) <= -4e+58) {
		tmp = x / y;
	} else if ((x / y) <= 9.2e-181) {
		tmp = t_2;
	} else if ((x / y) <= 7.8e-71) {
		tmp = t_1;
	} else if ((x / y) <= 2.9e-5) {
		tmp = t_2;
	} else if ((x / y) <= 6.8e+16) {
		tmp = t_1;
	} else {
		tmp = x / y;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = 2.0d0 / (t * z)
    t_2 = 2.0d0 * ((1.0d0 / t) + (-1.0d0))
    if ((x / y) <= (-4d+58)) then
        tmp = x / y
    else if ((x / y) <= 9.2d-181) then
        tmp = t_2
    else if ((x / y) <= 7.8d-71) then
        tmp = t_1
    else if ((x / y) <= 2.9d-5) then
        tmp = t_2
    else if ((x / y) <= 6.8d+16) then
        tmp = t_1
    else
        tmp = x / y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = 2.0 / (t * z);
	double t_2 = 2.0 * ((1.0 / t) + -1.0);
	double tmp;
	if ((x / y) <= -4e+58) {
		tmp = x / y;
	} else if ((x / y) <= 9.2e-181) {
		tmp = t_2;
	} else if ((x / y) <= 7.8e-71) {
		tmp = t_1;
	} else if ((x / y) <= 2.9e-5) {
		tmp = t_2;
	} else if ((x / y) <= 6.8e+16) {
		tmp = t_1;
	} else {
		tmp = x / y;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 / (t * z)
	t_2 = 2.0 * ((1.0 / t) + -1.0)
	tmp = 0
	if (x / y) <= -4e+58:
		tmp = x / y
	elif (x / y) <= 9.2e-181:
		tmp = t_2
	elif (x / y) <= 7.8e-71:
		tmp = t_1
	elif (x / y) <= 2.9e-5:
		tmp = t_2
	elif (x / y) <= 6.8e+16:
		tmp = t_1
	else:
		tmp = x / y
	return tmp
function code(x, y, z, t)
	t_1 = Float64(2.0 / Float64(t * z))
	t_2 = Float64(2.0 * Float64(Float64(1.0 / t) + -1.0))
	tmp = 0.0
	if (Float64(x / y) <= -4e+58)
		tmp = Float64(x / y);
	elseif (Float64(x / y) <= 9.2e-181)
		tmp = t_2;
	elseif (Float64(x / y) <= 7.8e-71)
		tmp = t_1;
	elseif (Float64(x / y) <= 2.9e-5)
		tmp = t_2;
	elseif (Float64(x / y) <= 6.8e+16)
		tmp = t_1;
	else
		tmp = Float64(x / y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = 2.0 / (t * z);
	t_2 = 2.0 * ((1.0 / t) + -1.0);
	tmp = 0.0;
	if ((x / y) <= -4e+58)
		tmp = x / y;
	elseif ((x / y) <= 9.2e-181)
		tmp = t_2;
	elseif ((x / y) <= 7.8e-71)
		tmp = t_1;
	elseif ((x / y) <= 2.9e-5)
		tmp = t_2;
	elseif ((x / y) <= 6.8e+16)
		tmp = t_1;
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(N[(1.0 / t), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -4e+58], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 9.2e-181], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], 7.8e-71], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 2.9e-5], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], 6.8e+16], t$95$1, N[(x / y), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{2}{t \cdot z}\\
t_2 := 2 \cdot \left(\frac{1}{t} + -1\right)\\
\mathbf{if}\;\frac{x}{y} \leq -4 \cdot 10^{+58}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;\frac{x}{y} \leq 9.2 \cdot 10^{-181}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;\frac{x}{y} \leq 7.8 \cdot 10^{-71}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{x}{y} \leq 2.9 \cdot 10^{-5}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;\frac{x}{y} \leq 6.8 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 83.4%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 75.6%

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

    if -3.99999999999999978e58 < (/.f64 x y) < 9.19999999999999963e-181 or 7.8000000000000004e-71 < (/.f64 x y) < 2.9e-5

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{\color{blue}{z \cdot t}}, -\frac{-x}{y}\right) \]
      15. distribute-frac-neg85.4%

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, -\color{blue}{\left(-\frac{x}{y}\right)}\right) \]
      16. remove-double-neg85.4%

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

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

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

      \[\leadsto 2 \cdot \color{blue}{\frac{1 - t}{t}} \]
    7. Step-by-step derivation
      1. div-sub65.3%

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

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

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

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

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

    if 9.19999999999999963e-181 < (/.f64 x y) < 7.8000000000000004e-71 or 2.9e-5 < (/.f64 x y) < 6.8e16

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -4 \cdot 10^{+58}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 9.2 \cdot 10^{-181}:\\ \;\;\;\;2 \cdot \left(\frac{1}{t} + -1\right)\\ \mathbf{elif}\;\frac{x}{y} \leq 7.8 \cdot 10^{-71}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{elif}\;\frac{x}{y} \leq 2.9 \cdot 10^{-5}:\\ \;\;\;\;2 \cdot \left(\frac{1}{t} + -1\right)\\ \mathbf{elif}\;\frac{x}{y} \leq 6.8 \cdot 10^{+16}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 90.9% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;\frac{x}{y} \leq 1.8 \cdot 10^{+17}:\\
\;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\

\mathbf{elif}\;\frac{x}{y} \leq 3.6 \cdot 10^{+70}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 x y) < -1.3499999999999999e-5 or 1.8e17 < (/.f64 x y) < 3.6e70

    1. Initial program 89.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.3499999999999999e-5 < (/.f64 x y) < 1.8e17

    1. Initial program 87.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2 + \frac{2}{z}}{t} + \color{blue}{-2} \]
      12. +-commutative99.8%

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

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

    if 3.6e70 < (/.f64 x y)

    1. Initial program 76.7%

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{\frac{2}{t}}{z}} \]
    6. Step-by-step derivation
      1. associate-/l/90.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1.35 \cdot 10^{-5}:\\ \;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\ \mathbf{elif}\;\frac{x}{y} \leq 1.8 \cdot 10^{+17}:\\ \;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 3.6 \cdot 10^{+70}:\\ \;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + \frac{1}{t} \cdot \frac{2}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 90.8% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;\frac{x}{y} \leq 5.1 \cdot 10^{+16}:\\
\;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\

\mathbf{elif}\;\frac{x}{y} \leq 2.1 \cdot 10^{+71}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 x y) < -8.7999999999999996e-10 or 5.1e16 < (/.f64 x y) < 2.09999999999999989e71

    1. Initial program 89.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.7999999999999996e-10 < (/.f64 x y) < 5.1e16

    1. Initial program 87.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2 + \frac{2}{z}}{t} + \color{blue}{-2} \]
      12. +-commutative99.8%

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

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

    if 2.09999999999999989e71 < (/.f64 x y)

    1. Initial program 76.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -8.8 \cdot 10^{-10}:\\ \;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\ \mathbf{elif}\;\frac{x}{y} \leq 5.1 \cdot 10^{+16}:\\ \;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 2.1 \cdot 10^{+71}:\\ \;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 79.8% accurate, 0.7× speedup?

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

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

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

\mathbf{elif}\;t \leq 1.55 \cdot 10^{+53} \lor \neg \left(t \leq 1.6 \cdot 10^{+63}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -7.49999999999999934e-5 or 6.0000000000000001e-32 < t < 1.5500000000000001e53 or 1.60000000000000006e63 < t

    1. Initial program 77.1%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 85.3%

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

    if -7.49999999999999934e-5 < t < 6.0000000000000001e-32

    1. Initial program 96.2%

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

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

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

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

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

    if 1.5500000000000001e53 < t < 1.60000000000000006e63

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -7.5 \cdot 10^{-5}:\\ \;\;\;\;\frac{x}{y} + -2\\ \mathbf{elif}\;t \leq 6 \cdot 10^{-32}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{elif}\;t \leq 1.55 \cdot 10^{+53} \lor \neg \left(t \leq 1.6 \cdot 10^{+63}\right):\\ \;\;\;\;\frac{x}{y} + -2\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 52.0% accurate, 0.7× speedup?

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

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

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

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

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


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

    1. Initial program 84.0%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 72.3%

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

    if -13500 < (/.f64 x y) < 2.1e-276

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, -\color{blue}{\left(-\frac{x}{y}\right)}\right) \]
      16. remove-double-neg86.3%

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

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

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

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

    if 2.1e-276 < (/.f64 x y) < 2.9e17

    1. Initial program 89.6%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -13500:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 2.1 \cdot 10^{-276}:\\ \;\;\;\;-2\\ \mathbf{elif}\;\frac{x}{y} \leq 2.9 \cdot 10^{+17}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 89.8% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 84.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0054000000000000003 < (/.f64 x y) < 3.3e16

    1. Initial program 87.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2 + \frac{2}{z}}{t} + \color{blue}{-2} \]
      12. +-commutative99.8%

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

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

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

Alternative 10: 84.9% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{+123}:\\
\;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\

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


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

    1. Initial program 88.1%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 88.4%

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

    if -1.59999999999999996e103 < (/.f64 x y) < 3.99999999999999991e123

    1. Initial program 88.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999991e123 < (/.f64 x y)

    1. Initial program 73.9%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 89.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1.6 \cdot 10^{+103}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{+123}:\\ \;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + -2\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 98.5% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 74.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < z < 1

    1. Initial program 96.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 61.8% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{-62} \lor \neg \left(t \leq 1.38 \cdot 10^{-160}\right):\\
\;\;\;\;\frac{x}{y} + -2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.80000000000000002e-62 or 1.38e-160 < t

    1. Initial program 81.0%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 73.8%

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

    if -2.80000000000000002e-62 < t < 1.38e-160

    1. Initial program 96.1%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.8 \cdot 10^{-62} \lor \neg \left(t \leq 1.38 \cdot 10^{-160}\right):\\ \;\;\;\;\frac{x}{y} + -2\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 37.3% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 77.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. +-commutative77.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, -\color{blue}{\left(-\frac{x}{y}\right)}\right) \]
      16. remove-double-neg77.0%

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

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

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

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

    if -2.0499999999999999e-6 < t < 1

    1. Initial program 96.4%

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

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

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

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

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

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

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

Alternative 14: 99.2% accurate, 1.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 20.4% 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.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. +-commutative85.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, -\color{blue}{\left(-\frac{x}{y}\right)}\right) \]
    16. remove-double-neg85.7%

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

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

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

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

    \[\leadsto -2 \]
  8. Add Preprocessing

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 2024029 
(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))))