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

Percentage Accurate: 90.0% → 96.3%
Time: 13.3s
Alternatives: 14
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 14 alternatives:

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

Initial Program: 90.0% 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: 96.3% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+223}:\\
\;\;\;\;\frac{x + \frac{1}{\frac{t\_3}{t\_1}}}{x + 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 34.1%

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

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified34.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 34.1%

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

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

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

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

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

      \[\leadsto \frac{x + \color{blue}{y \cdot \left(\frac{z}{x \cdot \left(\frac{t \cdot z}{x} - 1\right)} - \frac{1}{y \cdot \left(\frac{t \cdot z}{x} - 1\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.00000000000000009e223

    1. Initial program 99.4%

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

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num99.4%

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

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

        \[\leadsto \frac{x + {\left(\frac{z \cdot t - x}{\color{blue}{\mathsf{fma}\left(y, z, -x\right)}}\right)}^{-1}}{x + 1} \]
    6. Applied egg-rr99.4%

      \[\leadsto \frac{x + \color{blue}{{\left(\frac{z \cdot t - x}{\mathsf{fma}\left(y, z, -x\right)}\right)}^{-1}}}{x + 1} \]
    7. Step-by-step derivation
      1. unpow-199.4%

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

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

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

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

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

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

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

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

    1. Initial program 25.5%

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

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified25.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 81.2%

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

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

Alternative 2: 96.3% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+223}:\\
\;\;\;\;\frac{x + \frac{1}{\frac{t\_2}{t\_1}}}{x + 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 34.1%

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

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified34.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 32.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. associate-/l*62.3%

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{\frac{z}{x + 1}}{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.00000000000000009e223

    1. Initial program 99.4%

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

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num99.4%

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

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

        \[\leadsto \frac{x + {\left(\frac{z \cdot t - x}{\color{blue}{\mathsf{fma}\left(y, z, -x\right)}}\right)}^{-1}}{x + 1} \]
    6. Applied egg-rr99.4%

      \[\leadsto \frac{x + \color{blue}{{\left(\frac{z \cdot t - x}{\mathsf{fma}\left(y, z, -x\right)}\right)}^{-1}}}{x + 1} \]
    7. Step-by-step derivation
      1. unpow-199.4%

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

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

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

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

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

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

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

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

    1. Initial program 25.5%

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

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified25.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 81.2%

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

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

Alternative 3: 96.4% 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:\\ \;\;\;\;y \cdot \frac{\frac{z}{x + 1}}{t\_1}\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+223}:\\ \;\;\;\;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))
     (* y (/ (/ z (+ x 1.0)) t_1))
     (if (<= t_2 2e+223) 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 = y * ((z / (x + 1.0)) / t_1);
	} else if (t_2 <= 2e+223) {
		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 = y * ((z / (x + 1.0)) / t_1);
	} else if (t_2 <= 2e+223) {
		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 = y * ((z / (x + 1.0)) / t_1)
	elif t_2 <= 2e+223:
		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(y * Float64(Float64(z / Float64(x + 1.0)) / t_1));
	elseif (t_2 <= 2e+223)
		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 = y * ((z / (x + 1.0)) / t_1);
	elseif (t_2 <= 2e+223)
		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[(y * N[(N[(z / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+223], 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:\\
\;\;\;\;y \cdot \frac{\frac{z}{x + 1}}{t\_1}\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+223}:\\
\;\;\;\;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 34.1%

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

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified34.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 32.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. associate-/l*62.3%

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{\frac{z}{x + 1}}{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.00000000000000009e223

    1. Initial program 99.4%

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

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

    1. Initial program 25.5%

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

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified25.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 81.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq -\infty:\\ \;\;\;\;y \cdot \frac{\frac{z}{x + 1}}{z \cdot t - x}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 2 \cdot 10^{+223}:\\ \;\;\;\;\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 4: 86.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x + \frac{y \cdot z}{z \cdot t - x}}{x + 1}\\ t_2 := x + \frac{y}{t}\\ \mathbf{if}\;z \leq -1.8 \cdot 10^{+134}:\\ \;\;\;\;\frac{t\_2}{x + 1}\\ \mathbf{elif}\;z \leq -8.2 \cdot 10^{-164}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{-212}:\\ \;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{+177}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_2 - \frac{x}{z \cdot t}}{x + 1}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (+ x (/ (* y z) (- (* z t) x))) (+ x 1.0)))
        (t_2 (+ x (/ y t))))
   (if (<= z -1.8e+134)
     (/ t_2 (+ x 1.0))
     (if (<= z -8.2e-164)
       t_1
       (if (<= z 3.5e-212)
         (/ (+ x (/ x (- x (* z t)))) (+ x 1.0))
         (if (<= z 1.7e+177) t_1 (/ (- t_2 (/ x (* z t))) (+ x 1.0))))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x + ((y * z) / ((z * t) - x))) / (x + 1.0);
	double t_2 = x + (y / t);
	double tmp;
	if (z <= -1.8e+134) {
		tmp = t_2 / (x + 1.0);
	} else if (z <= -8.2e-164) {
		tmp = t_1;
	} else if (z <= 3.5e-212) {
		tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
	} else if (z <= 1.7e+177) {
		tmp = t_1;
	} else {
		tmp = (t_2 - (x / (z * 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) :: tmp
    t_1 = (x + ((y * z) / ((z * t) - x))) / (x + 1.0d0)
    t_2 = x + (y / t)
    if (z <= (-1.8d+134)) then
        tmp = t_2 / (x + 1.0d0)
    else if (z <= (-8.2d-164)) then
        tmp = t_1
    else if (z <= 3.5d-212) then
        tmp = (x + (x / (x - (z * t)))) / (x + 1.0d0)
    else if (z <= 1.7d+177) then
        tmp = t_1
    else
        tmp = (t_2 - (x / (z * 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 = (x + ((y * z) / ((z * t) - x))) / (x + 1.0);
	double t_2 = x + (y / t);
	double tmp;
	if (z <= -1.8e+134) {
		tmp = t_2 / (x + 1.0);
	} else if (z <= -8.2e-164) {
		tmp = t_1;
	} else if (z <= 3.5e-212) {
		tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
	} else if (z <= 1.7e+177) {
		tmp = t_1;
	} else {
		tmp = (t_2 - (x / (z * t))) / (x + 1.0);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x + ((y * z) / ((z * t) - x))) / (x + 1.0)
	t_2 = x + (y / t)
	tmp = 0
	if z <= -1.8e+134:
		tmp = t_2 / (x + 1.0)
	elif z <= -8.2e-164:
		tmp = t_1
	elif z <= 3.5e-212:
		tmp = (x + (x / (x - (z * t)))) / (x + 1.0)
	elif z <= 1.7e+177:
		tmp = t_1
	else:
		tmp = (t_2 - (x / (z * t))) / (x + 1.0)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x + Float64(Float64(y * z) / Float64(Float64(z * t) - x))) / Float64(x + 1.0))
	t_2 = Float64(x + Float64(y / t))
	tmp = 0.0
	if (z <= -1.8e+134)
		tmp = Float64(t_2 / Float64(x + 1.0));
	elseif (z <= -8.2e-164)
		tmp = t_1;
	elseif (z <= 3.5e-212)
		tmp = Float64(Float64(x + Float64(x / Float64(x - Float64(z * t)))) / Float64(x + 1.0));
	elseif (z <= 1.7e+177)
		tmp = t_1;
	else
		tmp = Float64(Float64(t_2 - Float64(x / Float64(z * t))) / Float64(x + 1.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x + ((y * z) / ((z * t) - x))) / (x + 1.0);
	t_2 = x + (y / t);
	tmp = 0.0;
	if (z <= -1.8e+134)
		tmp = t_2 / (x + 1.0);
	elseif (z <= -8.2e-164)
		tmp = t_1;
	elseif (z <= 3.5e-212)
		tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
	elseif (z <= 1.7e+177)
		tmp = t_1;
	else
		tmp = (t_2 - (x / (z * t))) / (x + 1.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(N[(y * z), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.8e+134], N[(t$95$2 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -8.2e-164], t$95$1, If[LessEqual[z, 3.5e-212], N[(N[(x + N[(x / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.7e+177], t$95$1, N[(N[(t$95$2 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -8.2 \cdot 10^{-164}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 3.5 \cdot 10^{-212}:\\
\;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\

\mathbf{elif}\;z \leq 1.7 \cdot 10^{+177}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_2 - \frac{x}{z \cdot t}}{x + 1}\\


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

    1. Initial program 69.6%

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

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

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

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

    if -1.79999999999999994e134 < z < -8.1999999999999996e-164 or 3.4999999999999998e-212 < z < 1.6999999999999999e177

    1. Initial program 97.8%

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

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified97.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 inf 92.8%

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

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

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

    if -8.1999999999999996e-164 < z < 3.4999999999999998e-212

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

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

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

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

    if 1.6999999999999999e177 < z

    1. Initial program 63.2%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.8 \cdot 10^{+134}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{elif}\;z \leq -8.2 \cdot 10^{-164}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{z \cdot t - x}}{x + 1}\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{-212}:\\ \;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{+177}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{z \cdot t - x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x + \frac{y}{t}\right) - \frac{x}{z \cdot t}}{x + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 86.3% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;z \leq -2.1 \cdot 10^{-167}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 1.6 \cdot 10^{-207}:\\
\;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\

\mathbf{elif}\;z \leq 6.2 \cdot 10^{+175}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.80000000000000035e134 or 6.19999999999999968e175 < z

    1. Initial program 67.0%

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

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified67.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 92.3%

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

    if -6.80000000000000035e134 < z < -2.10000000000000017e-167 or 1.6000000000000002e-207 < z < 6.19999999999999968e175

    1. Initial program 97.8%

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

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified97.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 inf 92.8%

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

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

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

    if -2.10000000000000017e-167 < z < 1.6000000000000002e-207

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.8 \cdot 10^{+134}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{elif}\;z \leq -2.1 \cdot 10^{-167}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{z \cdot t - x}}{x + 1}\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-207}:\\ \;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{+175}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{z \cdot t - x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 81.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.65 \cdot 10^{-5} \lor \neg \left(t \leq 1.2 \cdot 10^{-93}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(x + 1\right) - y \cdot \frac{z}{x}}{x + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.6500000000000001e-5 or 1.2000000000000001e-93 < t

    1. Initial program 87.7%

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

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

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

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

    if -1.6500000000000001e-5 < t < 1.2000000000000001e-93

    1. Initial program 93.4%

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

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

      \[\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 0 76.6%

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

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

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

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

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

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

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

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

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

Alternative 7: 79.1% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -8.99999999999999971e-156 or 7.4999999999999997e53 < z

    1. Initial program 83.2%

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

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

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

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

    if -8.99999999999999971e-156 < z < 7.4999999999999997e53

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

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

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

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

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

Alternative 8: 75.7% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.9 \cdot 10^{-145} \lor \neg \left(t \leq 6.2 \cdot 10^{-94}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{x - \frac{y \cdot z}{x}}{x + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.89999999999999967e-145 or 6.1999999999999996e-94 < t

    1. Initial program 87.6%

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

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

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

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

    if -4.89999999999999967e-145 < t < 6.1999999999999996e-94

    1. Initial program 95.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x + \frac{\color{blue}{\left(-y\right)} \cdot z}{x}}{x + 1} \]
    10. Simplified68.7%

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

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

Alternative 9: 69.8% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{-22} \lor \neg \left(x \leq 4.1 \cdot 10^{-153}\right):\\
\;\;\;\;\frac{x}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.60000000000000046e-22 or 4.1e-153 < x

    1. Initial program 89.4%

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

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

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

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

        \[\leadsto \frac{x}{\color{blue}{x + 1}} \]
    7. Simplified79.8%

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

    if -7.60000000000000046e-22 < x < 4.1e-153

    1. Initial program 91.3%

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

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

      \[\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 57.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. associate-/l*61.5%

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

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

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

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

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

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

Alternative 10: 76.2% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{+114}:\\
\;\;\;\;1\\

\mathbf{elif}\;x \leq 0.00039:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.5000000000000001e114 or 3.89999999999999993e-4 < x

    1. Initial program 87.3%

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

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified87.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 76.2%

      \[\leadsto \frac{x + \color{blue}{\frac{y}{t}}}{x + 1} \]
    6. Taylor expanded in x around inf 87.6%

      \[\leadsto \color{blue}{1} \]

    if -7.5000000000000001e114 < x < 3.89999999999999993e-4

    1. Initial program 92.5%

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

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified92.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 73.9%

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

Alternative 11: 67.1% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-126} \lor \neg \left(x \leq 5 \cdot 10^{-148}\right):\\
\;\;\;\;\frac{x}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.49999999999999987e-126 or 4.9999999999999999e-148 < x

    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 t around inf 77.1%

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

        \[\leadsto \frac{x}{\color{blue}{x + 1}} \]
    7. Simplified77.1%

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

    if -5.49999999999999987e-126 < x < 4.9999999999999999e-148

    1. Initial program 89.6%

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

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num89.6%

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

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

        \[\leadsto \frac{x + {\left(\frac{z \cdot t - x}{\color{blue}{\mathsf{fma}\left(y, z, -x\right)}}\right)}^{-1}}{x + 1} \]
    6. Applied egg-rr89.6%

      \[\leadsto \frac{x + \color{blue}{{\left(\frac{z \cdot t - x}{\mathsf{fma}\left(y, z, -x\right)}\right)}^{-1}}}{x + 1} \]
    7. Step-by-step derivation
      1. unpow-189.6%

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

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

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

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

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

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

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

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

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

Alternative 12: 67.3% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3:\\
\;\;\;\;1\\

\mathbf{elif}\;x \leq 1.18 \cdot 10^{-123}:\\
\;\;\;\;\frac{y}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3 or 1.18e-123 < x

    1. Initial program 88.7%

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

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

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

      \[\leadsto \frac{x + \color{blue}{\frac{y}{t}}}{x + 1} \]
    6. Taylor expanded in x around inf 80.4%

      \[\leadsto \color{blue}{1} \]

    if -3 < x < 1.18e-123

    1. Initial program 92.4%

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

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num92.4%

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

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

        \[\leadsto \frac{x + {\left(\frac{z \cdot t - x}{\color{blue}{\mathsf{fma}\left(y, z, -x\right)}}\right)}^{-1}}{x + 1} \]
    6. Applied egg-rr92.4%

      \[\leadsto \frac{x + \color{blue}{{\left(\frac{z \cdot t - x}{\mathsf{fma}\left(y, z, -x\right)}\right)}^{-1}}}{x + 1} \]
    7. Step-by-step derivation
      1. unpow-192.4%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{t}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 13: 55.2% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-74}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= x -3.0) 1.0 (if (<= x 1.05e-74) x 1.0)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -3.0) {
		tmp = 1.0;
	} else if (x <= 1.05e-74) {
		tmp = x;
	} 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) :: tmp
    if (x <= (-3.0d0)) then
        tmp = 1.0d0
    else if (x <= 1.05d-74) then
        tmp = x
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -3.0) {
		tmp = 1.0;
	} else if (x <= 1.05e-74) {
		tmp = x;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if x <= -3.0:
		tmp = 1.0
	elif x <= 1.05e-74:
		tmp = x
	else:
		tmp = 1.0
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (x <= -3.0)
		tmp = 1.0;
	elseif (x <= 1.05e-74)
		tmp = x;
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (x <= -3.0)
		tmp = 1.0;
	elseif (x <= 1.05e-74)
		tmp = x;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.0], 1.0, If[LessEqual[x, 1.05e-74], x, 1.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3:\\
\;\;\;\;1\\

\mathbf{elif}\;x \leq 1.05 \cdot 10^{-74}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3 or 1.05e-74 < x

    1. Initial program 88.3%

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

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified88.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 76.1%

      \[\leadsto \frac{x + \color{blue}{\frac{y}{t}}}{x + 1} \]
    6. Taylor expanded in x around inf 82.7%

      \[\leadsto \color{blue}{1} \]

    if -3 < x < 1.05e-74

    1. Initial program 92.8%

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

        \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Simplified92.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 26.3%

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

        \[\leadsto \frac{x}{\color{blue}{x + 1}} \]
    7. Simplified26.3%

      \[\leadsto \color{blue}{\frac{x}{x + 1}} \]
    8. Taylor expanded in x around 0 26.3%

      \[\leadsto \color{blue}{x \cdot \left(1 + x \cdot \left(x - 1\right)\right)} \]
    9. Taylor expanded in x around 0 25.9%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 14: 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.0%

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

      \[\leadsto \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
  3. Simplified90.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 75.0%

    \[\leadsto \frac{x + \color{blue}{\frac{y}{t}}}{x + 1} \]
  6. Taylor expanded in x around inf 56.0%

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

Developer Target 1: 99.5% 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 2024137 
(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)))