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

Percentage Accurate: 85.8% → 99.1%
Time: 9.9s
Alternatives: 13
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 13 alternatives:

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

Initial Program: 85.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.1% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -400000 \lor \neg \left(\frac{x}{y} \leq 0.0004\right):\\ \;\;\;\;\frac{x}{y} + \frac{2 + 2 \cdot z}{z \cdot 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) -400000.0) (not (<= (/ x y) 0.0004)))
   (+ (/ x y) (/ (+ 2.0 (* 2.0 z)) (* z t)))
   (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x / y) <= -400000.0) || !((x / y) <= 0.0004)) {
		tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * 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) <= (-400000.0d0)) .or. (.not. ((x / y) <= 0.0004d0))) then
        tmp = (x / y) + ((2.0d0 + (2.0d0 * z)) / (z * 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) <= -400000.0) || !((x / y) <= 0.0004)) {
		tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t));
	} else {
		tmp = -2.0 + ((2.0 + (2.0 / z)) / t);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x / y) <= -400000.0) or not ((x / y) <= 0.0004):
		tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * 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) <= -400000.0) || !(Float64(x / y) <= 0.0004))
		tmp = Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(2.0 * z)) / Float64(z * 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) <= -400000.0) || ~(((x / y) <= 0.0004)))
		tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * 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], -400000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.0004]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(2.0 * z), $MachinePrecision]), $MachinePrecision] / N[(z * t), $MachinePrecision]), $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 -400000 \lor \neg \left(\frac{x}{y} \leq 0.0004\right):\\
\;\;\;\;\frac{x}{y} + \frac{2 + 2 \cdot z}{z \cdot 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) < -4e5 or 4.00000000000000019e-4 < (/.f64 x y)

    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.8%

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

    if -4e5 < (/.f64 x y) < 4.00000000000000019e-4

    1. Initial program 84.6%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around 0 99.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. associate-/l/99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{t}}{z} \]
      12. associate-+l+98.3%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 76.8% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;t \leq -4.5 \cdot 10^{-13}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq -2.5 \cdot 10^{-146}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t \leq 4.3 \cdot 10^{-113}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 8 \cdot 10^{-8}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t \leq 5.9 \cdot 10^{+65}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -9.99999999999999977e37 or 5.9000000000000003e65 < t

    1. Initial program 63.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 91.7%

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

    if -9.99999999999999977e37 < t < -4.5e-13 or -2.49999999999999979e-146 < t < 4.3e-113 or 8.0000000000000002e-8 < t < 5.9000000000000003e65

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

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

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

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

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

    if -4.5e-13 < t < -2.49999999999999979e-146 or 4.3e-113 < t < 8.0000000000000002e-8

    1. Initial program 99.8%

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

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{2 + 2 \cdot z}{t \cdot z}} \]
    3. Taylor expanded in z around inf 77.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1 \cdot 10^{+38}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{elif}\;t \leq -4.5 \cdot 10^{-13}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{elif}\;t \leq -2.5 \cdot 10^{-146}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{elif}\;t \leq 4.3 \cdot 10^{-113}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{elif}\;t \leq 8 \cdot 10^{-8}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{elif}\;t \leq 5.9 \cdot 10^{+65}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]

Alternative 4: 68.1% accurate, 0.9× speedup?

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

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

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

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

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


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

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

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{2 + 2 \cdot z}{t \cdot z}} \]
    3. Taylor expanded in z around inf 84.6%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} + \frac{2}{t}} \]
    5. Simplified84.6%

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

    if -2.54999999999999986e106 < (/.f64 x y) < -0.160000000000000003

    1. Initial program 99.4%

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{2}{t}}{z} + \frac{x}{y}} \]
      2. associate-/l/81.4%

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

        \[\leadsto \frac{2}{\color{blue}{t \cdot z}} + \frac{x}{y} \]
      4. associate-/l/81.7%

        \[\leadsto \color{blue}{\frac{\frac{2}{z}}{t}} + \frac{x}{y} \]
      5. frac-add57.9%

        \[\leadsto \color{blue}{\frac{\frac{2}{z} \cdot y + t \cdot x}{t \cdot y}} \]
    6. Applied egg-rr57.9%

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

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

        \[\leadsto \color{blue}{\frac{\frac{2}{t}}{z}} \]
    9. Simplified67.0%

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

    if -0.160000000000000003 < (/.f64 x y) < 2

    1. Initial program 84.5%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. 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. associate-/l/99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{t}}{z} \]
      12. associate-+l+98.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 64.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2.55 \cdot 10^{+106}:\\
