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

Percentage Accurate: 86.2% → 99.4%
Time: 12.5s
Alternatives: 13
Speedup: 0.6×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 86.2% accurate, 1.0× speedup?

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

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

Alternative 1: 99.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} + \frac{2 + \left(1 - t\right) \cdot \left(2 \cdot z\right)}{z \cdot t}\\ \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 (+ (/ x y) (/ (+ 2.0 (* (- 1.0 t) (* 2.0 z))) (* z t)))))
   (if (<= t_1 INFINITY) t_1 (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / y) + ((2.0 + ((1.0 - t) * (2.0 * z))) / (z * t));
	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 = (x / y) + ((2.0 + ((1.0 - t) * (2.0 * z))) / (z * t));
	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 = (x / y) + ((2.0 + ((1.0 - t) * (2.0 * z))) / (z * t))
	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(x / y) + Float64(Float64(2.0 + Float64(Float64(1.0 - t) * Float64(2.0 * z))) / Float64(z * t)))
	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 = (x / y) + ((2.0 + ((1.0 - t) * (2.0 * z))) / (z * t));
	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[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(1.0 - t), $MachinePrecision] * N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * t), $MachinePrecision]), $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{x}{y} + \frac{2 + \left(1 - t\right) \cdot \left(2 \cdot z\right)}{z \cdot t}\\
\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.9%

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

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

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

Alternative 2: 98.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+85} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+42}\right):\\ \;\;\;\;\frac{x}{y} + \frac{2 + 2 \cdot z}{z \cdot t}\\ \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 (<= (/ x y) -1e+85) (not (<= (/ x y) 2e+42)))
   (+ (/ x y) (/ (+ 2.0 (* 2.0 z)) (* 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 (((x / y) <= -1e+85) || !((x / y) <= 2e+42)) {
		tmp = (x / y) + ((2.0 + (2.0 * z)) / (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 (((x / y) <= (-1d+85)) .or. (.not. ((x / y) <= 2d+42))) then
        tmp = (x / y) + ((2.0d0 + (2.0d0 * z)) / (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 (((x / y) <= -1e+85) || !((x / y) <= 2e+42)) {
		tmp = (x / y) + ((2.0 + (2.0 * z)) / (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 ((x / y) <= -1e+85) or not ((x / y) <= 2e+42):
		tmp = (x / y) + ((2.0 + (2.0 * z)) / (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 ((Float64(x / y) <= -1e+85) || !(Float64(x / y) <= 2e+42))
		tmp = Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(2.0 * z)) / Float64(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 (((x / y) <= -1e+85) || ~(((x / y) <= 2e+42)))
		tmp = (x / y) + ((2.0 + (2.0 * z)) / (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[N[(x / y), $MachinePrecision], -1e+85], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e+42]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(2.0 * z), $MachinePrecision]), $MachinePrecision] / N[(z * 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}\;\frac{x}{y} \leq -1 \cdot 10^{+85} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+42}\right):\\
\;\;\;\;\frac{x}{y} + \frac{2 + 2 \cdot z}{z \cdot t}\\

\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 (/.f64 x y) < -1e85 or 2.00000000000000009e42 < (/.f64 x y)

    1. Initial program 84.2%

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

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

    if -1e85 < (/.f64 x y) < 2.00000000000000009e42

    1. Initial program 82.5%

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

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

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

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

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

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

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

      \[\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}\;\frac{x}{y} \leq -1 \cdot 10^{+85} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+42}\right):\\ \;\;\;\;\frac{x}{y} + \frac{2 + 2 \cdot z}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(2 + \frac{2}{z}\right) + t \cdot \left(\frac{x}{y} + -2\right)}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 97.8% accurate, 0.6× speedup?

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

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

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


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

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

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

    if -4e8 < (/.f64 x y) < 1e7

    1. Initial program 80.4%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 85.4% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.8999999999999998e-97 or 7.19999999999999965e-16 < z

    1. Initial program 70.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.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.8999999999999998e-97 < z < 7.19999999999999965e-16

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 66.5% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -8.5e6 or 1.89999999999999998e-12 < (/.f64 x y)

    1. Initial program 85.2%

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

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

    if -8.5e6 < (/.f64 x y) < 1.89999999999999998e-12

    1. Initial program 81.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 66.2% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -6.2e6 or 2.7e8 < (/.f64 x y)

    1. Initial program 85.8%

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

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

    if -6.2e6 < (/.f64 x y) < 2.7e8

    1. Initial program 80.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 65.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 85.3% accurate, 0.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.8000000000000001e-97

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

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

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

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

    if -3.8000000000000001e-97 < z < 7.3999999999999999e-16

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.3999999999999999e-16 < z

    1. Initial program 65.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 77.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -8.5 \cdot 10^{-90} \lor \neg \left(t \leq 1.75 \cdot 10^{+44}\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 -8.5e-90) (not (<= t 1.75e+44)))
   (- (/ x y) 2.0)
   (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -8.5e-90) || !(t <= 1.75e+44)) {
		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 <= (-8.5d-90)) .or. (.not. (t <= 1.75d+44))) 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 <= -8.5e-90) || !(t <= 1.75e+44)) {
		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 <= -8.5e-90) or not (t <= 1.75e+44):
		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 <= -8.5e-90) || !(t <= 1.75e+44))
		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 <= -8.5e-90) || ~((t <= 1.75e+44)))
		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, -8.5e-90], N[Not[LessEqual[t, 1.75e+44]], $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 -8.5 \cdot 10^{-90} \lor \neg \left(t \leq 1.75 \cdot 10^{+44}\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 < -8.5000000000000001e-90 or 1.75e44 < t

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

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

    if -8.5000000000000001e-90 < t < 1.75e44

    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 0 82.9%

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

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

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

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

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

Alternative 9: 68.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{-97} \lor \neg \left(z \leq 2.55 \cdot 10^{-15}\right):\\
\;\;\;\;\frac{x}{y} - 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.8999999999999998e-97 or 2.55e-15 < z

    1. Initial program 70.5%

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

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

    if -3.8999999999999998e-97 < z < 2.55e-15

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 53.7% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 85.9%

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

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

    if -2 < (/.f64 x y) < 1.7e8

    1. Initial program 80.6%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 65.1% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{-129} \lor \neg \left(z \leq 2.4 \cdot 10^{-98}\right):\\
\;\;\;\;\frac{x}{y} - 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.3500000000000001e-129 or 2.40000000000000005e-98 < z

    1. Initial program 75.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 74.6%

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

    if -2.3500000000000001e-129 < z < 2.40000000000000005e-98

    1. Initial program 98.7%

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

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

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

Alternative 12: 37.0% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 71.0%

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

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

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

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

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

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

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

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

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

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

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

    if -1 < t < 1

    1. Initial program 98.9%

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

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

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

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

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

Alternative 13: 20.5% 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 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 t around 0 91.0%

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

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

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

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

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

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

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

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

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

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

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

  :alt
  (! :herbie-platform default (- (/ (+ (/ 2 z) 2) t) (- 2 (/ x y))))

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