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

Percentage Accurate: 85.8% → 99.1%
Time: 13.8s
Alternatives: 15
Speedup: 1.1×

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 15 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: 85.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.1% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

Alternative 2: 64.0% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;z \leq -3.8 \cdot 10^{-117}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;z \leq 1.6 \cdot 10^{+51} \lor \neg \left(z \leq 3.4 \cdot 10^{+123}\right):\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.09999999999999999e157 or -1.9999999999999999e35 < z < -3.79999999999999972e-117 or 2.40000000000000017e-108 < z < 1.6000000000000001e51 or 3.40000000000000001e123 < z

    1. Initial program 73.3%

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

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

    if -5.09999999999999999e157 < z < -1.9999999999999999e35 or 1.6000000000000001e51 < z < 3.40000000000000001e123

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.79999999999999972e-117 < z < 2.40000000000000017e-108

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.1 \cdot 10^{+157}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq -2 \cdot 10^{+35}:\\ \;\;\;\;\frac{2}{t} + -2\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-117}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{-108}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{+51} \lor \neg \left(z \leq 3.4 \cdot 10^{+123}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t} + -2\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 52.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.05 \cdot 10^{-16}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;\frac{x}{y} \leq 0:\\
\;\;\;\;-2\\

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

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

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


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

    1. Initial program 84.5%

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

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

    if -1.0500000000000001e-16 < (/.f64 x y) < -0.0 or 2.20000000000000006e-192 < (/.f64 x y) < 2

    1. Initial program 84.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.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (/.f64 x y) < 2.20000000000000006e-192

    1. Initial program 93.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 64.1%

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

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

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

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

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

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

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


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

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

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

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

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

    if -4e11 < (/.f64 x y) < 2.6e9

    1. Initial program 87.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 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 98.0% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 84.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.0500000000000001e-14 < (/.f64 x y) < 2

    1. Initial program 85.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 97.9% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\frac{2}{t \cdot z} + \left(\frac{2}{t} + -2\right)\\

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


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

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

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

    if -5.0000000000000002e-14 < (/.f64 x y) < 5.00000000000000041e-6

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000041e-6 < (/.f64 x y)

    1. Initial program 87.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 96.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 88.2% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 82.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 95.7%

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

        \[\leadsto \frac{x}{y} + \color{blue}{\frac{\frac{2 + 2 \cdot z}{t}}{z}} \]
      2. +-commutative88.3%

        \[\leadsto \frac{x}{y} + \frac{\frac{\color{blue}{2 \cdot z + 2}}{t}}{z} \]
      3. fma-def88.3%

        \[\leadsto \frac{x}{y} + \frac{\frac{\color{blue}{\mathsf{fma}\left(2, z, 2\right)}}{t}}{z} \]
    5. Simplified88.3%

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{\frac{\mathsf{fma}\left(2, z, 2\right)}{t}}{z}} \]
    6. Taylor expanded in z around inf 82.4%

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

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

        \[\leadsto \frac{\color{blue}{2}}{t} + \frac{x}{y} \]
      3. +-commutative82.4%

        \[\leadsto \color{blue}{\frac{x}{y} + \frac{2}{t}} \]
    8. Simplified82.4%

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

    if -43 < (/.f64 x y) < 1.4499999999999999e87

    1. Initial program 87.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 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 92.7% accurate, 0.7× speedup?

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

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

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


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

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

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

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

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

    if -1.35e12 < (/.f64 x y) < 2.2e6

    1. Initial program 87.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 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 68.4% accurate, 0.8× speedup?

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

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

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

\mathbf{elif}\;z \leq 4800000:\\
\;\;\;\;\frac{x}{y} - 2\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.64999999999999992e-39 or 4.8e6 < z

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

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

        \[\leadsto \frac{x}{y} + \color{blue}{\frac{\frac{2 + 2 \cdot z}{t}}{z}} \]
      2. +-commutative56.8%

        \[\leadsto \frac{x}{y} + \frac{\frac{\color{blue}{2 \cdot z + 2}}{t}}{z} \]
      3. fma-def56.8%

        \[\leadsto \frac{x}{y} + \frac{\frac{\color{blue}{\mathsf{fma}\left(2, z, 2\right)}}{t}}{z} \]
    5. Simplified56.8%

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{\frac{\mathsf{fma}\left(2, z, 2\right)}{t}}{z}} \]
    6. Taylor expanded in z around inf 73.8%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} + \frac{2}{t}} \]
    8. Simplified73.8%

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

    if -1.64999999999999992e-39 < z < 1.8e-108

    1. Initial program 97.4%

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

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

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

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

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

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

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

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

    if 1.8e-108 < z < 4.8e6

    1. Initial program 99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.65 \cdot 10^{-39}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-108}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{elif}\;z \leq 4800000:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 65.3% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 82.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 73.1%

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

    if -1.04e11 < (/.f64 x y) < 2.6e8

    1. Initial program 87.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 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 65.4% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 82.9%

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

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

    if -3.8e11 < (/.f64 x y) < 7.8e6

    1. Initial program 87.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 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 80.5% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 74.1%

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

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

    if -3.5e-12 < t < 1e13

    1. Initial program 96.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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) \]
      16. remove-double-neg97.4%

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

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

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

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

Alternative 13: 80.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -2.4 \cdot 10^{-12} \lor \neg \left(t \leq 10000000000000\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 -2.4e-12) (not (<= t 10000000000000.0)))
   (- (/ x y) 2.0)
   (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -2.4e-12) || !(t <= 10000000000000.0)) {
		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 <= (-2.4d-12)) .or. (.not. (t <= 10000000000000.0d0))) 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 <= -2.4e-12) || !(t <= 10000000000000.0)) {
		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 <= -2.4e-12) or not (t <= 10000000000000.0):
		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 <= -2.4e-12) || !(t <= 10000000000000.0))
		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 <= -2.4e-12) || ~((t <= 10000000000000.0)))
		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, -2.4e-12], N[Not[LessEqual[t, 10000000000000.0]], $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 -2.4 \cdot 10^{-12} \lor \neg \left(t \leq 10000000000000\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 < -2.39999999999999987e-12 or 1e13 < t

    1. Initial program 74.1%

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

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

    if -2.39999999999999987e-12 < t < 1e13

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

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

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

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

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

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

Alternative 14: 36.4% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1:\\ \;\;\;\;-2\\ \mathbf{elif}\;t \leq 8 \cdot 10^{+46}:\\ \;\;\;\;\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 8e+46) (/ 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 <= 8e+46) {
		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 <= 8d+46) 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 <= 8e+46) {
		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 <= 8e+46:
		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 <= 8e+46)
		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 <= 8e+46)
		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, 8e+46], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < t < 7.9999999999999999e46

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1:\\ \;\;\;\;-2\\ \mathbf{elif}\;t \leq 8 \cdot 10^{+46}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;-2\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 20.4% accurate, 17.0× speedup?

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

\\
-2
\end{array}
Derivation
  1. Initial program 85.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 98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-2} \]
  10. Final simplification18.3%

    \[\leadsto -2 \]
  11. 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 2024020 
(FPCore (x y z t)
  :name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
  :precision binary64

  :herbie-target
  (- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y)))

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