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

Percentage Accurate: 86.9% → 99.1%
Time: 14.9s
Alternatives: 13
Speedup: 1.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 86.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.1% accurate, 1.0× speedup?

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

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

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

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

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

Alternative 2: 77.9% accurate, 0.6× speedup?

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

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

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

\mathbf{elif}\;t \leq -1.7 \cdot 10^{+25} \lor \neg \left(t \leq 3.2 \cdot 10^{-20}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -7.7999999999999999e97 or -2.1999999999999999e35 < t < -1.69999999999999992e25 or 3.1999999999999997e-20 < t

    1. Initial program 68.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 84.4%

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

    if -7.7999999999999999e97 < t < -2.1999999999999999e35

    1. Initial program 99.7%

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

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

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

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

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

    if -1.69999999999999992e25 < t < 3.1999999999999997e-20

    1. Initial program 96.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 76.0%

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

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

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

      \[\leadsto \color{blue}{\frac{2 + \frac{2}{z}}{t}} \]
    6. Step-by-step derivation
      1. div-inv76.0%

        \[\leadsto \color{blue}{\left(2 + \frac{2}{z}\right) \cdot \frac{1}{t}} \]
    7. Applied egg-rr76.0%

      \[\leadsto \color{blue}{\left(2 + \frac{2}{z}\right) \cdot \frac{1}{t}} \]
    8. Taylor expanded in z around 0 76.0%

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

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

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

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

        \[\leadsto \frac{2}{t} + \frac{\color{blue}{2}}{t \cdot z} \]
    10. Simplified76.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -7.8 \cdot 10^{+97}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;t \leq -2.2 \cdot 10^{+35}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{elif}\;t \leq -1.7 \cdot 10^{+25} \lor \neg \left(t \leq 3.2 \cdot 10^{-20}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t \cdot z} + \frac{2}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 77.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -7.8 \cdot 10^{+97} \lor \neg \left(t \leq -2 \cdot 10^{+35} \lor \neg \left(t \leq -6.5 \cdot 10^{+25}\right) \land t \leq 7.4 \cdot 10^{-19}\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 -7.8e+97)
         (not (or (<= t -2e+35) (and (not (<= t -6.5e+25)) (<= t 7.4e-19)))))
   (- (/ x y) 2.0)
   (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -7.8e+97) || !((t <= -2e+35) || (!(t <= -6.5e+25) && (t <= 7.4e-19)))) {
		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 <= (-7.8d+97)) .or. (.not. (t <= (-2d+35)) .or. (.not. (t <= (-6.5d+25))) .and. (t <= 7.4d-19))) 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 <= -7.8e+97) || !((t <= -2e+35) || (!(t <= -6.5e+25) && (t <= 7.4e-19)))) {
		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 <= -7.8e+97) or not ((t <= -2e+35) or (not (t <= -6.5e+25) and (t <= 7.4e-19))):
		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 <= -7.8e+97) || !((t <= -2e+35) || (!(t <= -6.5e+25) && (t <= 7.4e-19))))
		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 <= -7.8e+97) || ~(((t <= -2e+35) || (~((t <= -6.5e+25)) && (t <= 7.4e-19)))))
		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, -7.8e+97], N[Not[Or[LessEqual[t, -2e+35], And[N[Not[LessEqual[t, -6.5e+25]], $MachinePrecision], LessEqual[t, 7.4e-19]]]], $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 -7.8 \cdot 10^{+97} \lor \neg \left(t \leq -2 \cdot 10^{+35} \lor \neg \left(t \leq -6.5 \cdot 10^{+25}\right) \land t \leq 7.4 \cdot 10^{-19}\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 < -7.7999999999999999e97 or -1.9999999999999999e35 < t < -6.50000000000000005e25 or 7.40000000000000011e-19 < t

    1. Initial program 68.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 84.4%

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

    if -7.7999999999999999e97 < t < -1.9999999999999999e35 or -6.50000000000000005e25 < t < 7.40000000000000011e-19

    1. Initial program 96.8%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -7.8 \cdot 10^{+97} \lor \neg \left(t \leq -2 \cdot 10^{+35} \lor \neg \left(t \leq -6.5 \cdot 10^{+25}\right) \land t \leq 7.4 \cdot 10^{-19}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 92.7% accurate, 0.7× speedup?

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

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

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


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

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

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

    if -2e19 < (/.f64 x y) < 2e6

    1. Initial program 83.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 92.7% accurate, 0.7× speedup?

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

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

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


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

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

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

    if -2e19 < (/.f64 x y) < 2e6

    1. Initial program 83.9%

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

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

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

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

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

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

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

Alternative 6: 64.5% accurate, 0.9× speedup?

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

    1. Initial program 82.1%

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

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

    if -58000 < (/.f64 x y) < 9.5e20

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 64.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -0.11 \lor \neg \left(\frac{x}{y} \leq 9.2 \cdot 10^{+20}\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) -0.11) (not (<= (/ x y) 9.2e+20)))
   (- (/ x y) 2.0)
   (+ -2.0 (/ 2.0 t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x / y) <= -0.11) || !((x / y) <= 9.2e+20)) {
		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) <= (-0.11d0)) .or. (.not. ((x / y) <= 9.2d+20))) 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) <= -0.11) || !((x / y) <= 9.2e+20)) {
		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) <= -0.11) or not ((x / y) <= 9.2e+20):
		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) <= -0.11) || !(Float64(x / y) <= 9.2e+20))
		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) <= -0.11) || ~(((x / y) <= 9.2e+20)))
		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], -0.11], N[Not[LessEqual[N[(x / y), $MachinePrecision], 9.2e+20]], $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 -0.11 \lor \neg \left(\frac{x}{y} \leq 9.2 \cdot 10^{+20}\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) < -0.110000000000000001 or 9.2e20 < (/.f64 x y)

    1. Initial program 81.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 70.5%

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

    if -0.110000000000000001 < (/.f64 x y) < 9.2e20

    1. Initial program 86.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 79.8% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.7500000000000001e-189 or 8.6000000000000004e-38 < z

    1. Initial program 76.1%

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

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

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

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

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

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

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

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

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

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

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

    if -1.7500000000000001e-189 < z < 8.6000000000000004e-38

    1. Initial program 96.7%

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

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

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

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

      \[\leadsto \color{blue}{\frac{2 + \frac{2}{z}}{t}} \]
    6. Step-by-step derivation
      1. div-inv69.6%

        \[\leadsto \color{blue}{\left(2 + \frac{2}{z}\right) \cdot \frac{1}{t}} \]
    7. Applied egg-rr69.6%

      \[\leadsto \color{blue}{\left(2 + \frac{2}{z}\right) \cdot \frac{1}{t}} \]
    8. Taylor expanded in z around 0 69.6%

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

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

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

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

        \[\leadsto \frac{2}{t} + \frac{\color{blue}{2}}{t \cdot z} \]
    10. Simplified69.6%

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

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

Alternative 9: 92.0% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -8.80000000000000022e-33 or 8.5e-9 < z

    1. Initial program 69.9%

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

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

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

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

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

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

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

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

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

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

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

    if -8.80000000000000022e-33 < z < 8.5e-9

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

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

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

Alternative 10: 92.1% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 66.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 95.5%

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

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

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

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

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

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

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

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

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

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

    if -4.19999999999999982e-31 < z < 7.19999999999999962e-8

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

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

    if 7.19999999999999962e-8 < z

    1. Initial program 73.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 100.0%

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

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

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

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

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

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

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

Alternative 11: 47.2% accurate, 1.0× speedup?

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

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

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


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

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

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

    if -0.13 < (/.f64 x y) < 8.8e20

    1. Initial program 86.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 99.1% accurate, 1.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 19.7% accurate, 5.7× speedup?

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

\\
\frac{2}{t}
\end{array}
Derivation
  1. Initial program 83.8%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{2}{t}} \]
  7. Final simplification18.0%

    \[\leadsto \frac{2}{t} \]
  8. Add Preprocessing

Developer target: 99.1% accurate, 1.3× speedup?

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

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

Reproduce

?
herbie shell --seed 2024053 
(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))))