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

Percentage Accurate: 86.6% → 99.1%
Time: 10.8s
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.6% 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.1× speedup?

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

\\
\frac{x}{y} + \left(-2 + \frac{1}{t} \cdot \left(2 + \frac{2}{z}\right)\right)
\end{array}
Derivation
  1. Initial program 83.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 98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 80.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} - 2\\ \mathbf{if}\;t \leq -6.3:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 4 \cdot 10^{-18}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{elif}\;t \leq 1.75 \cdot 10^{+25} \lor \neg \left(t \leq 1.6 \cdot 10^{+61}\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;-2 - \frac{\frac{-2}{z}}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (/ x y) 2.0)))
   (if (<= t -6.3)
     t_1
     (if (<= t 4e-18)
       (/ (+ 2.0 (/ 2.0 z)) t)
       (if (or (<= t 1.75e+25) (not (<= t 1.6e+61)))
         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 <= -6.3) {
		tmp = t_1;
	} else if (t <= 4e-18) {
		tmp = (2.0 + (2.0 / z)) / t;
	} else if ((t <= 1.75e+25) || !(t <= 1.6e+61)) {
		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 <= (-6.3d0)) then
        tmp = t_1
    else if (t <= 4d-18) then
        tmp = (2.0d0 + (2.0d0 / z)) / t
    else if ((t <= 1.75d+25) .or. (.not. (t <= 1.6d+61))) 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 <= -6.3) {
		tmp = t_1;
	} else if (t <= 4e-18) {
		tmp = (2.0 + (2.0 / z)) / t;
	} else if ((t <= 1.75e+25) || !(t <= 1.6e+61)) {
		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 <= -6.3:
		tmp = t_1
	elif t <= 4e-18:
		tmp = (2.0 + (2.0 / z)) / t
	elif (t <= 1.75e+25) or not (t <= 1.6e+61):
		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 <= -6.3)
		tmp = t_1;
	elseif (t <= 4e-18)
		tmp = Float64(Float64(2.0 + Float64(2.0 / z)) / t);
	elseif ((t <= 1.75e+25) || !(t <= 1.6e+61))
		tmp = t_1;
	else
		tmp = Float64(-2.0 - Float64(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 <= -6.3)
		tmp = t_1;
	elseif (t <= 4e-18)
		tmp = (2.0 + (2.0 / z)) / t;
	elseif ((t <= 1.75e+25) || ~((t <= 1.6e+61)))
		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, -6.3], t$95$1, If[LessEqual[t, 4e-18], N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[Or[LessEqual[t, 1.75e+25], N[Not[LessEqual[t, 1.6e+61]], $MachinePrecision]], t$95$1, N[(-2.0 - N[(N[(-2.0 / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;t \leq 1.75 \cdot 10^{+25} \lor \neg \left(t \leq 1.6 \cdot 10^{+61}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -6.29999999999999982 or 4.0000000000000003e-18 < t < 1.75e25 or 1.5999999999999999e61 < t

    1. Initial program 69.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 85.1%

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

    if -6.29999999999999982 < t < 4.0000000000000003e-18

    1. Initial program 97.4%

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

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

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

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

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

    if 1.75e25 < t < 1.5999999999999999e61

    1. Initial program 85.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.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{\left(-2 + \frac{1}{t} \cdot \left(2 + \frac{2}{z}\right)\right)} \]
    6. Taylor expanded in x around 0 99.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. associate--l+99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-2 + \frac{2 + \frac{2}{z}}{t}} \]
      19. remove-double-neg99.8%

        \[\leadsto -2 + \frac{2 + \frac{2}{z}}{\color{blue}{-\left(-t\right)}} \]
      20. distribute-neg-frac299.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -6.3:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;t \leq 4 \cdot 10^{-18}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{elif}\;t \leq 1.75 \cdot 10^{+25} \lor \neg \left(t \leq 1.6 \cdot 10^{+61}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;-2 - \frac{\frac{-2}{z}}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 63.9% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;z \leq -6.2 \cdot 10^{-72}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 10500 \lor \neg \left(z \leq 1.25 \cdot 10^{+36}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.1999999999999996e-72 or 1.9e-92 < z < 10500 or 1.24999999999999994e36 < z

    1. Initial program 73.3%

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

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

    if -6.1999999999999996e-72 < z < 1.9e-92

    1. Initial program 97.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 97.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. +-commutative97.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/97.8%

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

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

        \[\leadsto \frac{x}{y} + \left(\frac{2}{\color{blue}{z \cdot t}} + 2 \cdot \frac{1 - t}{t}\right) \]
      5. div-sub97.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-neg97.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. *-inverses97.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-eval97.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-in97.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-eval97.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+97.8%

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

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

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

        \[\leadsto \frac{x}{y} + \left(-2 + \left(2 \cdot \frac{1}{t} + \color{blue}{\frac{\frac{2}{z}}{t}}\right)\right) \]
      16. metadata-eval97.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/97.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-identity97.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) \]
    5. Simplified97.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 71.1%

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

    if 10500 < z < 1.24999999999999994e36

    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 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{\left(-2 + \frac{1}{t} \cdot \left(2 + \frac{2}{z}\right)\right)} \]
    6. Taylor expanded in x around 0 100.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. associate--l+100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-2 + \frac{2 + \frac{2}{z}}{t}} \]
      19. remove-double-neg100.0%

        \[\leadsto -2 + \frac{2 + \frac{2}{z}}{\color{blue}{-\left(-t\right)}} \]
      20. distribute-neg-frac2100.0%

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

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

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

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

Alternative 4: 64.4% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;z \leq -5.4 \cdot 10^{-72}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 17000000000 \lor \neg \left(z \leq 6.4 \cdot 10^{+38}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.4e-72 or 7.1999999999999995e-113 < z < 1.7e10 or 6.3999999999999997e38 < z

    1. Initial program 74.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 70.1%

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

    if -5.4e-72 < z < 7.1999999999999995e-113

    1. Initial program 97.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 97.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. +-commutative97.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/97.8%

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

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

        \[\leadsto \frac{x}{y} + \left(\frac{2}{\color{blue}{z \cdot t}} + 2 \cdot \frac{1 - t}{t}\right) \]
      5. div-sub97.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-neg97.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. *-inverses97.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-eval97.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-in97.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-eval97.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+97.8%

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

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

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

        \[\leadsto \frac{x}{y} + \left(-2 + \left(2 \cdot \frac{1}{t} + \color{blue}{\frac{\frac{2}{z}}{t}}\right)\right) \]
      16. metadata-eval97.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/97.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-identity97.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) \]
    5. Simplified97.7%

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

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

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

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

    if 1.7e10 < z < 6.3999999999999997e38

    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 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{\left(-2 + \frac{1}{t} \cdot \left(2 + \frac{2}{z}\right)\right)} \]
    6. Taylor expanded in x around 0 100.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. associate--l+100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-2 + \frac{2 + \frac{2}{z}}{t}} \]
      19. remove-double-neg100.0%

        \[\leadsto -2 + \frac{2 + \frac{2}{z}}{\color{blue}{-\left(-t\right)}} \]
      20. distribute-neg-frac2100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.4 \cdot 10^{-72}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-113}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;z \leq 17000000000 \lor \neg \left(z \leq 6.4 \cdot 10^{+38}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;-2 - \frac{-2}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 92.4% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -9.5e5 or 3.8999999999999999e27 < (/.f64 x y)

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

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

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

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

    if -9.5e5 < (/.f64 x y) < 3.8999999999999999e27

    1. Initial program 82.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.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) \]
    5. Simplified99.8%

      \[\leadsto \frac{x}{y} + \color{blue}{\left(-2 + \frac{1}{t} \cdot \left(2 + \frac{2}{z}\right)\right)} \]
    6. Taylor expanded in x around 0 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. associate--l+98.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{t} + \left(\color{blue}{\frac{\frac{2}{z}}{t}} + \left(-2\right)\right) \]
      9. *-rgt-identity98.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-2 + \frac{2 + \frac{2}{z}}{t}} \]
      19. remove-double-neg98.0%

        \[\leadsto -2 + \frac{2 + \frac{2}{z}}{\color{blue}{-\left(-t\right)}} \]
      20. distribute-neg-frac298.0%

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

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

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

