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

Percentage Accurate: 86.8% → 98.4%
Time: 11.1s
Alternatives: 16
Speedup: 0.9×

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 16 alternatives:

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

Initial Program: 86.8% accurate, 1.0× speedup?

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

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

Alternative 1: 98.4% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < 4.9999999999999998e297

    1. Initial program 98.9%

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

    if 4.9999999999999998e297 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z))

    1. Initial program 20.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 0 27.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{2 + \left(1 - t\right) \cdot \left(2 \cdot z\right)}{z \cdot t} + \frac{x}{y}\\ \mathbf{if}\;t\_1 \leq \infty:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ (/ (+ 2.0 (* (- 1.0 t) (* 2.0 z))) (* z t)) (/ x y))))
   (if (<= t_1 INFINITY) t_1 (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
	double t_1 = ((2.0 + ((1.0 - t) * (2.0 * z))) / (z * t)) + (x / y);
	double tmp;
	if (t_1 <= ((double) INFINITY)) {
		tmp = t_1;
	} else {
		tmp = (x / y) - 2.0;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = ((2.0 + ((1.0 - t) * (2.0 * z))) / (z * t)) + (x / y);
	double tmp;
	if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else {
		tmp = (x / y) - 2.0;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = ((2.0 + ((1.0 - t) * (2.0 * z))) / (z * t)) + (x / y)
	tmp = 0
	if t_1 <= math.inf:
		tmp = t_1
	else:
		tmp = (x / y) - 2.0
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(Float64(2.0 + Float64(Float64(1.0 - t) * Float64(2.0 * z))) / Float64(z * t)) + Float64(x / y))
	tmp = 0.0
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = Float64(Float64(x / y) - 2.0);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = ((2.0 + ((1.0 - t) * (2.0 * z))) / (z * t)) + (x / y);
	tmp = 0.0;
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = (x / y) - 2.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(2.0 + N[(N[(1.0 - t), $MachinePrecision] * N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (/.f64 x y) (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z))) < +inf.0

    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

    if +inf.0 < (+.f64 (/.f64 x y) (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)))

    1. Initial program 0.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 94.1%

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

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

Alternative 3: 66.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} - 2\\ \mathbf{if}\;z \leq -5 \cdot 10^{+121}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -9.8 \cdot 10^{+23}:\\ \;\;\;\;\frac{2}{t} + -2\\ \mathbf{elif}\;z \leq -4.1 \cdot 10^{-134} \lor \neg \left(z \leq 116\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{z \cdot t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (/ x y) 2.0)))
   (if (<= z -5e+121)
     t_1
     (if (<= z -9.8e+23)
       (+ (/ 2.0 t) -2.0)
       (if (or (<= z -4.1e-134) (not (<= z 116.0)))
         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 (z <= -5e+121) {
		tmp = t_1;
	} else if (z <= -9.8e+23) {
		tmp = (2.0 / t) + -2.0;
	} else if ((z <= -4.1e-134) || !(z <= 116.0)) {
		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 (z <= (-5d+121)) then
        tmp = t_1
    else if (z <= (-9.8d+23)) then
        tmp = (2.0d0 / t) + (-2.0d0)
    else if ((z <= (-4.1d-134)) .or. (.not. (z <= 116.0d0))) 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 (z <= -5e+121) {
		tmp = t_1;
	} else if (z <= -9.8e+23) {
		tmp = (2.0 / t) + -2.0;
	} else if ((z <= -4.1e-134) || !(z <= 116.0)) {
		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 z <= -5e+121:
		tmp = t_1
	elif z <= -9.8e+23:
		tmp = (2.0 / t) + -2.0
	elif (z <= -4.1e-134) or not (z <= 116.0):
		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 (z <= -5e+121)
		tmp = t_1;
	elseif (z <= -9.8e+23)
		tmp = Float64(Float64(2.0 / t) + -2.0);
	elseif ((z <= -4.1e-134) || !(z <= 116.0))
		tmp = t_1;
	else
		tmp = Float64(-2.0 + Float64(2.0 / Float64(z * t)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x / y) - 2.0;
	tmp = 0.0;
	if (z <= -5e+121)
		tmp = t_1;
	elseif (z <= -9.8e+23)
		tmp = (2.0 / t) + -2.0;
	elseif ((z <= -4.1e-134) || ~((z <= 116.0)))
		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[z, -5e+121], t$95$1, If[LessEqual[z, -9.8e+23], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision], If[Or[LessEqual[z, -4.1e-134], N[Not[LessEqual[z, 116.0]], $MachinePrecision]], t$95$1, N[(-2.0 + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq -4.1 \cdot 10^{-134} \lor \neg \left(z \leq 116\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.00000000000000007e121 or -9.8000000000000006e23 < z < -4.1000000000000002e-134 or 116 < z

    1. Initial program 77.7%

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

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

    if -5.00000000000000007e121 < z < -9.8000000000000006e23

    1. Initial program 87.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}{2 \cdot \frac{1 - t}{t}} \]
    4. Step-by-step derivation
      1. div-sub100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.1000000000000002e-134 < z < 116

    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 t around inf 97.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 62.5% accurate, 0.7× speedup?

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

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

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

\mathbf{elif}\;z \leq -1.05 \cdot 10^{-134} \lor \neg \left(z \leq 116\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.00000000000000007e121 or -8.00000000000000038e26 < z < -1.05e-134 or 116 < z

    1. Initial program 77.7%

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

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

    if -5.00000000000000007e121 < z < -8.00000000000000038e26

    1. Initial program 87.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}{2 \cdot \frac{1 - t}{t}} \]
    4. Step-by-step derivation
      1. div-sub100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.05e-134 < z < 116

    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 t around inf 97.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.1% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.9999999999999998e81 or 5.00000000000000046e55 < t

    1. Initial program 67.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 67.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999998e81 < t < 5.00000000000000046e55

    1. Initial program 98.5%

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

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

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

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

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

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

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

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

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

Alternative 6: 48.4% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;\frac{x}{y} \leq 2.3 \cdot 10^{-127}:\\
\;\;\;\;\frac{2}{t}\\

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

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


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

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

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

    if -1.46e22 < (/.f64 x y) < 2.30000000000000019e-127

    1. Initial program 89.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 inf 59.2%

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

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

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

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

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

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

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

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

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

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

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

    if 2.30000000000000019e-127 < (/.f64 x y) < 1.79999999999999991e-8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1.46 \cdot 10^{+22}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 2.3 \cdot 10^{-127}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 1.8 \cdot 10^{-8}:\\ \;\;\;\;-2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 98.2% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 73.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.36e14 < t < 2.0000000000000001e-4

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

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

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

Alternative 8: 97.8% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 75.2%

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

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

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

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

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

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

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

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

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

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

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

    if -1.6e22 < z < 1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 64.7% accurate, 0.9× speedup?

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

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

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


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

    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 x around inf 70.7%

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

    if -3.65e19 < (/.f64 x y) < 14000

    1. Initial program 90.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 84.6% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.79999999999999961e-132 or 6.39999999999999964e-28 < z

    1. Initial program 79.5%

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

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

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

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

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

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

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

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

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

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

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

    if -9.79999999999999961e-132 < z < 6.39999999999999964e-28

    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 t around inf 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-2 + \frac{2}{z \cdot t}} \]
      7. *-commutative77.7%

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

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

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

Alternative 11: 92.0% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.04999999999999995e-29 or 8.99999999999999953e-9 < z

    1. Initial program 77.2%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 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 -1.04999999999999995e-29 < z < 8.99999999999999953e-9

    1. Initial program 98.1%

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

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

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

Alternative 12: 91.9% accurate, 0.9× speedup?

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

    1. Initial program 77.2%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 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.19999999999999937e-30 < z < 1.29999999999999992e-5

    1. Initial program 98.1%

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

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{2}{t \cdot z}} \]
    4. Taylor expanded in x around 0 89.5%

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

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

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

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

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

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

Alternative 13: 64.9% accurate, 0.9× speedup?

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

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

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

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


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

    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 x around inf 71.4%

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

    if -6.3e19 < (/.f64 x y) < 0.0145000000000000007

    1. Initial program 90.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.0145000000000000007 < (/.f64 x y)

    1. Initial program 84.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -6.3 \cdot 10^{+19}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 0.0145:\\ \;\;\;\;\frac{2}{t} + -2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 79.9% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -6.2e11 or 8.00000000000000006e-50 < t

    1. Initial program 76.6%

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

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

    if -6.2e11 < t < 8.00000000000000006e-50

    1. Initial program 98.1%

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

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

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

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

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

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

Alternative 15: 36.1% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;t \leq 3.8 \cdot 10^{-24}:\\
\;\;\;\;\frac{2}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.6999999999999999e-9 or 3.80000000000000026e-24 < t

    1. Initial program 75.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.6999999999999999e-9 < t < 3.80000000000000026e-24

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 19.4% accurate, 17.0× speedup?

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

\\
-2
\end{array}
Derivation
  1. Initial program 86.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-2} \]
  10. Final simplification16.1%

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

Developer target: 99.0% 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 2024130 
(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))))