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

Percentage Accurate: 86.5% → 99.2%
Time: 15.6s
Alternatives: 14
Speedup: 1.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 86.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.2% accurate, 1.3× speedup?

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

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

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

    \[\leadsto \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-*r/99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 97.6% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 92.2%

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

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

    if -5e20 < (/.f64 x y) < 2.00000000000000014e-17

    1. Initial program 89.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(2 \cdot \frac{1}{t \cdot z} + 2 \cdot \frac{1}{t}\right)} + -2 \]
    12. Step-by-step derivation
      1. distribute-lft-out99.9%

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

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

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

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

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

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

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

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

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

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

Alternative 3: 49.9% accurate, 0.9× speedup?

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

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

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

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

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

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


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

    1. Initial program 90.8%

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

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

    if -2.05e11 < (/.f64 x y) < -6.30000000000000023e-81 or 9.5999999999999992e-246 < (/.f64 x y) < 7.50000000000000014e90

    1. Initial program 97.2%

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

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{2}{\frac{t}{1 - t}}} \]
    5. Taylor expanded in t around 0 41.9%

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

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

    if -6.30000000000000023e-81 < (/.f64 x y) < 9.5999999999999992e-246

    1. Initial program 84.3%

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

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

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

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

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{2}{\frac{t}{1 - t}}} \]
    5. Taylor expanded in x around 0 59.4%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -205000000000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -6.3 \cdot 10^{-81}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 9.6 \cdot 10^{-246}:\\ \;\;\;\;-2\\ \mathbf{elif}\;\frac{x}{y} \leq 7.5 \cdot 10^{+90}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 4: 91.5% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 90.8%

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

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

    if -1e8 < (/.f64 x y) < 3.89999999999999968e91

    1. Initial program 90.8%

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

      \[\leadsto \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-*r/99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 91.5% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 93.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5e20 < (/.f64 x y) < 4.99999999999999983e89

    1. Initial program 90.8%

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

      \[\leadsto \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-*r/99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.99999999999999983e89 < (/.f64 x y)

    1. Initial program 86.8%

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

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

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

Alternative 6: 80.4% accurate, 1.1× speedup?

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

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

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

\mathbf{elif}\;t \leq 4.6 \cdot 10^{+19}:\\
\;\;\;\;\left(2 + \frac{2}{z}\right) \cdot \frac{1}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.04999999999999997e154 or 4.6e19 < t

    1. Initial program 71.7%

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

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

    if -1.04999999999999997e154 < t < -6.5e-52

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

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

    if -6.5e-52 < t < 4.6e19

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

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

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

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

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

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

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

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

Alternative 7: 80.4% accurate, 1.1× speedup?

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

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

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

\mathbf{elif}\;t \leq 6.8 \cdot 10^{+18}:\\
\;\;\;\;\left(2 + \frac{2}{z}\right) \cdot \frac{1}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -4.69999999999999968e153 or 6.8e18 < t

    1. Initial program 71.7%

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

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

    if -4.69999999999999968e153 < t < -1.2e-51

    1. Initial program 97.4%

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y} + \frac{2}{\color{blue}{z \cdot t}} \]
      2. associate-/r*79.9%

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

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

    if -1.2e-51 < t < 6.8e18

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

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

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

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

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

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

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

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

Alternative 8: 80.1% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.6 \cdot 10^{-7} \lor \neg \left(t \leq 7.2 \cdot 10^{+18}\right):\\
\;\;\;\;-2 + \frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -6.6000000000000003e-7 or 7.2e18 < t

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

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

    if -6.6000000000000003e-7 < t < 7.2e18

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

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

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

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

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

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

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

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

