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

Percentage Accurate: 86.7% → 99.0%
Time: 9.5s
Alternatives: 11
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 11 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.7% 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.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \frac{x}{y} + \left(\frac{2}{t \cdot 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(2.0 / Float64(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[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

Alternative 2: 70.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} + \frac{2}{t}\\ \mathbf{if}\;\frac{x}{y} \leq -3300000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq 3.2 \cdot 10^{-39}:\\ \;\;\;\;\frac{2}{t} + -2\\ \mathbf{elif}\;\frac{x}{y} \leq 68000000000:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ (/ x y) (/ 2.0 t))))
   (if (<= (/ x y) -3300000.0)
     t_1
     (if (<= (/ x y) 3.2e-39)
       (+ (/ 2.0 t) -2.0)
       (if (<= (/ x y) 68000000000.0) (/ 2.0 (* t z)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / y) + (2.0 / t);
	double tmp;
	if ((x / y) <= -3300000.0) {
		tmp = t_1;
	} else if ((x / y) <= 3.2e-39) {
		tmp = (2.0 / t) + -2.0;
	} else if ((x / y) <= 68000000000.0) {
		tmp = 2.0 / (t * z);
	} 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 ((x / y) <= (-3300000.0d0)) then
        tmp = t_1
    else if ((x / y) <= 3.2d-39) then
        tmp = (2.0d0 / t) + (-2.0d0)
    else if ((x / y) <= 68000000000.0d0) then
        tmp = 2.0d0 / (t * z)
    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 ((x / y) <= -3300000.0) {
		tmp = t_1;
	} else if ((x / y) <= 3.2e-39) {
		tmp = (2.0 / t) + -2.0;
	} else if ((x / y) <= 68000000000.0) {
		tmp = 2.0 / (t * z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / y) + (2.0 / t)
	tmp = 0
	if (x / y) <= -3300000.0:
		tmp = t_1
	elif (x / y) <= 3.2e-39:
		tmp = (2.0 / t) + -2.0
	elif (x / y) <= 68000000000.0:
		tmp = 2.0 / (t * z)
	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 (Float64(x / y) <= -3300000.0)
		tmp = t_1;
	elseif (Float64(x / y) <= 3.2e-39)
		tmp = Float64(Float64(2.0 / t) + -2.0);
	elseif (Float64(x / y) <= 68000000000.0)
		tmp = Float64(2.0 / Float64(t * z));
	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 ((x / y) <= -3300000.0)
		tmp = t_1;
	elseif ((x / y) <= 3.2e-39)
		tmp = (2.0 / t) + -2.0;
	elseif ((x / y) <= 68000000000.0)
		tmp = 2.0 / (t * z);
	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[N[(x / y), $MachinePrecision], -3300000.0], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 3.2e-39], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 68000000000.0], N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

\mathbf{elif}\;\frac{x}{y} \leq 3.2 \cdot 10^{-39}:\\
\;\;\;\;\frac{2}{t} + -2\\

\mathbf{elif}\;\frac{x}{y} \leq 68000000000:\\
\;\;\;\;\frac{2}{t \cdot z}\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.3e6 < (/.f64 x y) < 3.1999999999999998e-39

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

      \[\leadsto \frac{x}{y} + \color{blue}{\left(\left(2 \cdot \frac{1}{t \cdot z} + \frac{2}{t}\right) - 2\right)} \]
    3. 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. *-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \color{blue}{1 \cdot \frac{2 + \frac{2}{z}}{t}} \]
      19. *-lft-identity99.9%

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

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

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

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

        \[\leadsto \frac{\color{blue}{2}}{t} - 2 \]
      3. sub-neg65.3%

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

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

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

    if 3.1999999999999998e-39 < (/.f64 x y) < 6.8e10

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -3300000:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 3.2 \cdot 10^{-39}:\\ \;\;\;\;\frac{2}{t} + -2\\ \mathbf{elif}\;\frac{x}{y} \leq 68000000000:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \end{array} \]

Alternative 3: 89.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -5.2 \cdot 10^{+20} \lor \neg \left(\frac{x}{y} \leq 2800000000000\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) -5.2e+20) (not (<= (/ x y) 2800000000000.0)))
   (+ (/ 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) <= -5.2e+20) || !((x / y) <= 2800000000000.0)) {
		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) <= (-5.2d+20)) .or. (.not. ((x / y) <= 2800000000000.0d0))) 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) <= -5.2e+20) || !((x / y) <= 2800000000000.0)) {
		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) <= -5.2e+20) or not ((x / y) <= 2800000000000.0):
		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) <= -5.2e+20) || !(Float64(x / y) <= 2800000000000.0))
		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) <= -5.2e+20) || ~(((x / y) <= 2800000000000.0)))
		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], -5.2e+20], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2800000000000.0]], $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 -5.2 \cdot 10^{+20} \lor \neg \left(\frac{x}{y} \leq 2800000000000\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) < -5.2e20 or 2.8e12 < (/.f64 x y)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.2e20 < (/.f64 x y) < 2.8e12

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

      \[\leadsto \frac{x}{y} + \color{blue}{\left(\left(2 \cdot \frac{1}{t \cdot z} + \frac{2}{t}\right) - 2\right)} \]
    3. 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. *-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \color{blue}{1 \cdot \frac{2 + \frac{2}{z}}{t}} \]
      19. *-lft-identity96.6%

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

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

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