Alternative 6: 71.0% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -3.3 \cdot 10^{+36} \lor \neg \left(\frac{x}{y} \leq 3.7 \cdot 10^{+56}\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;-2 - \frac{\frac{-2}{z}}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= (/ x y) -3.3e+36) (not (<= (/ x y) 3.7e+56)))
   (/ x y)
   (- -2.0 (/ (/ -2.0 z) t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x / y) <= -3.3e+36) || !((x / y) <= 3.7e+56)) {
		tmp = x / y;
	} 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) <= (-3.3d+36)) .or. (.not. ((x / y) <= 3.7d+56))) then
        tmp = x / y
    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) <= -3.3e+36) || !((x / y) <= 3.7e+56)) {
		tmp = x / y;
	} else {
		tmp = -2.0 - ((-2.0 / z) / t);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x / y) <= -3.3e+36) or not ((x / y) <= 3.7e+56):
		tmp = x / y
	else:
		tmp = -2.0 - ((-2.0 / z) / t)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((Float64(x / y) <= -3.3e+36) || !(Float64(x / y) <= 3.7e+56))
		tmp = Float64(x / y);
	else
		tmp = Float64(-2.0 - Float64(Float64(-2.0 / z) / t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (((x / y) <= -3.3e+36) || ~(((x / y) <= 3.7e+56)))
		tmp = x / y;
	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], -3.3e+36], N[Not[LessEqual[N[(x / y), $MachinePrecision], 3.7e+56]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(-2.0 - N[(N[(-2.0 / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -3.3 \cdot 10^{+36} \lor \neg \left(\frac{x}{y} \leq 3.7 \cdot 10^{+56}\right):\\
\;\;\;\;\frac{x}{y}\\

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


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

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

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

    if -3.2999999999999999e36 < (/.f64 x y) < 3.69999999999999997e56

    1. Initial program 83.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.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.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) \]
    5. Simplified99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-2 + \frac{2 + \frac{2}{z}}{t}} \]
      19. remove-double-neg96.1%

        \[\leadsto -2 + \frac{2 + \frac{2}{z}}{\color{blue}{-\left(-t\right)}} \]
      20. distribute-neg-frac296.1%

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

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

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

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

Alternative 7: 64.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -350000000 \lor \neg \left(\frac{x}{y} \leq 4.2 \cdot 10^{+27}\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) -350000000.0) (not (<= (/ x y) 4.2e+27)))
   (/ x y)
   (- -2.0 (/ -2.0 t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x / y) <= -350000000.0) || !((x / y) <= 4.2e+27)) {
		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) <= (-350000000.0d0)) .or. (.not. ((x / y) <= 4.2d+27))) 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) <= -350000000.0) || !((x / y) <= 4.2e+27)) {
		tmp = x / y;
	} else {
		tmp = -2.0 - (-2.0 / t);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x / y) <= -350000000.0) or not ((x / y) <= 4.2e+27):
		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) <= -350000000.0) || !(Float64(x / y) <= 4.2e+27))
		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) <= -350000000.0) || ~(((x / y) <= 4.2e+27)))
		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], -350000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4.2e+27]], $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 -350000000 \lor \neg \left(\frac{x}{y} \leq 4.2 \cdot 10^{+27}\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) < -3.5e8 or 4.19999999999999989e27 < (/.f64 x y)

    1. Initial program 85.4%

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

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

    if -3.5e8 < (/.f64 x y) < 4.19999999999999989e27

    1. Initial program 82.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.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) \]
    5. Simplified99.8%

      \[\leadsto \frac{x}{y} + \color{blue}{\left(-2 + \frac{1}{t} \cdot \left(2 + \frac{2}{z}\right)\right)} \]
    6. Taylor expanded in x around 0 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. associate--l+98.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{t} + \left(\color{blue}{\frac{\frac{2}{z}}{t}} + \left(-2\right)\right) \]
      9. *-rgt-identity98.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-2 + \frac{2 + \frac{2}{z}}{t}} \]
      19. remove-double-neg98.0%

        \[\leadsto -2 + \frac{2 + \frac{2}{z}}{\color{blue}{-\left(-t\right)}} \]
      20. distribute-neg-frac298.0%

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

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

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

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

