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

Percentage Accurate: 89.3% → 97.6%
Time: 17.7s
Alternatives: 11
Speedup: 0.2×

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 11 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.6% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot t - x\\ t_2 := \frac{y \cdot \left(\left(\frac{x}{y} + \frac{z}{t\_1}\right) + \frac{x}{y \cdot \left(x - z \cdot t\right)}\right)}{x + 1}\\ t_3 := \frac{x + \frac{y \cdot z - x}{t\_1}}{x + 1}\\ \mathbf{if}\;t\_3 \leq -2 \cdot 10^{-297}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_3 \leq 2:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;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
         (/
          (* y (+ (+ (/ x y) (/ z t_1)) (/ x (* y (- x (* z t))))))
          (+ x 1.0)))
        (t_3 (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0))))
   (if (<= t_3 -2e-297)
     t_2
     (if (<= t_3 2.0)
       t_3
       (if (<= t_3 INFINITY) 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 = (y * (((x / y) + (z / t_1)) + (x / (y * (x - (z * t)))))) / (x + 1.0);
	double t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
	double tmp;
	if (t_3 <= -2e-297) {
		tmp = t_2;
	} else if (t_3 <= 2.0) {
		tmp = t_3;
	} else if (t_3 <= ((double) INFINITY)) {
		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 = (y * (((x / y) + (z / t_1)) + (x / (y * (x - (z * t)))))) / (x + 1.0);
	double t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
	double tmp;
	if (t_3 <= -2e-297) {
		tmp = t_2;
	} else if (t_3 <= 2.0) {
		tmp = t_3;
	} else if (t_3 <= Double.POSITIVE_INFINITY) {
		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 = (y * (((x / y) + (z / t_1)) + (x / (y * (x - (z * t)))))) / (x + 1.0)
	t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0)
	tmp = 0
	if t_3 <= -2e-297:
		tmp = t_2
	elif t_3 <= 2.0:
		tmp = t_3
	elif t_3 <= math.inf:
		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(y * Float64(Float64(Float64(x / y) + Float64(z / t_1)) + Float64(x / Float64(y * Float64(x - Float64(z * t)))))) / 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 <= -2e-297)
		tmp = t_2;
	elseif (t_3 <= 2.0)
		tmp = t_3;
	elseif (t_3 <= Inf)
		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 = (y * (((x / y) + (z / t_1)) + (x / (y * (x - (z * t)))))) / (x + 1.0);
	t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
	tmp = 0.0;
	if (t_3 <= -2e-297)
		tmp = t_2;
	elseif (t_3 <= 2.0)
		tmp = t_3;
	elseif (t_3 <= Inf)
		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[(y * N[(N[(N[(x / y), $MachinePrecision] + N[(z / t$95$1), $MachinePrecision]), $MachinePrecision] + N[(x / N[(y * N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $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, -2e-297], t$95$2, If[LessEqual[t$95$3, 2.0], t$95$3, If[LessEqual[t$95$3, Infinity], 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{y \cdot \left(\left(\frac{x}{y} + \frac{z}{t\_1}\right) + \frac{x}{y \cdot \left(x - z \cdot t\right)}\right)}{x + 1}\\
t_3 := \frac{x + \frac{y \cdot z - x}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{-297}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_3 \leq 2:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;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))) < -2.00000000000000008e-297 or 2 < (/.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 81.1%

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

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

      \[\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 -2.00000000000000008e-297 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2

    1. Initial program 99.9%

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

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

    1. Initial program 0.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq -2 \cdot 10^{-297}:\\ \;\;\;\;\frac{y \cdot \left(\left(\frac{x}{y} + \frac{z}{z \cdot t - x}\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:\\ \;\;\;\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\ \mathbf{elif}\;\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}{z \cdot t - x}\right) + \frac{x}{y \cdot \left(x - z \cdot t\right)}\right)}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 98.5% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot t - x\\ t_2 := \frac{x + y \cdot \frac{z}{t\_1}}{x + 1}\\ t_3 := \frac{x + \frac{y \cdot z - x}{t\_1}}{x + 1}\\ \mathbf{if}\;t\_3 \leq -\infty:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_3 \leq 4 \cdot 10^{+60}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;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 t_1))) (+ x 1.0)))
        (t_3 (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0))))
   (if (<= t_3 (- INFINITY))
     t_2
     (if (<= t_3 4e+60)
       t_3
       (if (<= t_3 INFINITY) 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 / t_1))) / (x + 1.0);
	double t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
	double tmp;
	if (t_3 <= -((double) INFINITY)) {
		tmp = t_2;
	} else if (t_3 <= 4e+60) {
		tmp = t_3;
	} else if (t_3 <= ((double) INFINITY)) {
		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 / t_1))) / (x + 1.0);
	double t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
	double tmp;
	if (t_3 <= -Double.POSITIVE_INFINITY) {
		tmp = t_2;
	} else if (t_3 <= 4e+60) {
		tmp = t_3;
	} else if (t_3 <= Double.POSITIVE_INFINITY) {
		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 / t_1))) / (x + 1.0)
	t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0)
	tmp = 0
	if t_3 <= -math.inf:
		tmp = t_2
	elif t_3 <= 4e+60:
		tmp = t_3
	elif t_3 <= math.inf:
		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(y * Float64(z / t_1))) / 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 <= Float64(-Inf))
		tmp = t_2;
	elseif (t_3 <= 4e+60)
		tmp = t_3;
	elseif (t_3 <= Inf)
		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 / t_1))) / (x + 1.0);
	t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
	tmp = 0.0;
	if (t_3 <= -Inf)
		tmp = t_2;
	elseif (t_3 <= 4e+60)
		tmp = t_3;
	elseif (t_3 <= Inf)
		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[(y * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $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, (-Infinity)], t$95$2, If[LessEqual[t$95$3, 4e+60], t$95$3, If[LessEqual[t$95$3, Infinity], 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 + y \cdot \frac{z}{t\_1}}{x + 1}\\
t_3 := \frac{x + \frac{y \cdot z - x}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_3 \leq 4 \cdot 10^{+60}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;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 or 3.9999999999999998e60 < (/.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 63.1%

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

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

      \[\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. div-inv63.1%

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

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

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

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

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

      \[\leadsto \frac{x + \color{blue}{y \cdot \frac{z}{t \cdot z - x}}}{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))) < 3.9999999999999998e60

    1. Initial program 99.5%

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

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

    1. Initial program 0.0%

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

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

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

    \[\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 \frac{z}{z \cdot t - x}}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 4 \cdot 10^{+60}:\\ \;\;\;\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq \infty:\\ \;\;\;\;\frac{x + y \cdot \frac{z}{z \cdot t - x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 88.0% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{-21} \lor \neg \left(y \leq 8 \cdot 10^{-63}\right):\\ \;\;\;\;\frac{x + y \cdot \frac{z}{z \cdot t - x}}{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 (<= y -7e-21) (not (<= y 8e-63)))
   (/ (+ x (* y (/ z (- (* z t) x)))) (+ x 1.0))
   (/ (+ x (/ x (- x (* z t)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -7e-21) || !(y <= 8e-63)) {
		tmp = (x + (y * (z / ((z * t) - x)))) / (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 ((y <= (-7d-21)) .or. (.not. (y <= 8d-63))) then
        tmp = (x + (y * (z / ((z * t) - x)))) / (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 ((y <= -7e-21) || !(y <= 8e-63)) {
		tmp = (x + (y * (z / ((z * t) - x)))) / (x + 1.0);
	} else {
		tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (y <= -7e-21) or not (y <= 8e-63):
		tmp = (x + (y * (z / ((z * t) - x)))) / (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 ((y <= -7e-21) || !(y <= 8e-63))
		tmp = Float64(Float64(x + Float64(y * Float64(z / Float64(Float64(z * t) - x)))) / 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 ((y <= -7e-21) || ~((y <= 8e-63)))
		tmp = (x + (y * (z / ((z * t) - x)))) / (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[y, -7e-21], N[Not[LessEqual[y, 8e-63]], $MachinePrecision]], N[(N[(x + N[(y * N[(z / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $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}\;y \leq -7 \cdot 10^{-21} \lor \neg \left(y \leq 8 \cdot 10^{-63}\right):\\
\;\;\;\;\frac{x + y \cdot \frac{z}{z \cdot t - x}}{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 y < -7.0000000000000007e-21 or 8.00000000000000053e-63 < y

    1. Initial program 83.6%

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

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

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

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

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

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

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

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

    if -7.0000000000000007e-21 < y < 8.00000000000000053e-63

    1. Initial program 99.1%

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

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

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

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

Alternative 4: 80.8% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -6.19999999999999974e-149 or 3.70000000000000005e-101 < t

    1. Initial program 90.3%

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

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

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

    if -6.19999999999999974e-149 < t < 3.70000000000000005e-101

    1. Initial program 88.0%

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

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

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

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

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

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

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

        \[\leadsto 1 + z \cdot \frac{\frac{\color{blue}{-y}}{x}}{x + 1} \]
    8. Simplified85.5%

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

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

Alternative 5: 81.6% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.5 \cdot 10^{-150} \lor \neg \left(t \leq 5.5 \cdot 10^{-101}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -6.49999999999999997e-150 or 5.49999999999999973e-101 < t

    1. Initial program 90.3%

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

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

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

    if -6.49999999999999997e-150 < t < 5.49999999999999973e-101

    1. Initial program 88.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(x + 1\right) - y \cdot \frac{z}{x}}{x + 1}} \]
    8. Step-by-step derivation
      1. div-sub85.5%

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

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

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

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(1 - 1\right)}} - \frac{y \cdot \frac{z}{x}}{x + 1} \]
      5. metadata-eval85.5%

        \[\leadsto {\left(x + 1\right)}^{\color{blue}{0}} - \frac{y \cdot \frac{z}{x}}{x + 1} \]
      6. metadata-eval85.5%

        \[\leadsto \color{blue}{1} - \frac{y \cdot \frac{z}{x}}{x + 1} \]
    9. Applied egg-rr85.5%

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

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

Alternative 6: 68.7% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{-52}:\\
\;\;\;\;1\\

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

\mathbf{elif}\;x \leq 1.3 \cdot 10^{-5}:\\
\;\;\;\;x \cdot \left(1 - x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -5.8000000000000003e-52 or 1.29999999999999992e-5 < x

    1. Initial program 88.2%

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

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

      \[\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. div-inv88.2%

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

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

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

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

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

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

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

    if -5.8000000000000003e-52 < x < 1.59999999999999993e-73

    1. Initial program 90.4%

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

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

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

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

    if 1.59999999999999993e-73 < x < 1.29999999999999992e-5

    1. Initial program 95.8%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot x\right)} \]
    9. Step-by-step derivation
      1. neg-mul-157.9%

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

        \[\leadsto x \cdot \color{blue}{\left(1 - x\right)} \]
    10. Simplified57.9%

      \[\leadsto \color{blue}{x \cdot \left(1 - x\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 7: 76.4% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.3 \cdot 10^{-104} \lor \neg \left(z \leq 1.02 \cdot 10^{-173}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.30000000000000018e-104 or 1.02000000000000006e-173 < z

    1. Initial program 86.5%

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

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

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

    if -5.30000000000000018e-104 < z < 1.02000000000000006e-173

    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 z around 0 77.6%

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

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

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

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

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

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

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

Alternative 8: 68.8% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-54}:\\
\;\;\;\;1\\

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

\mathbf{elif}\;x \leq 3 \cdot 10^{-13}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.60000000000000002e-54 or 2.99999999999999984e-13 < x

    1. Initial program 88.5%

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

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

      \[\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. div-inv88.4%

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

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

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

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

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

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

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

    if -2.60000000000000002e-54 < x < 3.40000000000000015e-75

    1. Initial program 90.4%

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

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

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

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

    if 3.40000000000000015e-75 < x < 2.99999999999999984e-13

    1. Initial program 95.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot x\right)} \]
    9. Step-by-step derivation
      1. neg-mul-157.2%

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

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

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

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

Alternative 9: 68.8% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{-54}:\\
\;\;\;\;1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -8.5e-54

    1. Initial program 85.1%

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

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

      \[\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. div-inv85.0%

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

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

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

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

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

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

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

    if -8.5e-54 < x < 3.25e-77

    1. Initial program 90.4%

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

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

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

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

    if 3.25e-77 < x

    1. Initial program 93.2%

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

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

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

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

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

Alternative 10: 56.4% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{-72}:\\
\;\;\;\;1\\

\mathbf{elif}\;x \leq 6.6 \cdot 10^{-13}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.4999999999999998e-72 or 6.6000000000000001e-13 < x

    1. Initial program 89.0%

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

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

      \[\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. div-inv89.0%

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

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

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

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

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

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

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

    if -2.4999999999999998e-72 < x < 6.6000000000000001e-13

    1. Initial program 90.8%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot x\right)} \]
    9. Step-by-step derivation
      1. neg-mul-128.9%

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

        \[\leadsto x \cdot \color{blue}{\left(1 - x\right)} \]
    10. Simplified28.9%

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

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

Alternative 11: 53.3% 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 89.7%

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

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

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

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

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

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

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

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

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

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

Developer target: 99.4% 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 2024110 
(FPCore (x y z t)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, A"
  :precision binary64

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

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