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

Percentage Accurate: 86.6% → 99.2%
Time: 9.5s
Alternatives: 12
Speedup: 1.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 86.6% accurate, 1.0× speedup?

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

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

Alternative 1: 99.2% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 63.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} - 2\\ \mathbf{if}\;\frac{x}{y} \leq -550000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq 5500000000000:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 1.9 \cdot 10^{+125}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{+168}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (/ x y) 2.0)))
   (if (<= (/ x y) -550000.0)
     t_1
     (if (<= (/ x y) 5500000000000.0)
       (+ -2.0 (/ 2.0 t))
       (if (<= (/ x y) 1.9e+125)
         (/ 2.0 (* t z))
         (if (<= (/ x y) 4e+168) (/ 2.0 t) t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / y) - 2.0;
	double tmp;
	if ((x / y) <= -550000.0) {
		tmp = t_1;
	} else if ((x / y) <= 5500000000000.0) {
		tmp = -2.0 + (2.0 / t);
	} else if ((x / y) <= 1.9e+125) {
		tmp = 2.0 / (t * z);
	} else if ((x / y) <= 4e+168) {
		tmp = 2.0 / t;
	} 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
    if ((x / y) <= (-550000.0d0)) then
        tmp = t_1
    else if ((x / y) <= 5500000000000.0d0) then
        tmp = (-2.0d0) + (2.0d0 / t)
    else if ((x / y) <= 1.9d+125) then
        tmp = 2.0d0 / (t * z)
    else if ((x / y) <= 4d+168) then
        tmp = 2.0d0 / t
    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;
	double tmp;
	if ((x / y) <= -550000.0) {
		tmp = t_1;
	} else if ((x / y) <= 5500000000000.0) {
		tmp = -2.0 + (2.0 / t);
	} else if ((x / y) <= 1.9e+125) {
		tmp = 2.0 / (t * z);
	} else if ((x / y) <= 4e+168) {
		tmp = 2.0 / t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / y) - 2.0
	tmp = 0
	if (x / y) <= -550000.0:
		tmp = t_1
	elif (x / y) <= 5500000000000.0:
		tmp = -2.0 + (2.0 / t)
	elif (x / y) <= 1.9e+125:
		tmp = 2.0 / (t * z)
	elif (x / y) <= 4e+168:
		tmp = 2.0 / t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x / y) - 2.0)
	tmp = 0.0
	if (Float64(x / y) <= -550000.0)
		tmp = t_1;
	elseif (Float64(x / y) <= 5500000000000.0)
		tmp = Float64(-2.0 + Float64(2.0 / t));
	elseif (Float64(x / y) <= 1.9e+125)
		tmp = Float64(2.0 / Float64(t * z));
	elseif (Float64(x / y) <= 4e+168)
		tmp = Float64(2.0 / t);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x / y) - 2.0;
	tmp = 0.0;
	if ((x / y) <= -550000.0)
		tmp = t_1;
	elseif ((x / y) <= 5500000000000.0)
		tmp = -2.0 + (2.0 / t);
	elseif ((x / y) <= 1.9e+125)
		tmp = 2.0 / (t * z);
	elseif ((x / y) <= 4e+168)
		tmp = 2.0 / t;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -550000.0], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 5500000000000.0], N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1.9e+125], N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 4e+168], N[(2.0 / t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;\frac{x}{y} \leq 1.9 \cdot 10^{+125}:\\
\;\;\;\;\frac{2}{t \cdot z}\\

\mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{+168}:\\
\;\;\;\;\frac{2}{t}\\

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


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

    1. Initial program 85.7%

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

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

    if -5.5e5 < (/.f64 x y) < 5.5e12

    1. Initial program 81.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.5e12 < (/.f64 x y) < 1.90000000000000001e125

    1. Initial program 99.9%

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

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

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

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

      \[\leadsto \color{blue}{\frac{2 + \frac{2}{z}}{t}} \]
    5. Taylor expanded in z around 0 52.9%

      \[\leadsto \frac{\color{blue}{\frac{2}{z}}}{t} \]
    6. Taylor expanded in z around 0 52.9%

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

    if 1.90000000000000001e125 < (/.f64 x y) < 3.9999999999999997e168

    1. Initial program 99.2%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -550000:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;\frac{x}{y} \leq 5500000000000:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 1.9 \cdot 10^{+125}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{+168}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]

Alternative 3: 89.7% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 87.3%

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

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

    if -5e7 < (/.f64 x y) < 1.00000000000000004e121

    1. Initial program 83.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000004e121 < (/.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. Taylor expanded in t around 0 94.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 66.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} - 2\\ t_2 := -2 + \frac{2}{t}\\ \mathbf{if}\;z \leq -1.55 \cdot 10^{+209}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -9.5 \cdot 10^{-37}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-104}:\\ \;\;\;\;-2 + \frac{2}{t \cdot z}\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{+82} \lor \neg \left(z \leq 1.8 \cdot 10^{+134}\right) \land z \leq 2.5 \cdot 10^{+244}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (/ x y) 2.0)) (t_2 (+ -2.0 (/ 2.0 t))))
   (if (<= z -1.55e+209)
     t_2
     (if (<= z -9.5e-37)
       t_1
       (if (<= z 4.8e-104)
         (+ -2.0 (/ 2.0 (* t z)))
         (if (or (<= z 4.5e+82) (and (not (<= z 1.8e+134)) (<= z 2.5e+244)))
           t_1
           t_2))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / y) - 2.0;
	double t_2 = -2.0 + (2.0 / t);
	double tmp;
	if (z <= -1.55e+209) {
		tmp = t_2;
	} else if (z <= -9.5e-37) {
		tmp = t_1;
	} else if (z <= 4.8e-104) {
		tmp = -2.0 + (2.0 / (t * z));
	} else if ((z <= 4.5e+82) || (!(z <= 1.8e+134) && (z <= 2.5e+244))) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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 = (x / y) - 2.0d0
    t_2 = (-2.0d0) + (2.0d0 / t)
    if (z <= (-1.55d+209)) then
        tmp = t_2
    else if (z <= (-9.5d-37)) then
        tmp = t_1
    else if (z <= 4.8d-104) then
        tmp = (-2.0d0) + (2.0d0 / (t * z))
    else if ((z <= 4.5d+82) .or. (.not. (z <= 1.8d+134)) .and. (z <= 2.5d+244)) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (x / y) - 2.0;
	double t_2 = -2.0 + (2.0 / t);
	double tmp;
	if (z <= -1.55e+209) {
		tmp = t_2;
	} else if (z <= -9.5e-37) {
		tmp = t_1;
	} else if (z <= 4.8e-104) {
		tmp = -2.0 + (2.0 / (t * z));
	} else if ((z <= 4.5e+82) || (!(z <= 1.8e+134) && (z <= 2.5e+244))) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / y) - 2.0
	t_2 = -2.0 + (2.0 / t)
	tmp = 0
	if z <= -1.55e+209:
		tmp = t_2
	elif z <= -9.5e-37:
		tmp = t_1
	elif z <= 4.8e-104:
		tmp = -2.0 + (2.0 / (t * z))
	elif (z <= 4.5e+82) or (not (z <= 1.8e+134) and (z <= 2.5e+244)):
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x / y) - 2.0)
	t_2 = Float64(-2.0 + Float64(2.0 / t))
	tmp = 0.0
	if (z <= -1.55e+209)
		tmp = t_2;
	elseif (z <= -9.5e-37)
		tmp = t_1;
	elseif (z <= 4.8e-104)
		tmp = Float64(-2.0 + Float64(2.0 / Float64(t * z)));
	elseif ((z <= 4.5e+82) || (!(z <= 1.8e+134) && (z <= 2.5e+244)))
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x / y) - 2.0;
	t_2 = -2.0 + (2.0 / t);
	tmp = 0.0;
	if (z <= -1.55e+209)
		tmp = t_2;
	elseif (z <= -9.5e-37)
		tmp = t_1;
	elseif (z <= 4.8e-104)
		tmp = -2.0 + (2.0 / (t * z));
	elseif ((z <= 4.5e+82) || (~((z <= 1.8e+134)) && (z <= 2.5e+244)))
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.55e+209], t$95$2, If[LessEqual[z, -9.5e-37], t$95$1, If[LessEqual[z, 4.8e-104], N[(-2.0 + N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 4.5e+82], And[N[Not[LessEqual[z, 1.8e+134]], $MachinePrecision], LessEqual[z, 2.5e+244]]], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -9.5 \cdot 10^{-37}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;z \leq 4.5 \cdot 10^{+82} \lor \neg \left(z \leq 1.8 \cdot 10^{+134}\right) \land z \leq 2.5 \cdot 10^{+244}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.55e209 or 4.4999999999999997e82 < z < 1.79999999999999994e134 or 2.50000000000000011e244 < z

    1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.55e209 < z < -9.49999999999999927e-37 or 4.8000000000000001e-104 < z < 4.4999999999999997e82 or 1.79999999999999994e134 < z < 2.50000000000000011e244

    1. Initial program 78.2%

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

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

    if -9.49999999999999927e-37 < z < 4.8000000000000001e-104

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.55 \cdot 10^{+209}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;z \leq -9.5 \cdot 10^{-37}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-104}:\\ \;\;\;\;-2 + \frac{2}{t \cdot z}\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{+82} \lor \neg \left(z \leq 1.8 \cdot 10^{+134}\right) \land z \leq 2.5 \cdot 10^{+244}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \end{array} \]