\;\;\;\;\frac{x}{y}\\

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

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

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


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

    1. Initial program 80.0%

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

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

    if -2.54999999999999986e106 < (/.f64 x y) < -0.149999999999999994

    1. Initial program 99.4%

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{2}{t}}{z} + \frac{x}{y}} \]
      2. associate-/l/81.4%

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

        \[\leadsto \frac{2}{\color{blue}{t \cdot z}} + \frac{x}{y} \]
      4. associate-/l/81.7%

        \[\leadsto \color{blue}{\frac{\frac{2}{z}}{t}} + \frac{x}{y} \]
      5. frac-add57.9%

        \[\leadsto \color{blue}{\frac{\frac{2}{z} \cdot y + t \cdot x}{t \cdot y}} \]
    6. Applied egg-rr57.9%

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

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

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

    1. Initial program 85.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.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. associate-/l/99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{t}}{z} \]
      12. associate-+l+99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 83.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -2.55 \cdot 10^{+106}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -0.15:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{elif}\;\frac{x}{y} \leq 1.6 \cdot 10^{-6}:\\ \;\;\;\;\frac{2}{t} + -2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]

Alternative 6: 64.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2.55 \cdot 10^{+106}:\\
\;\;\;\;\frac{x}{y}\\

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

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

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


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

    1. Initial program 80.0%

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

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

    if -2.54999999999999986e106 < (/.f64 x y) < -0.209999999999999992

    1. Initial program 99.4%

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{2}{t}}{z} + \frac{x}{y}} \]
      2. associate-/l/81.4%

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

        \[\leadsto \frac{2}{\color{blue}{t \cdot z}} + \frac{x}{y} \]
      4. associate-/l/81.7%

        \[\leadsto \color{blue}{\frac{\frac{2}{z}}{t}} + \frac{x}{y} \]
      5. frac-add57.9%

        \[\leadsto \color{blue}{\frac{\frac{2}{z} \cdot y + t \cdot x}{t \cdot y}} \]
    6. Applied egg-rr57.9%

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

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

        \[\leadsto \color{blue}{\frac{\frac{2}{t}}{z}} \]
    9. Simplified67.0%

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

    if -0.209999999999999992 < (/.f64 x y) < 4.7e-7

    1. Initial program 85.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.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. associate-/l/99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{t}}{z} \]
      12. associate-+l+99.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.7e-7 < (/.f64 x y)

    1. Initial program 83.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -2.55 \cdot 10^{+106}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -0.21:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{elif}\;\frac{x}{y} \leq 4.7 \cdot 10^{-7}:\\ \;\;\;\;\frac{2}{t} + -2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]

