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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, -\color{blue}{\left(-\frac{x}{y}\right)}\right) \]
    14. remove-double-neg86.9%

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \frac{x}{y}\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in t around inf 99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 89.2% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -4.2 \cdot 10^{+53} \lor \neg \left(\frac{x}{y} \leq 9 \cdot 10^{+15}\right):\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\

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


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

    1. Initial program 86.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.2000000000000004e53 < (/.f64 x y) < 9e15

    1. Initial program 87.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, -\color{blue}{\left(-\frac{x}{y}\right)}\right) \]
      14. remove-double-neg87.0%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \frac{x}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -4.2 \cdot 10^{+53} \lor \neg \left(\frac{x}{y} \leq 9 \cdot 10^{+15}\right):\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 93.4% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 87.4%

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

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

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

    1. Initial program 86.4%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Step-by-step derivation
      1. +-commutative86.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(z, 1 - t, 1\right)}, \frac{2}{t \cdot z}, -\frac{-x}{y}\right) \]
      12. *-commutative86.3%

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{\color{blue}{z \cdot t}}, -\frac{-x}{y}\right) \]
      13. distribute-frac-neg86.3%

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, -\color{blue}{\left(-\frac{x}{y}\right)}\right) \]
      14. remove-double-neg86.3%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \frac{x}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -130000 \lor \neg \left(\frac{x}{y} \leq 145000\right):\\ \;\;\;\;\frac{x}{y} + \frac{2}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 89.2% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 80.3%

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.0000000000000004e53 < (/.f64 x y) < 1.65e16

    1. Initial program 87.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, -\color{blue}{\left(-\frac{x}{y}\right)}\right) \]
      14. remove-double-neg87.0%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \frac{x}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.65e16 < (/.f64 x y)

    1. Initial program 92.2%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -9 \cdot 10^{+53}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 1.65 \cdot 10^{+16}:\\ \;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 71.7% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -7.5 \cdot 10^{+53} \lor \neg \left(\frac{x}{y} \leq 1.35 \cdot 10^{+17}\right):\\