Alternative 5: 67.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} - 2\\ t_2 := -2 + \frac{2}{t}\\ \mathbf{if}\;z \leq -1.55 \cdot 10^{+209}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -3.5 \cdot 10^{-35}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-103}:\\ \;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{+82} \lor \neg \left(z \leq 2.1 \cdot 10^{+134}\right) \land z \leq 3.4 \cdot 10^{+246}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (/ x y) 2.0)) (t_2 (+ -2.0 (/ 2.0 t))))
   (if (<= z -1.55e+209)
     t_2
     (if (<= z -3.5e-35)
       t_1
       (if (<= z 2.6e-103)
         (+ -2.0 (/ (/ 2.0 t) z))
         (if (or (<= z 4.8e+82) (and (not (<= z 2.1e+134)) (<= z 3.4e+246)))
           t_1
           t_2))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / y) - 2.0;
	double t_2 = -2.0 + (2.0 / t);
	double tmp;
	if (z <= -1.55e+209) {
		tmp = t_2;
	} else if (z <= -3.5e-35) {
		tmp = t_1;
	} else if (z <= 2.6e-103) {
		tmp = -2.0 + ((2.0 / t) / z);
	} else if ((z <= 4.8e+82) || (!(z <= 2.1e+134) && (z <= 3.4e+246))) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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 = (x / y) - 2.0d0
    t_2 = (-2.0d0) + (2.0d0 / t)
    if (z <= (-1.55d+209)) then
        tmp = t_2
    else if (z <= (-3.5d-35)) then
        tmp = t_1
    else if (z <= 2.6d-103) then
        tmp = (-2.0d0) + ((2.0d0 / t) / z)
    else if ((z <= 4.8d+82) .or. (.not. (z <= 2.1d+134)) .and. (z <= 3.4d+246)) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (x / y) - 2.0;
	double t_2 = -2.0 + (2.0 / t);
	double tmp;
	if (z <= -1.55e+209) {
		tmp = t_2;
	} else if (z <= -3.5e-35) {
		tmp = t_1;
	} else if (z <= 2.6e-103) {
		tmp = -2.0 + ((2.0 / t) / z);
	} else if ((z <= 4.8e+82) || (!(z <= 2.1e+134) && (z <= 3.4e+246))) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / y) - 2.0
	t_2 = -2.0 + (2.0 / t)
	tmp = 0
	if z <= -1.55e+209:
		tmp = t_2
	elif z <= -3.5e-35:
		tmp = t_1
	elif z <= 2.6e-103:
		tmp = -2.0 + ((2.0 / t) / z)
	elif (z <= 4.8e+82) or (not (z <= 2.1e+134) and (z <= 3.4e+246)):
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x / y) - 2.0)
	t_2 = Float64(-2.0 + Float64(2.0 / t))
	tmp = 0.0
	if (z <= -1.55e+209)
		tmp = t_2;
	elseif (z <= -3.5e-35)
		tmp = t_1;
	elseif (z <= 2.6e-103)
		tmp = Float64(-2.0 + Float64(Float64(2.0 / t) / z));
	elseif ((z <= 4.8e+82) || (!(z <= 2.1e+134) && (z <= 3.4e+246)))
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x / y) - 2.0;
	t_2 = -2.0 + (2.0 / t);
	tmp = 0.0;
	if (z <= -1.55e+209)
		tmp = t_2;
	elseif (z <= -3.5e-35)
		tmp = t_1;
	elseif (z <= 2.6e-103)
		tmp = -2.0 + ((2.0 / t) / z);
	elseif ((z <= 4.8e+82) || (~((z <= 2.1e+134)) && (z <= 3.4e+246)))
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.55e+209], t$95$2, If[LessEqual[z, -3.5e-35], t$95$1, If[LessEqual[z, 2.6e-103], N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 4.8e+82], And[N[Not[LessEqual[z, 2.1e+134]], $MachinePrecision], LessEqual[z, 3.4e+246]]], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;z \leq 4.8 \cdot 10^{+82} \lor \neg \left(z \leq 2.1 \cdot 10^{+134}\right) \land z \leq 3.4 \cdot 10^{+246}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.55e209 or 4.79999999999999996e82 < z < 2.1000000000000001e134 or 3.39999999999999988e246 < z

    1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.55e209 < z < -3.49999999999999996e-35 or 2.59999999999999996e-103 < z < 4.79999999999999996e82 or 2.1000000000000001e134 < z < 3.39999999999999988e246

    1. Initial program 78.2%

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

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

    if -3.49999999999999996e-35 < z < 2.59999999999999996e-103

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.55 \cdot 10^{+209}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;z \leq -3.5 \cdot 10^{-35}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-103}:\\ \;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{+82} \lor \neg \left(z \leq 2.1 \cdot 10^{+134}\right) \land z \leq 3.4 \cdot 10^{+246}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \end{array} \]

