Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A

Percentage Accurate: 89.3% → 97.7%
Time: 11.0s
Alternatives: 12
Speedup: 0.3×

Specification

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

\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 89.3% accurate, 1.0× speedup?

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

\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}

Alternative 1: 97.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\ t_2 := x - z \cdot t\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\frac{y \cdot \left(\left(\frac{x}{y} - \frac{z}{t\_2}\right) + \frac{x}{y \cdot t\_2}\right)}{x + 1}\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+306}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0)))
        (t_2 (- x (* z t))))
   (if (<= t_1 (- INFINITY))
     (/ (* y (+ (- (/ x y) (/ z t_2)) (/ x (* y t_2)))) (+ x 1.0))
     (if (<= t_1 2e+306) t_1 (/ (+ x (/ y t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
	double t_2 = x - (z * t);
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = (y * (((x / y) - (z / t_2)) + (x / (y * t_2)))) / (x + 1.0);
	} else if (t_1 <= 2e+306) {
		tmp = t_1;
	} else {
		tmp = (x + (y / t)) / (x + 1.0);
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
	double t_2 = x - (z * t);
	double tmp;
	if (t_1 <= -Double.POSITIVE_INFINITY) {
		tmp = (y * (((x / y) - (z / t_2)) + (x / (y * t_2)))) / (x + 1.0);
	} else if (t_1 <= 2e+306) {
		tmp = t_1;
	} else {
		tmp = (x + (y / t)) / (x + 1.0);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0)
	t_2 = x - (z * t)
	tmp = 0
	if t_1 <= -math.inf:
		tmp = (y * (((x / y) - (z / t_2)) + (x / (y * t_2)))) / (x + 1.0)
	elif t_1 <= 2e+306:
		tmp = t_1
	else:
		tmp = (x + (y / t)) / (x + 1.0)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0))
	t_2 = Float64(x - Float64(z * t))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(Float64(y * Float64(Float64(Float64(x / y) - Float64(z / t_2)) + Float64(x / Float64(y * t_2)))) / Float64(x + 1.0));
	elseif (t_1 <= 2e+306)
		tmp = t_1;
	else
		tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
	t_2 = x - (z * t);
	tmp = 0.0;
	if (t_1 <= -Inf)
		tmp = (y * (((x / y) - (z / t_2)) + (x / (y * t_2)))) / (x + 1.0);
	elseif (t_1 <= 2e+306)
		tmp = t_1;
	else
		tmp = (x + (y / t)) / (x + 1.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(y * N[(N[(N[(x / y), $MachinePrecision] - N[(z / t$95$2), $MachinePrecision]), $MachinePrecision] + N[(x / N[(y * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+306], t$95$1, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
t_2 := x - z \cdot t\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{y \cdot \left(\left(\frac{x}{y} - \frac{z}{t\_2}\right) + \frac{x}{y \cdot t\_2}\right)}{x + 1}\\

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+306}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < -inf.0

    1. Initial program 50.1%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative50.1%

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 95.6%

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

    if -inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2.00000000000000003e306

    1. Initial program 99.9%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Add Preprocessing

    if 2.00000000000000003e306 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 19.4%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative19.4%

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 99.9%

      \[\leadsto \color{blue}{\frac{x + \frac{y}{t}}{1 + x}} \]
    6. Step-by-step derivation
      1. +-commutative99.9%

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

        \[\leadsto \frac{\frac{y}{t} + x}{\color{blue}{x + 1}} \]
    7. Simplified99.9%

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

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

Alternative 2: 93.1% accurate, 0.1× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x + \frac{y}{t}}{x + 1}\\
t_2 := z \cdot t - x\\
t_3 := \frac{z}{t\_2} \cdot \frac{y}{x + 1}\\
t_4 := \frac{x + \frac{y \cdot z - x}{t\_2}}{x + 1}\\
\mathbf{if}\;t\_4 \leq -5:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t\_4 \leq 5 \cdot 10^{-52}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_4 \leq 10^{-6}:\\
\;\;\;\;\frac{\frac{\frac{x}{z} - y}{t}}{-1 - x}\\

\mathbf{elif}\;t\_4 \leq 2:\\
\;\;\;\;1\\

\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+306}:\\
\;\;\;\;t\_3\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < -5 or 2 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2.00000000000000003e306

    1. Initial program 81.5%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative81.5%

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 78.9%

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

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

        \[\leadsto \frac{y}{\color{blue}{x + 1}} \cdot \frac{z}{t \cdot z - x} \]
    7. Simplified95.5%

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

    if -5 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 5e-52 or 2.00000000000000003e306 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 73.0%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative73.0%

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified73.0%

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 94.2%

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

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

        \[\leadsto \frac{\frac{y}{t} + x}{\color{blue}{x + 1}} \]
    7. Simplified94.2%

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

    if 5e-52 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 9.99999999999999955e-7

    1. Initial program 99.6%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative99.6%

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in t around -inf 99.6%

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

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

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

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

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

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

        \[\leadsto \frac{x - \frac{\color{blue}{\frac{x}{z} + -1 \cdot y}}{t}}{x + 1} \]
      7. mul-1-neg99.6%

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

        \[\leadsto \frac{x - \frac{\color{blue}{\frac{x}{z} - y}}{t}}{x + 1} \]
    7. Simplified99.6%

      \[\leadsto \frac{\color{blue}{x - \frac{\frac{x}{z} - y}{t}}}{x + 1} \]
    8. Taylor expanded in t around 0 99.6%

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

    if 9.99999999999999955e-7 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2

    1. Initial program 100.0%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 99.4%

      \[\leadsto \color{blue}{1} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification97.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq -5:\\ \;\;\;\;\frac{z}{z \cdot t - x} \cdot \frac{y}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 5 \cdot 10^{-52}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 10^{-6}:\\ \;\;\;\;\frac{\frac{\frac{x}{z} - y}{t}}{-1 - x}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 2:\\ \;\;\;\;1\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 2 \cdot 10^{+306}:\\ \;\;\;\;\frac{z}{z \cdot t - x} \cdot \frac{y}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 97.3% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_1 := x + \frac{y}{t}\\
t_2 := z \cdot t - x\\
t_3 := \frac{z}{t\_2} \cdot \frac{y}{x + 1}\\
t_4 := \frac{x + \frac{y \cdot z - x}{t\_2}}{x + 1}\\
\mathbf{if}\;t\_4 \leq -5:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t\_4 \leq 10^{-6}:\\
\;\;\;\;\frac{t\_1 - \frac{x}{z \cdot t}}{x + 1}\\

\mathbf{elif}\;t\_4 \leq 2:\\
\;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\

\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+306}:\\
\;\;\;\;t\_3\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{x + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < -5 or 2 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2.00000000000000003e306

    1. Initial program 81.5%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative81.5%

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 78.9%

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

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

        \[\leadsto \frac{y}{\color{blue}{x + 1}} \cdot \frac{z}{t \cdot z - x} \]
    7. Simplified95.5%

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

    if -5 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 9.99999999999999955e-7

    1. Initial program 99.8%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative99.8%

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 99.9%

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

    if 9.99999999999999955e-7 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2

    1. Initial program 100.0%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 99.9%

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

        \[\leadsto \frac{x - \frac{x}{t \cdot z - x}}{\color{blue}{x + 1}} \]
    7. Simplified99.9%

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

    if 2.00000000000000003e306 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 19.4%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative19.4%

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 99.9%

      \[\leadsto \color{blue}{\frac{x + \frac{y}{t}}{1 + x}} \]
    6. Step-by-step derivation
      1. +-commutative99.9%

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

        \[\leadsto \frac{\frac{y}{t} + x}{\color{blue}{x + 1}} \]
    7. Simplified99.9%

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

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

Alternative 4: 97.3% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{z}{t\_1} \cdot \frac{y}{x + 1}\\
t_3 := \frac{x + \frac{y \cdot z - x}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_3 \leq -5:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_3 \leq 10^{-6}:\\
\;\;\;\;\frac{x + \frac{y - \frac{x}{z}}{t}}{x + 1}\\

\mathbf{elif}\;t\_3 \leq 2:\\
\;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\

\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+306}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < -5 or 2 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2.00000000000000003e306

    1. Initial program 81.5%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative81.5%

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 78.9%

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

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

        \[\leadsto \frac{y}{\color{blue}{x + 1}} \cdot \frac{z}{t \cdot z - x} \]
    7. Simplified95.5%

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

    if -5 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 9.99999999999999955e-7

    1. Initial program 99.8%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative99.8%

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in t around -inf 99.9%

      \[\leadsto \frac{\color{blue}{x + -1 \cdot \frac{-1 \cdot y - -1 \cdot \frac{x}{z}}{t}}}{x + 1} \]
    6. Step-by-step derivation
      1. mul-1-neg99.9%

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

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

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

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

        \[\leadsto \frac{x - \frac{-1 \cdot y + \color{blue}{\frac{x}{z}}}{t}}{x + 1} \]
      6. +-commutative99.9%

        \[\leadsto \frac{x - \frac{\color{blue}{\frac{x}{z} + -1 \cdot y}}{t}}{x + 1} \]
      7. mul-1-neg99.9%

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

        \[\leadsto \frac{x - \frac{\color{blue}{\frac{x}{z} - y}}{t}}{x + 1} \]
    7. Simplified99.9%

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

    if 9.99999999999999955e-7 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2

    1. Initial program 100.0%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 99.9%

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

        \[\leadsto \frac{x - \frac{x}{t \cdot z - x}}{\color{blue}{x + 1}} \]
    7. Simplified99.9%

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

    if 2.00000000000000003e306 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 19.4%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative19.4%

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 99.9%

      \[\leadsto \color{blue}{\frac{x + \frac{y}{t}}{1 + x}} \]
    6. Step-by-step derivation
      1. +-commutative99.9%

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

        \[\leadsto \frac{\frac{y}{t} + x}{\color{blue}{x + 1}} \]
    7. Simplified99.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq -5:\\ \;\;\;\;\frac{z}{z \cdot t - x} \cdot \frac{y}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 10^{-6}:\\ \;\;\;\;\frac{x + \frac{y - \frac{x}{z}}{t}}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 2:\\ \;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 2 \cdot 10^{+306}:\\ \;\;\;\;\frac{z}{z \cdot t - x} \cdot \frac{y}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 94.1% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x + \frac{y}{t}}{x + 1}\\
t_2 := z \cdot t - x\\
t_3 := \frac{z}{t\_2} \cdot \frac{y}{x + 1}\\
t_4 := \frac{x + \frac{y \cdot z - x}{t\_2}}{x + 1}\\
\mathbf{if}\;t\_4 \leq -5:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{-58}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_4 \leq 2:\\
\;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\

\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+306}:\\
\;\;\;\;t\_3\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < -5 or 2 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2.00000000000000003e306

    1. Initial program 81.5%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative81.5%

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 78.9%

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

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

        \[\leadsto \frac{y}{\color{blue}{x + 1}} \cdot \frac{z}{t \cdot z - x} \]
    7. Simplified95.5%

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

    if -5 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2.0000000000000001e-58 or 2.00000000000000003e306 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 72.5%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative72.5%

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 94.1%

      \[\leadsto \color{blue}{\frac{x + \frac{y}{t}}{1 + x}} \]
    6. Step-by-step derivation
      1. +-commutative94.1%

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

        \[\leadsto \frac{\frac{y}{t} + x}{\color{blue}{x + 1}} \]
    7. Simplified94.1%

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

    if 2.0000000000000001e-58 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2

    1. Initial program 100.0%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 97.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq -5:\\ \;\;\;\;\frac{z}{z \cdot t - x} \cdot \frac{y}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 2 \cdot 10^{-58}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 2:\\ \;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 2 \cdot 10^{+306}:\\ \;\;\;\;\frac{z}{z \cdot t - x} \cdot \frac{y}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 85.2% accurate, 0.2× speedup?

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

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

\mathbf{elif}\;t\_2 \leq 10^{-6}:\\
\;\;\;\;\frac{\frac{\frac{x}{z} - y}{t}}{-1 - x}\\

\mathbf{elif}\;t\_2 \leq 1.00000000000005:\\
\;\;\;\;1\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 5e-52 or 1.00000000000004996 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 77.9%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative77.9%

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 72.5%

      \[\leadsto \color{blue}{\frac{x + \frac{y}{t}}{1 + x}} \]
    6. Step-by-step derivation
      1. +-commutative72.5%

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

        \[\leadsto \frac{\frac{y}{t} + x}{\color{blue}{x + 1}} \]
    7. Simplified72.5%

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

    if 5e-52 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 9.99999999999999955e-7

    1. Initial program 99.6%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative99.6%

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in t around -inf 99.6%

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

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

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

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

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

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

        \[\leadsto \frac{x - \frac{\color{blue}{\frac{x}{z} + -1 \cdot y}}{t}}{x + 1} \]
      7. mul-1-neg99.6%

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

        \[\leadsto \frac{x - \frac{\color{blue}{\frac{x}{z} - y}}{t}}{x + 1} \]
    7. Simplified99.6%

      \[\leadsto \frac{\color{blue}{x - \frac{\frac{x}{z} - y}{t}}}{x + 1} \]
    8. Taylor expanded in t around 0 99.6%

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

    if 9.99999999999999955e-7 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 1.00000000000004996

    1. Initial program 100.0%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 99.5%

      \[\leadsto \color{blue}{1} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification87.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 5 \cdot 10^{-52}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 10^{-6}:\\ \;\;\;\;\frac{\frac{\frac{x}{z} - y}{t}}{-1 - x}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 1.00000000000005:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 78.0% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{y}{t \cdot \left(x + 1\right)}\\
t_2 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-60}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-26}:\\
\;\;\;\;x \cdot \left(1 + \frac{\frac{-1}{t}}{z}\right)\\

\mathbf{elif}\;t\_2 \leq 2:\\
\;\;\;\;1\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < -5.0000000000000001e-60 or 2 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 71.1%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative71.1%

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in t around -inf 67.5%

      \[\leadsto \frac{\color{blue}{x + -1 \cdot \frac{-1 \cdot y - -1 \cdot \frac{x}{z}}{t}}}{x + 1} \]
    6. Step-by-step derivation
      1. mul-1-neg67.5%

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

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

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

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

        \[\leadsto \frac{x - \frac{-1 \cdot y + \color{blue}{\frac{x}{z}}}{t}}{x + 1} \]
      6. +-commutative67.5%

        \[\leadsto \frac{x - \frac{\color{blue}{\frac{x}{z} + -1 \cdot y}}{t}}{x + 1} \]
      7. mul-1-neg67.5%

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

        \[\leadsto \frac{x - \frac{\color{blue}{\frac{x}{z} - y}}{t}}{x + 1} \]
    7. Simplified67.5%

      \[\leadsto \frac{\color{blue}{x - \frac{\frac{x}{z} - y}{t}}}{x + 1} \]
    8. Taylor expanded in y around inf 54.6%

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

    if -5.0000000000000001e-60 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 5.00000000000000019e-26

    1. Initial program 99.8%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative99.8%

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 69.2%

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

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

      \[\leadsto \color{blue}{\frac{x - \frac{x}{t \cdot z - x}}{x + 1}} \]
    8. Taylor expanded in x around 0 69.2%

      \[\leadsto \color{blue}{x \cdot \left(1 - \frac{1}{t \cdot z}\right)} \]
    9. Step-by-step derivation
      1. associate-/r*69.2%

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

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

    if 5.00000000000000019e-26 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2

    1. Initial program 100.0%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 97.5%

      \[\leadsto \color{blue}{1} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification79.3%

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

Alternative 8: 97.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot t - x\\ t_2 := \frac{x + \frac{y \cdot z - x}{t\_1}}{x + 1}\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;\frac{z}{t\_1} \cdot \frac{y}{x + 1}\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+306}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (* z t) x)) (t_2 (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0))))
   (if (<= t_2 (- INFINITY))
     (* (/ z t_1) (/ y (+ x 1.0)))
     (if (<= t_2 2e+306) t_2 (/ (+ x (/ y t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
	double t_1 = (z * t) - x;
	double t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = (z / t_1) * (y / (x + 1.0));
	} else if (t_2 <= 2e+306) {
		tmp = t_2;
	} else {
		tmp = (x + (y / t)) / (x + 1.0);
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = (z * t) - x;
	double t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
	double tmp;
	if (t_2 <= -Double.POSITIVE_INFINITY) {
		tmp = (z / t_1) * (y / (x + 1.0));
	} else if (t_2 <= 2e+306) {
		tmp = t_2;
	} else {
		tmp = (x + (y / t)) / (x + 1.0);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (z * t) - x
	t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0)
	tmp = 0
	if t_2 <= -math.inf:
		tmp = (z / t_1) * (y / (x + 1.0))
	elif t_2 <= 2e+306:
		tmp = t_2
	else:
		tmp = (x + (y / t)) / (x + 1.0)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(z * t) - x)
	t_2 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / t_1)) / Float64(x + 1.0))
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = Float64(Float64(z / t_1) * Float64(y / Float64(x + 1.0)));
	elseif (t_2 <= 2e+306)
		tmp = t_2;
	else
		tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * t) - x;
	t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
	tmp = 0.0;
	if (t_2 <= -Inf)
		tmp = (z / t_1) * (y / (x + 1.0));
	elseif (t_2 <= 2e+306)
		tmp = t_2;
	else
		tmp = (x + (y / t)) / (x + 1.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(z / t$95$1), $MachinePrecision] * N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+306], t$95$2, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{x + \frac{y \cdot z - x}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\frac{z}{t\_1} \cdot \frac{y}{x + 1}\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+306}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < -inf.0

    1. Initial program 50.1%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative50.1%

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 49.7%

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

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

        \[\leadsto \frac{y}{\color{blue}{x + 1}} \cdot \frac{z}{t \cdot z - x} \]
    7. Simplified95.3%

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

    if -inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2.00000000000000003e306

    1. Initial program 99.9%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Add Preprocessing

    if 2.00000000000000003e306 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 19.4%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative19.4%

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 99.9%

      \[\leadsto \color{blue}{\frac{x + \frac{y}{t}}{1 + x}} \]
    6. Step-by-step derivation
      1. +-commutative99.9%

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

        \[\leadsto \frac{\frac{y}{t} + x}{\color{blue}{x + 1}} \]
    7. Simplified99.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq -\infty:\\ \;\;\;\;\frac{z}{z \cdot t - x} \cdot \frac{y}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 2 \cdot 10^{+306}:\\ \;\;\;\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 86.1% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t\_1 \leq 10^{-6} \lor \neg \left(t\_1 \leq 1.00000000000005\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 9.99999999999999955e-7 or 1.00000000000004996 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 79.3%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative79.3%

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 70.5%

      \[\leadsto \color{blue}{\frac{x + \frac{y}{t}}{1 + x}} \]
    6. Step-by-step derivation
      1. +-commutative70.5%

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

        \[\leadsto \frac{\frac{y}{t} + x}{\color{blue}{x + 1}} \]
    7. Simplified70.5%

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

    if 9.99999999999999955e-7 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 1.00000000000004996

    1. Initial program 100.0%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 99.5%

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

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

Alternative 10: 73.5% accurate, 0.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 9.99999999999999955e-7 or 2 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 79.1%

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

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in t around -inf 76.5%

      \[\leadsto \frac{\color{blue}{x + -1 \cdot \frac{-1 \cdot y - -1 \cdot \frac{x}{z}}{t}}}{x + 1} \]
    6. Step-by-step derivation
      1. mul-1-neg76.5%

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

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

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

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

        \[\leadsto \frac{x - \frac{-1 \cdot y + \color{blue}{\frac{x}{z}}}{t}}{x + 1} \]
      6. +-commutative76.5%

        \[\leadsto \frac{x - \frac{\color{blue}{\frac{x}{z} + -1 \cdot y}}{t}}{x + 1} \]
      7. mul-1-neg76.5%

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

        \[\leadsto \frac{x - \frac{\color{blue}{\frac{x}{z} - y}}{t}}{x + 1} \]
    7. Simplified76.5%

      \[\leadsto \frac{\color{blue}{x - \frac{\frac{x}{z} - y}{t}}}{x + 1} \]
    8. Taylor expanded in y around inf 50.0%

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

    if 9.99999999999999955e-7 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2

    1. Initial program 100.0%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 99.4%

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

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

Alternative 11: 70.9% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t\_1 \leq 10^{-6} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+24}\right):\\
\;\;\;\;\frac{y}{t}\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 9.99999999999999955e-7 or 5.00000000000000045e24 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 78.6%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative78.6%

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 47.2%

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

    if 9.99999999999999955e-7 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 5.00000000000000045e24

    1. Initial program 100.0%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 97.4%

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

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

Alternative 12: 53.5% accurate, 17.0× speedup?

\[\begin{array}{l} \\ 1 \end{array} \]
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
	return 1.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 = 1.0d0
end function
public static double code(double x, double y, double z, double t) {
	return 1.0;
}
def code(x, y, z, t):
	return 1.0
function code(x, y, z, t)
	return 1.0
end
function tmp = code(x, y, z, t)
	tmp = 1.0;
end
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}

\\
1
\end{array}
Derivation
  1. Initial program 90.1%

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

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

    \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around inf 56.1%

    \[\leadsto \color{blue}{1} \]
  6. Add Preprocessing

Developer Target 1: 99.6% accurate, 0.8× speedup?

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

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

Reproduce

?
herbie shell --seed 2024191 
(FPCore (x y z t)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, A"
  :precision binary64

  :alt
  (! :herbie-platform default (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1)))

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