Alternative 9: 64.4% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 90.8%

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

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

    if -1.45e12 < (/.f64 x y) < 4.19999999999999972e89

    1. Initial program 90.8%

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

      \[\leadsto \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-*r/99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1450000000000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 4.2 \cdot 10^{+89}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 10: 62.7% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
t_1 := -2 + \frac{2}{t}\\
\mathbf{if}\;z \leq -1.1 \cdot 10^{+125}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -1.1 \cdot 10^{-121}:\\
\;\;\;\;-2 + \frac{x}{y}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.09999999999999995e125 or 3.7000000000000002e-28 < z

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

      \[\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+100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.09999999999999995e125 < z < -1.10000000000000011e-121

    1. Initial program 95.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 inf 68.4%

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

    if -1.10000000000000011e-121 < z < 3.7000000000000002e-28

    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.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-*r/99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.1 \cdot 10^{+125}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;z \leq -1.1 \cdot 10^{-121}:\\ \;\;\;\;-2 + \frac{x}{y}\\ \mathbf{elif}\;z \leq 3.7 \cdot 10^{-28}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \end{array} \]

Alternative 11: 65.4% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;z \leq -2.25 \cdot 10^{-123}:\\
\;\;\;\;-2 + \frac{x}{y}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -2.7e25

    1. Initial program 80.8%

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

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

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

        \[\leadsto \frac{x}{y} + \color{blue}{\frac{2}{\frac{t}{1 - t}}} \]
    4. Simplified100.0%

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{2}{\frac{t}{1 - t}}} \]
    5. Taylor expanded in t around 0 82.3%

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

    if -2.7e25 < z < -2.24999999999999997e-123

    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 inf 72.6%

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

    if -2.24999999999999997e-123 < z < 3.99999999999999988e-28

    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.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-*r/99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999988e-28 < z

    1. Initial program 79.8%

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

      \[\leadsto \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+100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.7 \cdot 10^{+25}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{elif}\;z \leq -2.25 \cdot 10^{-123}:\\ \;\;\;\;-2 + \frac{x}{y}\\ \mathbf{elif}\;z \leq 4 \cdot 10^{-28}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \end{array} \]

Alternative 12: 80.1% accurate, 1.5× speedup?

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

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

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


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

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

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

    if -0.0029 < t < 6.5e18

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

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

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

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

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

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

Alternative 13: 36.9% accurate, 2.4× speedup?

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

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

\mathbf{elif}\;t \leq 3.4 \cdot 10^{+20}:\\
\;\;\;\;\frac{2}{t}\\

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


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

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

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

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

        \[\leadsto \frac{x}{y} + \color{blue}{\frac{2}{\frac{t}{1 - t}}} \]
    4. Simplified81.9%

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{2}{\frac{t}{1 - t}}} \]
    5. Taylor expanded in x around 0 39.5%

      \[\leadsto \color{blue}{2 \cdot \frac{1 - t}{t}} \]
    6. Step-by-step derivation
      1. div-sub39.5%

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

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

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

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

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

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

    if -0.46000000000000002 < t < 3.4e20

    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 z around inf 52.0%

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

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

        \[\leadsto \frac{x}{y} + \color{blue}{\frac{2}{\frac{t}{1 - t}}} \]
    4. Simplified52.0%

      \[\leadsto \frac{x}{y} + \color{blue}{\frac{2}{\frac{t}{1 - t}}} \]
    5. Taylor expanded in t around 0 51.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -0.46:\\ \;\;\;\;-2\\ \mathbf{elif}\;t \leq 3.4 \cdot 10^{+20}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;-2\\ \end{array} \]

Alternative 14: 20.2% accurate, 17.0× speedup?

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

\\
-2
\end{array}
Derivation
  1. Initial program 90.8%

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

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

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

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

    \[\leadsto \frac{x}{y} + \color{blue}{\frac{2}{\frac{t}{1 - t}}} \]
  5. Taylor expanded in x around 0 38.4%

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

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

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

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

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

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

    \[\leadsto 2 \cdot \color{blue}{-1} \]
  9. Final simplification18.7%

    \[\leadsto -2 \]

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 2023279 
(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))))