Alternative 4: 89.5% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 77.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 94.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.9e20 < (/.f64 x y) < 3.2e12

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

      \[\leadsto \frac{x}{y} + \color{blue}{\left(\left(2 \cdot \frac{1}{t \cdot z} + \frac{2}{t}\right) - 2\right)} \]
    3. 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. *-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \color{blue}{1 \cdot \frac{2 + \frac{2}{z}}{t}} \]
      19. *-lft-identity96.6%

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

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

    if 3.2e12 < (/.f64 x y)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 91.4% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 79.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 87.8%

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

    if -7e6 < (/.f64 x y) < 1e12

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

      \[\leadsto \frac{x}{y} + \color{blue}{\left(\left(2 \cdot \frac{1}{t \cdot z} + \frac{2}{t}\right) - 2\right)} \]
    3. 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. *-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \color{blue}{1 \cdot \frac{2 + \frac{2}{z}}{t}} \]
      19. *-lft-identity99.1%

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

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

    if 1e12 < (/.f64 x y)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 52.3% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -26500000:\\
\;\;\;\;\frac{x}{y}\\

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

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

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


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

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

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

    if -2.65e7 < (/.f64 x y) < -3.3000000000000001e-121

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{2}{t}} \]
    9. Taylor expanded in x around 0 39.3%

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

    if -3.3000000000000001e-121 < (/.f64 x y) < 3.3000000000000003e-33

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

      \[\leadsto \frac{x}{y} + \color{blue}{\left(\left(2 \cdot \frac{1}{t \cdot z} + \frac{2}{t}\right) - 2\right)} \]
    3. 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. *-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \color{blue}{1 \cdot \frac{2 + \frac{2}{z}}{t}} \]
      19. *-lft-identity99.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -26500000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -3.3 \cdot 10^{-121}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 3.3 \cdot 10^{-33}:\\ \;\;\;\;-2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 7: 65.7% accurate, 1.3× speedup?

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

    1. Initial program 80.1%

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

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

    if -4.3e6 < (/.f64 x y) < 1.21999999999999994e-14

    1. Initial program 90.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 \frac{x}{y} + \color{blue}{\left(\left(2 \cdot \frac{1}{t \cdot z} + \frac{2}{t}\right) - 2\right)} \]
    3. 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. *-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \color{blue}{1 \cdot \frac{2 + \frac{2}{z}}{t}} \]
      19. *-lft-identity99.9%

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

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

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

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

        \[\leadsto \frac{\color{blue}{2}}{t} - 2 \]
      3. sub-neg63.9%

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

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

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

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

Alternative 8: 66.4% accurate, 1.3× speedup?

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

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

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

    if -7.4e6 < (/.f64 x y) < 1.21999999999999994e-14

    1. Initial program 90.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 \frac{x}{y} + \color{blue}{\left(\left(2 \cdot \frac{1}{t \cdot z} + \frac{2}{t}\right) - 2\right)} \]
    3. 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. *-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \color{blue}{1 \cdot \frac{2 + \frac{2}{z}}{t}} \]
      19. *-lft-identity99.9%

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

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

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

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

        \[\leadsto \frac{\color{blue}{2}}{t} - 2 \]
      3. sub-neg63.9%

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

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

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

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

Alternative 9: 80.1% accurate, 1.5× speedup?

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

    1. Initial program 74.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 inf 84.3%

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

    if -3.19999999999999994e-11 < t < 1.42e24

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

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

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

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

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

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

Alternative 10: 36.9% accurate, 2.4× speedup?

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

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

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

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


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

    1. Initial program 75.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 \frac{x}{y} + \color{blue}{\left(\left(2 \cdot \frac{1}{t \cdot z} + \frac{2}{t}\right) - 2\right)} \]
    3. 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. *-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 + \color{blue}{1 \cdot \frac{2 + \frac{2}{z}}{t}} \]
      19. *-lft-identity53.6%

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

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

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

    if -375 < t < 1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{2}{t}} \]
    9. Taylor expanded in x around 0 35.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -375:\\ \;\;\;\;-2\\ \mathbf{elif}\;t \leq 1:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;-2\\ \end{array} \]

Alternative 11: 19.8% 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.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 98.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -2 + \color{blue}{1 \cdot \frac{2 + \frac{2}{z}}{t}} \]
    19. *-lft-identity62.8%

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

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

    \[\leadsto \color{blue}{-2} \]
  9. Final simplification20.1%

    \[\leadsto -2 \]

Developer target: 99.0% accurate, 1.3× speedup?

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

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

Reproduce

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