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

Percentage Accurate: 86.9% → 99.1%
Time: 13.5s
Alternatives: 10
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 10 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.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.1% accurate, 1.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 81.4% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;z \leq -5.6 \cdot 10^{-66}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;z \leq 3.6 \cdot 10^{-51}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.35e-46 or 3.6e-51 < z

    1. Initial program 73.9%

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

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

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

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

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

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

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

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

    if -3.35e-46 < z < -5.6000000000000001e-66 or -7.99999999999999946e-102 < z < 3.6e-51

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

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

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

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

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

    if -5.6000000000000001e-66 < z < -7.99999999999999946e-102

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.35 \cdot 10^{-46}:\\ \;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\ \mathbf{elif}\;z \leq -5.6 \cdot 10^{-66}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{elif}\;z \leq -8 \cdot 10^{-102}:\\ \;\;\;\;\frac{x}{y} + -2\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{-51}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\ \end{array} \]

Alternative 3: 79.9% accurate, 1.1× speedup?

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

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

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

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

\mathbf{elif}\;t \leq 1080000000:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.3500000000000001e-9 or 1.08e9 < t

    1. Initial program 71.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 inf 82.6%

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

    if -1.3500000000000001e-9 < t < 3.4000000000000002e-113 or 4.1999999999999997e-52 < t < 1.08e9

    1. Initial program 99.7%

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

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

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

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

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

    if 3.4000000000000002e-113 < t < 4.1999999999999997e-52

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.35 \cdot 10^{-9}:\\ \;\;\;\;\frac{x}{y} + -2\\ \mathbf{elif}\;t \leq 3.4 \cdot 10^{-113}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{elif}\;t \leq 4.2 \cdot 10^{-52}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{elif}\;t \leq 1080000000:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + -2\\ \end{array} \]

Alternative 4: 52.3% accurate, 1.1× speedup?

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

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

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

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

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


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

    1. Initial program 84.5%

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

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

    if -4.5e13 < (/.f64 x y) < -2.5000000000000001e-28

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

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

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

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

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

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

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

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

    if -2.5000000000000001e-28 < (/.f64 x y) < 0.0269999999999999997

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

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \frac{1 - t}{t}} \]
    3. Step-by-step derivation
      1. div-sub64.4%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -45000000000000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -2.5 \cdot 10^{-28}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 0.027:\\ \;\;\;\;-2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 5: 64.9% accurate, 1.1× speedup?

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

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

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


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

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

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

    if -1.55e13 < (/.f64 x y) < 9.59999999999999976e-18

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

      \[\leadsto \frac{x}{y} + \color{blue}{2 \cdot \frac{1 - t}{t}} \]
    3. Step-by-step derivation
      1. div-sub65.8%

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

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

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

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

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

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

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

Alternative 6: 91.8% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.65e-35 or 4.0999999999999998e-10 < z

    1. Initial program 71.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 z around inf 98.0%

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

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

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

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

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

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

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

    if -1.65e-35 < z < 4.0999999999999998e-10

    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 0 91.7%

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

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

Alternative 7: 69.9% accurate, 1.5× speedup?

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

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

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


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

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

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

    if -7.9999999999999999e24 < t < 0.095000000000000001

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 59.7% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.85 \cdot 10^{-123} \lor \neg \left(t \leq 3.4 \cdot 10^{-132}\right):\\
\;\;\;\;\frac{x}{y} + -2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.85000000000000014e-123 or 3.39999999999999983e-132 < t

    1. Initial program 79.1%

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

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

    if -2.85000000000000014e-123 < t < 3.39999999999999983e-132

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

Alternative 9: 37.3% accurate, 2.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.2 \cdot 10^{-8}:\\
\;\;\;\;-2\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -8.20000000000000063e-8 or 0.095000000000000001 < t

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

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

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

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

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

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

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

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

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

    if -8.20000000000000063e-8 < t < 0.095000000000000001

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -8.2 \cdot 10^{-8}:\\ \;\;\;\;-2\\ \mathbf{elif}\;t \leq 0.095:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;-2\\ \end{array} \]

Alternative 10: 20.1% 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 83.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 73.1%

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

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

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

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

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

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

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

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

    \[\leadsto -2 \]

Developer target: 99.1% accurate, 1.3× speedup?

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

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

Reproduce

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