Alternative 6: 77.9% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{2 + \frac{2}{z}}{t}\\ t_2 := \frac{x}{y} - 2\\ \mathbf{if}\;t \leq -4.6 \cdot 10^{-46}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -4.2 \cdot 10^{-160}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -2.4 \cdot 10^{-202}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t \leq 1.42 \cdot 10^{+19}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (+ 2.0 (/ 2.0 z)) t)) (t_2 (- (/ x y) 2.0)))
   (if (<= t -4.6e-46)
     t_2
     (if (<= t -4.2e-160)
       t_1
       (if (<= t -2.4e-202) (/ x y) (if (<= t 1.42e+19) t_1 t_2))))))
double code(double x, double y, double z, double t) {
	double t_1 = (2.0 + (2.0 / z)) / t;
	double t_2 = (x / y) - 2.0;
	double tmp;
	if (t <= -4.6e-46) {
		tmp = t_2;
	} else if (t <= -4.2e-160) {
		tmp = t_1;
	} else if (t <= -2.4e-202) {
		tmp = x / y;
	} else if (t <= 1.42e+19) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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 + (2.0d0 / z)) / t
    t_2 = (x / y) - 2.0d0
    if (t <= (-4.6d-46)) then
        tmp = t_2
    else if (t <= (-4.2d-160)) then
        tmp = t_1
    else if (t <= (-2.4d-202)) then
        tmp = x / y
    else if (t <= 1.42d+19) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (2.0 + (2.0 / z)) / t;
	double t_2 = (x / y) - 2.0;
	double tmp;
	if (t <= -4.6e-46) {
		tmp = t_2;
	} else if (t <= -4.2e-160) {
		tmp = t_1;
	} else if (t <= -2.4e-202) {
		tmp = x / y;
	} else if (t <= 1.42e+19) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (2.0 + (2.0 / z)) / t
	t_2 = (x / y) - 2.0
	tmp = 0
	if t <= -4.6e-46:
		tmp = t_2
	elif t <= -4.2e-160:
		tmp = t_1
	elif t <= -2.4e-202:
		tmp = x / y
	elif t <= 1.42e+19:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(2.0 + Float64(2.0 / z)) / t)
	t_2 = Float64(Float64(x / y) - 2.0)
	tmp = 0.0
	if (t <= -4.6e-46)
		tmp = t_2;
	elseif (t <= -4.2e-160)
		tmp = t_1;
	elseif (t <= -2.4e-202)
		tmp = Float64(x / y);
	elseif (t <= 1.42e+19)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (2.0 + (2.0 / z)) / t;
	t_2 = (x / y) - 2.0;
	tmp = 0.0;
	if (t <= -4.6e-46)
		tmp = t_2;
	elseif (t <= -4.2e-160)
		tmp = t_1;
	elseif (t <= -2.4e-202)
		tmp = x / y;
	elseif (t <= 1.42e+19)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[t, -4.6e-46], t$95$2, If[LessEqual[t, -4.2e-160], t$95$1, If[LessEqual[t, -2.4e-202], N[(x / y), $MachinePrecision], If[LessEqual[t, 1.42e+19], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq -4.2 \cdot 10^{-160}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq -2.4 \cdot 10^{-202}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;t \leq 1.42 \cdot 10^{+19}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -4.5999999999999998e-46 or 1.42e19 < t

    1. Initial program 72.3%

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

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

    if -4.5999999999999998e-46 < t < -4.2000000000000001e-160 or -2.4000000000000001e-202 < t < 1.42e19

    1. Initial program 98.0%

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

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

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

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

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

    if -4.2000000000000001e-160 < t < -2.4000000000000001e-202

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4.6 \cdot 10^{-46}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;t \leq -4.2 \cdot 10^{-160}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{elif}\;t \leq -2.4 \cdot 10^{-202}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t \leq 1.42 \cdot 10^{+19}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]

Alternative 7: 62.0% accurate, 1.3× speedup?

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

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

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


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

    1. Initial program 85.7%

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

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

    if -245000 < (/.f64 x y) < 3.9999999999999997e168

    1. Initial program 83.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -245000 \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{+168}\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \end{array} \]

Alternative 8: 62.1% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1050000 \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{+168}\right):\\
\;\;\;\;\frac{x}{y} - 2\\

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


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

    1. Initial program 85.7%

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

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

    if -1.05e6 < (/.f64 x y) < 3.9999999999999997e168

    1. Initial program 83.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1050000 \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{+168}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \end{array} \]

Alternative 9: 85.0% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.39999999999999998e-34 or 1.69999999999999996e-105 < z

    1. Initial program 77.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.39999999999999998e-34 < z < 1.69999999999999996e-105

    1. Initial program 97.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.4 \cdot 10^{-34} \lor \neg \left(z \leq 1.7 \cdot 10^{-105}\right):\\ \;\;\;\;-2 + \left(\frac{2}{t} + \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\ \end{array} \]

Alternative 10: 92.2% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.0999999999999997e-6 or 2.5000000000000002e-19 < z

    1. Initial program 73.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.0999999999999997e-6 < z < 2.5000000000000002e-19

    1. Initial program 98.2%

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

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

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

Alternative 11: 43.9% accurate, 1.5× speedup?

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

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

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


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

    1. Initial program 85.7%

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

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

    if -32000 < (/.f64 x y) < 3.9999999999999997e168

    1. Initial program 83.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -32000 \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{+168}\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t}\\ \end{array} \]

Alternative 12: 19.2% accurate, 5.7× speedup?

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

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{2}}{t} \]
  6. Final simplification22.3%

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

Developer target: 99.2% 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 2023333 
(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))))