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

Percentage Accurate: 86.5% → 99.1%
Time: 10.7s
Alternatives: 13
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 13 alternatives:

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

Initial Program: 86.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.1% accurate, 1.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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) \]
    14. remove-double-neg89.6%

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

    \[\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 t around inf 99.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 79.9% accurate, 0.6× speedup?

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

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

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

\mathbf{elif}\;t \leq -3.2 \cdot 10^{-12} \lor \neg \left(t \leq 1.9 \cdot 10^{-23}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.1e82 or -9.20000000000000047e39 < t < -3.2000000000000001e-12 or 1.90000000000000006e-23 < t

    1. Initial program 81.7%

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

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

    if -2.1e82 < t < -9.20000000000000047e39

    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 z around inf 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} + \color{blue}{\left(-2 + \left(2 \cdot \frac{1}{t} + \frac{2}{t \cdot z}\right)\right)} \]
      15. 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) \]
      16. 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) \]
      17. 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) \]
      18. *-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) \]
      19. associate-*r/99.5%

        \[\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) \]
    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 99.8%

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{2}}{t \cdot z} + -2 \]
      5. associate-/l/88.6%

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

        \[\leadsto \color{blue}{-2 + \frac{\frac{2}{z}}{t}} \]
      7. associate-/l/88.8%

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

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

    if -3.2000000000000001e-12 < t < 1.90000000000000006e-23

    1. Initial program 98.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 81.8%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.1 \cdot 10^{+82}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;t \leq -9.2 \cdot 10^{+39}:\\ \;\;\;\;-2 + \frac{2}{z \cdot t}\\ \mathbf{elif}\;t \leq -3.2 \cdot 10^{-12} \lor \neg \left(t \leq 1.9 \cdot 10^{-23}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 79.8% accurate, 0.6× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -8.00000000000000025e83 or 2.1000000000000001e-23 < t

    1. Initial program 79.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 90.0%

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

    if -8.00000000000000025e83 < t < -8.49999999999999971e39

    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 z around inf 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} + \color{blue}{\left(-2 + \left(2 \cdot \frac{1}{t} + \frac{2}{t \cdot z}\right)\right)} \]
      15. 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) \]
      16. 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) \]
      17. 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) \]
      18. *-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) \]
      19. associate-*r/99.5%

        \[\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) \]
    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 99.8%

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{2}}{t \cdot z} + -2 \]
      5. associate-/l/88.6%

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

        \[\leadsto \color{blue}{-2 + \frac{\frac{2}{z}}{t}} \]
      7. associate-/l/88.8%

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

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

    if -8.49999999999999971e39 < t < -1.6999999999999999e-9

    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 z around inf 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} + \color{blue}{\left(-2 + \left(2 \cdot \frac{1}{t} + \frac{2}{t \cdot z}\right)\right)} \]
      15. 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) \]
      16. 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) \]
      17. 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) \]
      18. *-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) \]
      19. 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) \]
    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 y around 0 90.1%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x + -2 \cdot y}{y}} \]
    10. Step-by-step derivation
      1. *-commutative76.3%

        \[\leadsto \frac{x + \color{blue}{y \cdot -2}}{y} \]
    11. Simplified76.3%

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

    if -1.6999999999999999e-9 < t < 2.1000000000000001e-23

    1. Initial program 98.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 81.8%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -8 \cdot 10^{+83}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;t \leq -8.5 \cdot 10^{+39}:\\ \;\;\;\;-2 + \frac{2}{z \cdot t}\\ \mathbf{elif}\;t \leq -1.7 \cdot 10^{-9}:\\ \;\;\;\;\frac{x + y \cdot -2}{y}\\ \mathbf{elif}\;t \leq 2.1 \cdot 10^{-23}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 89.2% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -1.00000000000000006e-9 or 2.00000000000000009e42 < (/.f64 x y)

    1. Initial program 90.7%

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

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \frac{1 - t}{t}} \]
    4. Step-by-step derivation
      1. div-sub90.3%

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

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

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

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

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

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

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

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

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

    if -1.00000000000000006e-9 < (/.f64 x y) < 2.00000000000000009e42

    1. Initial program 88.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 z around inf 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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) \]
      19. associate-*r/99.9%

        \[\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) \]
    5. Simplified99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 85.4% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2.2 \cdot 10^{+40} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+42}\right):\\