\;\;\;\;\frac{x}{y}\\

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


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

    1. Initial program 86.7%

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

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

    if -7.4999999999999997e53 < (/.f64 x y) < 1.35e17

    1. Initial program 87.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, -\color{blue}{\left(-\frac{x}{y}\right)}\right) \]
      14. remove-double-neg87.0%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \frac{x}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 75.8% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -1.28e-14 or 3.9e15 < (/.f64 x y)

    1. Initial program 87.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.28e-14 < (/.f64 x y) < 3.9e15

    1. Initial program 86.4%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Step-by-step derivation
      1. +-commutative86.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(z, 1 - t, 1\right)}, \frac{2}{t \cdot z}, -\frac{-x}{y}\right) \]
      12. *-commutative86.3%

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{\color{blue}{z \cdot t}}, -\frac{-x}{y}\right) \]
      13. distribute-frac-neg86.3%

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, -\color{blue}{\left(-\frac{x}{y}\right)}\right) \]
      14. remove-double-neg86.3%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \frac{x}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1.28 \cdot 10^{-14} \lor \neg \left(\frac{x}{y} \leq 3.9 \cdot 10^{+15}\right):\\ \;\;\;\;\frac{x}{y} + \frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{\frac{2}{z}}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 66.1% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 87.4%

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

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

    if -128000 < (/.f64 x y) < 2.5e5

    1. Initial program 86.4%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Step-by-step derivation
      1. +-commutative86.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(z, 1 - t, 1\right)}, \frac{2}{t \cdot z}, -\frac{-x}{y}\right) \]
      12. *-commutative86.3%

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{\color{blue}{z \cdot t}}, -\frac{-x}{y}\right) \]
      13. distribute-frac-neg86.3%

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, -\color{blue}{\left(-\frac{x}{y}\right)}\right) \]
      14. remove-double-neg86.3%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \frac{x}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{t} + \color{blue}{-2} \]
    13. Simplified51.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -128000 \lor \neg \left(\frac{x}{y} \leq 250000\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 66.3% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 87.4%

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

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

    if -13500 < (/.f64 x y) < 35000

    1. Initial program 86.4%

      \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
    2. Step-by-step derivation
      1. +-commutative86.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(z, 1 - t, 1\right)}, \frac{2}{t \cdot z}, -\frac{-x}{y}\right) \]
      12. *-commutative86.3%

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{\color{blue}{z \cdot t}}, -\frac{-x}{y}\right) \]
      13. distribute-frac-neg86.3%

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, -\color{blue}{\left(-\frac{x}{y}\right)}\right) \]
      14. remove-double-neg86.3%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \frac{x}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{t} + \color{blue}{-2} \]
    13. Simplified51.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -13500 \lor \neg \left(\frac{x}{y} \leq 35000\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 52.9% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 88.1%

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

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

    if -9.79999999999999947e-39 < (/.f64 x y) < 2

    1. Initial program 85.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(z, 1 - t, 1\right)}, \frac{2}{t \cdot z}, -\frac{-x}{y}\right) \]
      12. *-commutative85.6%

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{\color{blue}{z \cdot t}}, -\frac{-x}{y}\right) \]
      13. distribute-frac-neg85.6%

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, -\color{blue}{\left(-\frac{x}{y}\right)}\right) \]
      14. remove-double-neg85.6%

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \color{blue}{\frac{x}{y}}\right) \]
    3. Simplified85.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \frac{x}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -9.8 \cdot 10^{-39} \lor \neg \left(\frac{x}{y} \leq 2\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;-2\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 64.4% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.06 \cdot 10^{-34} \lor \neg \left(z \leq 7.6 \cdot 10^{-86}\right):\\
\;\;\;\;\frac{x}{y} - 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.06000000000000006e-34 or 7.6e-86 < z

    1. Initial program 78.1%

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

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

    if -1.06000000000000006e-34 < z < 7.6e-86

    1. Initial program 98.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, -\color{blue}{\left(-\frac{x}{y}\right)}\right) \]
      14. remove-double-neg97.9%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \frac{x}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 98.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.06 \cdot 10^{-34} \lor \neg \left(z \leq 7.6 \cdot 10^{-86}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 64.4% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{-35} \lor \neg \left(z \leq 5.4 \cdot 10^{-86}\right):\\
\;\;\;\;\frac{x}{y} - 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.8999999999999998e-35 or 5.39999999999999985e-86 < z

    1. Initial program 78.1%

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

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

    if -3.8999999999999998e-35 < z < 5.39999999999999985e-86

    1. Initial program 98.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{2}{t}}{z}} \]
    8. Simplified71.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.9 \cdot 10^{-35} \lor \neg \left(z \leq 5.4 \cdot 10^{-86}\right):\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 36.4% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;t \leq 1.98 \cdot 10^{-13}:\\
\;\;\;\;\frac{2}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.5e6 or 1.97999999999999989e-13 < t

    1. Initial program 75.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, -\color{blue}{\left(-\frac{x}{y}\right)}\right) \]
      14. remove-double-neg75.5%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \frac{x}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.5e6 < t < 1.97999999999999989e-13

    1. Initial program 98.2%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1500000:\\ \;\;\;\;-2\\ \mathbf{elif}\;t \leq 1.98 \cdot 10^{-13}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;-2\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 20.0% 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 86.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, -\color{blue}{\left(-\frac{x}{y}\right)}\right) \]
    14. remove-double-neg86.9%

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \frac{x}{y}\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in t around inf 99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-2} \]
  12. Final simplification17.5%

    \[\leadsto -2 \]
  13. Add Preprocessing

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 2024078 
(FPCore (x y z t)
  :name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
  :precision binary64

  :alt
  (- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y)))

  (+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))