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

Percentage Accurate: 86.1% → 99.0%
Time: 8.8s
Alternatives: 12
Speedup: 1.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 86.1% accurate, 1.0× speedup?

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

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

Alternative 1: 99.0% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 71.6% accurate, 0.7× speedup?

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

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

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

\mathbf{elif}\;\frac{x}{y} \leq -0.0155 \lor \neg \left(\frac{x}{y} \leq 4.8 \cdot 10^{+51}\right):\\
\;\;\;\;\frac{x}{y} - 2\\

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


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

    1. Initial program 78.0%

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

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

    if -1.69999999999999993e69 < (/.f64 x y) < -4.6e7

    1. Initial program 91.5%

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

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

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

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

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

    if -4.6e7 < (/.f64 x y) < -0.0155 or 4.7999999999999997e51 < (/.f64 x y)

    1. Initial program 90.9%

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

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

    if -0.0155 < (/.f64 x y) < 4.7999999999999997e51

    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 \color{blue}{\left(2 \cdot \frac{1}{t} + \left(\frac{2}{t \cdot z} + \frac{x}{y}\right)\right) - 2} \]
    3. Step-by-step derivation
      1. sub-neg99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1.7 \cdot 10^{+69}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -46000000:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq -0.0155 \lor \neg \left(\frac{x}{y} \leq 4.8 \cdot 10^{+51}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t \cdot z} + -2\\ \end{array} \]

Alternative 3: 92.9% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -5.1999999999999997e24 or 1.41999999999999991e35 < (/.f64 x y)

    1. Initial program 84.9%

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

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

    if -5.1999999999999997e24 < (/.f64 x y) < 1.41999999999999991e35

    1. Initial program 90.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 70.9% accurate, 1.1× speedup?

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

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

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

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


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

    1. Initial program 79.2%

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

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

    if -9.4999999999999998e77 < (/.f64 x y) < 4.6000000000000001e51

    1. Initial program 89.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.6000000000000001e51 < (/.f64 x y)

    1. Initial program 90.4%

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

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

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

Alternative 5: 65.7% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -0.00155 \lor \neg \left(\frac{x}{y} \leq 1.02 \cdot 10^{-7}\right):\\
\;\;\;\;\frac{x}{y} - 2\\

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


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

    1. Initial program 86.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 85.7% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.6000000000000001e-14 or 4.70000000000000021e-49 < z

    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 t around 0 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.6000000000000001e-14 < z < 4.70000000000000021e-49

    1. Initial program 96.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 92.1% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.20000000000000018e-31 or 2.20000000000000005e-33 < z

    1. Initial program 80.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.20000000000000018e-31 < z < 2.20000000000000005e-33

    1. Initial program 96.4%

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

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

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

Alternative 8: 65.4% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -1.1e17 or 1.25000000000000005e35 < (/.f64 x y)

    1. Initial program 85.1%

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

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

    if -1.1e17 < (/.f64 x y) < 1.25000000000000005e35

    1. Initial program 89.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1.1 \cdot 10^{+17}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 1.25 \cdot 10^{+35}:\\ \;\;\;\;\frac{2}{t} + -2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 9: 52.7% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 85.6%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y} - 2} \]
    3. Taylor expanded in x around 0 38.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -2:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 1750:\\ \;\;\;\;-2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 10: 64.0% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{-32} \lor \neg \left(z \leq 1.65 \cdot 10^{-46}\right):\\
\;\;\;\;\frac{x}{y} - 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -8.5000000000000003e-32 or 1.65000000000000007e-46 < z

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

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

    if -8.5000000000000003e-32 < z < 1.65000000000000007e-46

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

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

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

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

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

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

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

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

Alternative 11: 37.1% accurate, 2.4× speedup?

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

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

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

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


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

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

      \[\leadsto \color{blue}{\frac{x}{y} - 2} \]
    3. Taylor expanded in x around 0 40.5%

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

    if -1.30000000000000004 < t < 0.95999999999999996

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

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

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

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

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

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

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

Alternative 12: 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 87.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 56.4%

    \[\leadsto \color{blue}{\frac{x}{y} - 2} \]
  3. Taylor expanded in x around 0 21.1%

    \[\leadsto \color{blue}{-2} \]
  4. Final simplification21.1%

    \[\leadsto -2 \]

Developer target: 99.0% accurate, 1.3× speedup?

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

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

Reproduce

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