Alternative 8: 65.2% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 85.9%

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

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

    if -3500 < (/.f64 x y) < 0.25

    1. Initial program 81.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) \]
    5. Simplified99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-2 + \frac{2 + \frac{2}{z}}{t}} \]
      19. remove-double-neg98.7%

        \[\leadsto -2 + \frac{2 + \frac{2}{z}}{\color{blue}{-\left(-t\right)}} \]
      20. distribute-neg-frac298.7%

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

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

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

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

Alternative 9: 85.0% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.50000000000000023e-29 or 9.20000000000000002e-62 < z

    1. Initial program 72.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 97.6%

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

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

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

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

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

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

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

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

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

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

    if -9.50000000000000023e-29 < z < 9.20000000000000002e-62

    1. Initial program 97.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 97.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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/97.3%

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

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

      \[\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 75.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. associate--l+75.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-2 + \frac{2 + \frac{2}{z}}{t}} \]
      19. remove-double-neg75.9%

        \[\leadsto -2 + \frac{2 + \frac{2}{z}}{\color{blue}{-\left(-t\right)}} \]
      20. distribute-neg-frac275.9%

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

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

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

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

Alternative 10: 91.1% accurate, 0.9× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

    if -4.0999999999999996 < z < 9.6000000000000004e-61

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

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

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

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

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

Alternative 11: 46.8% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -9.5e5 or 4.19999999999999989e27 < (/.f64 x y)

    1. Initial program 85.4%

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

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

    if -9.5e5 < (/.f64 x y) < 4.19999999999999989e27

    1. Initial program 82.3%

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

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

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

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

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

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

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

Alternative 12: 99.1% accurate, 1.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 19.2% accurate, 5.7× speedup?

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

\\
\frac{2}{t}
\end{array}
Derivation
  1. Initial program 83.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 48.2%

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

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

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

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

    \[\leadsto \frac{\color{blue}{2}}{t} \]
  7. Final simplification17.4%

    \[\leadsto \frac{2}{t} \]
  8. 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 2024055 
(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))))