\;\;\;\;\frac{x}{y}\\

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


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

    1. Initial program 91.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 81.9%

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

    if -2.1999999999999999e40 < (/.f64 x y) < 2.00000000000000009e42

    1. Initial program 88.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 z around inf 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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) \]
      19. associate-*r/99.9%

        \[\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) \]
    5. Simplified99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 90.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2.2 \cdot 10^{+40}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{z \cdot t}\\

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

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


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

    1. Initial program 94.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 z around 0 94.5%

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

    if -2.1999999999999999e40 < (/.f64 x y) < 2.00000000000000009e42

    1. Initial program 88.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 z around inf 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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) \]
      19. associate-*r/99.9%

        \[\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) \]
    5. Simplified99.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.00000000000000009e42 < (/.f64 x y)

    1. Initial program 87.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 z around inf 94.0%

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \frac{1 - t}{t}} \]
    4. Step-by-step derivation
      1. div-sub94.0%

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

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

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

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

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

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

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

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

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

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

Alternative 7: 98.4% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 80.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 z around inf 99.1%

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \frac{1 - t}{t}} \]
    4. Step-by-step derivation
      1. div-sub99.1%

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

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

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

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

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

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

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

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

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

    if -1 < z < 1.2499999999999999e-8

    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 z around inf 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} + \color{blue}{\left(-2 + \left(2 \cdot \frac{1}{t} + \frac{2}{t \cdot z}\right)\right)} \]
      15. 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) \]
      16. 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) \]
      17. 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) \]
      18. *-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) \]
      19. 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) \]
    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 99.5%

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

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

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

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

Alternative 8: 71.1% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 90.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 75.0%

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

    if -8.4999999999999996e-10 < (/.f64 x y) < 0.047

    1. Initial program 88.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 z around inf 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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) \]
      19. associate-*r/99.9%

        \[\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) \]
    5. Simplified99.9%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{2}}{t \cdot z} + -2 \]
      5. associate-/l/75.9%

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

        \[\leadsto \color{blue}{-2 + \frac{\frac{2}{z}}{t}} \]
      7. associate-/l/75.9%

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

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

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

Alternative 9: 64.4% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2.05 \cdot 10^{+40} \lor \neg \left(\frac{x}{y} \leq 26000000\right):\\
\;\;\;\;\frac{x}{y}\\

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


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

    1. Initial program 91.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 77.3%

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

    if -2.0500000000000001e40 < (/.f64 x y) < 2.6e7

    1. Initial program 88.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 z around inf 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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) \]
      19. associate-*r/99.9%

        \[\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) \]
    5. Simplified99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-2 + \frac{2}{t}} \]
    11. Simplified67.2%

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

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

Alternative 10: 64.5% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 94.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 79.6%

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

    if -2.0500000000000001e40 < (/.f64 x y) < 3.05e7

    1. Initial program 88.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 z around inf 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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) \]
      19. associate-*r/99.9%

        \[\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) \]
    5. Simplified99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-2 + \frac{2}{t}} \]
    11. Simplified67.2%

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

    if 3.05e7 < (/.f64 x y)

    1. Initial program 88.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 inf 76.2%

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

Alternative 11: 52.0% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 90.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 x around inf 75.0%

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

    if -2 < (/.f64 x y) < 2.4e7

    1. Initial program 88.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 z around inf 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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) \]
      19. associate-*r/99.9%

        \[\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) \]
    5. Simplified99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 36.9% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;t \leq 2.4 \cdot 10^{-18}:\\
\;\;\;\;\frac{2}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -500 or 2.39999999999999994e-18 < t

    1. Initial program 82.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 z around inf 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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) \]
      19. associate-*r/99.9%

        \[\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) \]
    5. Simplified99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -500 < t < 2.39999999999999994e-18

    1. Initial program 98.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 z around inf 66.2%

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \frac{1 - t}{t}} \]
    4. Step-by-step derivation
      1. div-sub66.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{2}{t}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 13: 19.8% 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 89.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 z around inf 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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) \]
    19. associate-*r/99.9%

      \[\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) \]
  5. Simplified99.9%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-2} \]
  10. Add Preprocessing

Developer target: 99.1% 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 2024086 
(FPCore (x y z t)
  :name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
  :precision binary64

  :alt
  (- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y)))

  (+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))