Alternative 7: 88.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -2.55 \cdot 10^{+106} \lor \neg \left(\frac{x}{y} \leq 4500000000\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) -2.55e+106) (not (<= (/ x y) 4500000000.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) <= -2.55e+106) || !((x / y) <= 4500000000.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) <= (-2.55d+106)) .or. (.not. ((x / y) <= 4500000000.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) <= -2.55e+106) || !((x / y) <= 4500000000.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) <= -2.55e+106) or not ((x / y) <= 4500000000.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) <= -2.55e+106) || !(Float64(x / y) <= 4500000000.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) <= -2.55e+106) || ~(((x / y) <= 4500000000.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], -2.55e+106], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4500000000.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 -2.55 \cdot 10^{+106} \lor \neg \left(\frac{x}{y} \leq 4500000000\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) < -2.54999999999999986e106 or 4.5e9 < (/.f64 x y)

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

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{2 + 2 \cdot z}{t \cdot z}} \]
    3. Taylor expanded in z around inf 84.6%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} + \frac{2}{t}} \]
    5. Simplified84.6%

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

    if -2.54999999999999986e106 < (/.f64 x y) < 4.5e9

    1. Initial program 86.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.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. associate-/l/99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{t}}{z} \]
      12. associate-+l+96.0%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 93.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -480000 \lor \neg \left(\frac{x}{y} \leq 1300000\right):\\ \;\;\;\;\frac{x}{y} + \frac{2}{z \cdot 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) -480000.0) (not (<= (/ x y) 1300000.0)))
   (+ (/ x y) (/ 2.0 (* z t)))
   (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x / y) <= -480000.0) || !((x / y) <= 1300000.0)) {
		tmp = (x / y) + (2.0 / (z * 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) <= (-480000.0d0)) .or. (.not. ((x / y) <= 1300000.0d0))) then
        tmp = (x / y) + (2.0d0 / (z * 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) <= -480000.0) || !((x / y) <= 1300000.0)) {
		tmp = (x / y) + (2.0 / (z * t));
	} else {
		tmp = -2.0 + ((2.0 + (2.0 / z)) / t);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x / y) <= -480000.0) or not ((x / y) <= 1300000.0):
		tmp = (x / y) + (2.0 / (z * 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) <= -480000.0) || !(Float64(x / y) <= 1300000.0))
		tmp = Float64(Float64(x / y) + Float64(2.0 / Float64(z * 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) <= -480000.0) || ~(((x / y) <= 1300000.0)))
		tmp = (x / y) + (2.0 / (z * 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], -480000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1300000.0]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(2.0 / N[(z * t), $MachinePrecision]), $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 -480000 \lor \neg \left(\frac{x}{y} \leq 1300000\right):\\
\;\;\;\;\frac{x}{y} + \frac{2}{z \cdot 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) < -4.8e5 or 1.3e6 < (/.f64 x y)

    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 z around 0 93.1%

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

    if -4.8e5 < (/.f64 x y) < 1.3e6

    1. Initial program 84.6%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around 0 99.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. associate-/l/99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{t}}{z} \]
      12. associate-+l+98.3%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 93.1% accurate, 1.0× speedup?

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

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

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


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

    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 z around 0 93.1%

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

        \[\leadsto \frac{x}{y} + \color{blue}{\frac{\frac{2}{t}}{z}} \]
    4. Simplified93.1%

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

    if -4e5 < (/.f64 x y) < 4.00000000000000019e-4

    1. Initial program 84.6%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around 0 99.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. associate-/l/99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{t}}{z} \]
      12. associate-+l+98.3%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -400000 \lor \neg \left(\frac{x}{y} \leq 0.0004\right):\\ \;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\ \end{array} \]

Alternative 10: 65.7% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -480000 \lor \neg \left(\frac{x}{y} \leq 92000000\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.8e5 or 9.2e7 < (/.f64 x y)

    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 x around inf 72.0%

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

    if -4.8e5 < (/.f64 x y) < 9.2e7

    1. Initial program 84.6%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Taylor expanded in t around 0 99.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. associate-/l/99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{t}}{z} \]
      12. associate-+l+98.3%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -480000 \lor \neg \left(\frac{x}{y} \leq 92000000\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t} + -2\\ \end{array} \]

Alternative 11: 66.0% accurate, 1.3× speedup?

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

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

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

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

    1. Initial program 85.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.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. associate-/l/99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-2 + \frac{2}{t}\right)} + \frac{\frac{2}{t}}{z} \]
      12. associate-+l+99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 47.6% accurate, 1.5× speedup?

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

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

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


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

    1. Initial program 85.5%

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

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

    if -0.245 < (/.f64 x y) < 1.15e10

    1. Initial program 84.5%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -0.245 \lor \neg \left(\frac{x}{y} \leq 11500000000\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t}\\ \end{array} \]

Alternative 13: 18.8% accurate, 5.7× speedup?

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{2}{t}} \]
  6. Final simplification19.0%

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

Developer target: 99.2% accurate, 1.3× speedup?

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

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

Reproduce

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