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

Percentage Accurate: 89.7% → 96.9%
Time: 12.2s
Alternatives: 10
Speedup: 0.4×

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

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot t - x\\ t_2 := \frac{x - \frac{x - y \cdot z}{t\_1}}{x + 1}\\ \mathbf{if}\;t\_2 \leq -\infty \lor \neg \left(t\_2 \leq 4 \cdot 10^{+237}\right):\\ \;\;\;\;\frac{y \cdot \left(\left(\frac{x}{y} + \frac{z}{t\_1}\right) - \frac{x}{y \cdot t\_1}\right)}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (* z t) x)) (t_2 (/ (- x (/ (- x (* y z)) t_1)) (+ x 1.0))))
   (if (or (<= t_2 (- INFINITY)) (not (<= t_2 4e+237)))
     (/ (* y (- (+ (/ x y) (/ z t_1)) (/ x (* y t_1)))) (+ x 1.0))
     t_2)))
double code(double x, double y, double z, double t) {
	double t_1 = (z * t) - x;
	double t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0);
	double tmp;
	if ((t_2 <= -((double) INFINITY)) || !(t_2 <= 4e+237)) {
		tmp = (y * (((x / y) + (z / t_1)) - (x / (y * t_1)))) / (x + 1.0);
	} else {
		tmp = t_2;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = (z * t) - x;
	double t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0);
	double tmp;
	if ((t_2 <= -Double.POSITIVE_INFINITY) || !(t_2 <= 4e+237)) {
		tmp = (y * (((x / y) + (z / t_1)) - (x / (y * t_1)))) / (x + 1.0);
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (z * t) - x
	t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0)
	tmp = 0
	if (t_2 <= -math.inf) or not (t_2 <= 4e+237):
		tmp = (y * (((x / y) + (z / t_1)) - (x / (y * t_1)))) / (x + 1.0)
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(z * t) - x)
	t_2 = Float64(Float64(x - Float64(Float64(x - Float64(y * z)) / t_1)) / Float64(x + 1.0))
	tmp = 0.0
	if ((t_2 <= Float64(-Inf)) || !(t_2 <= 4e+237))
		tmp = Float64(Float64(y * Float64(Float64(Float64(x / y) + Float64(z / t_1)) - Float64(x / Float64(y * t_1)))) / Float64(x + 1.0));
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * t) - x;
	t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0);
	tmp = 0.0;
	if ((t_2 <= -Inf) || ~((t_2 <= 4e+237)))
		tmp = (y * (((x / y) + (z / t_1)) - (x / (y * t_1)))) / (x + 1.0);
	else
		tmp = t_2;
	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[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$2, (-Infinity)], N[Not[LessEqual[t$95$2, 4e+237]], $MachinePrecision]], N[(N[(y * N[(N[(N[(x / y), $MachinePrecision] + N[(z / t$95$1), $MachinePrecision]), $MachinePrecision] - N[(x / N[(y * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], t$95$2]]]
\begin{array}{l}

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

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


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

    1. Initial program 39.9%

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

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

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

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

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

    1. Initial program 99.0%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification97.3%

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

Alternative 2: 94.1% accurate, 0.4× speedup?

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

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

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


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

    1. Initial program 96.2%

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

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

    1. Initial program 40.3%

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

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

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

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

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

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

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

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

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

Alternative 3: 94.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x - \frac{x - y \cdot z}{z \cdot t - x}}{x + 1}\\ \mathbf{if}\;t\_1 \leq 5 \cdot 10^{+208}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y - \frac{x}{z}}{t}}{x + 1}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (- x (/ (- x (* y z)) (- (* z t) x))) (+ x 1.0))))
   (if (<= t_1 5e+208) t_1 (/ (+ x (/ (- y (/ x z)) t)) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
	double t_1 = (x - ((x - (y * z)) / ((z * t) - x))) / (x + 1.0);
	double tmp;
	if (t_1 <= 5e+208) {
		tmp = t_1;
	} else {
		tmp = (x + ((y - (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) :: tmp
    t_1 = (x - ((x - (y * z)) / ((z * t) - x))) / (x + 1.0d0)
    if (t_1 <= 5d+208) then
        tmp = t_1
    else
        tmp = (x + ((y - (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 - ((x - (y * z)) / ((z * t) - x))) / (x + 1.0);
	double tmp;
	if (t_1 <= 5e+208) {
		tmp = t_1;
	} else {
		tmp = (x + ((y - (x / z)) / t)) / (x + 1.0);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x - ((x - (y * z)) / ((z * t) - x))) / (x + 1.0)
	tmp = 0
	if t_1 <= 5e+208:
		tmp = t_1
	else:
		tmp = (x + ((y - (x / z)) / t)) / (x + 1.0)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x - Float64(Float64(x - Float64(y * z)) / Float64(Float64(z * t) - x))) / Float64(x + 1.0))
	tmp = 0.0
	if (t_1 <= 5e+208)
		tmp = t_1;
	else
		tmp = Float64(Float64(x + Float64(Float64(y - Float64(x / z)) / t)) / Float64(x + 1.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x - ((x - (y * z)) / ((z * t) - x))) / (x + 1.0);
	tmp = 0.0;
	if (t_1 <= 5e+208)
		tmp = t_1;
	else
		tmp = (x + ((y - (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[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+208], t$95$1, N[(N[(x + N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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


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

    1. Initial program 96.2%

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

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

    1. Initial program 40.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 82.7% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -6.2 \cdot 10^{-95} \lor \neg \left(t \leq 2.45 \cdot 10^{-54}\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 -6.2e-95) (not (<= t 2.45e-54)))
   (/ (+ 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 <= -6.2e-95) || !(t <= 2.45e-54)) {
		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 <= (-6.2d-95)) .or. (.not. (t <= 2.45d-54))) 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 <= -6.2e-95) || !(t <= 2.45e-54)) {
		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 <= -6.2e-95) or not (t <= 2.45e-54):
		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 <= -6.2e-95) || !(t <= 2.45e-54))
		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 <= -6.2e-95) || ~((t <= 2.45e-54)))
		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, -6.2e-95], N[Not[LessEqual[t, 2.45e-54]], $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 -6.2 \cdot 10^{-95} \lor \neg \left(t \leq 2.45 \cdot 10^{-54}\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 < -6.19999999999999983e-95 or 2.4500000000000001e-54 < 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 86.3%

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

    if -6.19999999999999983e-95 < t < 2.4500000000000001e-54

    1. Initial program 96.3%

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

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

      \[\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+80.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -6.2 \cdot 10^{-95} \lor \neg \left(t \leq 2.45 \cdot 10^{-54}\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 5: 79.7% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.4000000000000002e41 or 7200 < z

    1. Initial program 81.6%

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

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

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

    if -2.4000000000000002e41 < z < 7200

    1. Initial program 99.2%

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

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

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

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

Alternative 6: 77.0% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.15000000000000001e37 or 3.4e-4 < x

    1. Initial program 91.2%

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

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

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

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

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

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

    if -1.15000000000000001e37 < x < 3.4e-4

    1. Initial program 91.2%

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

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

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

Alternative 7: 66.6% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;x \leq 5.4 \cdot 10^{-8}:\\
\;\;\;\;\frac{y}{t \cdot \left(x + 1\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.8000000000000004e-103 or 5.40000000000000005e-8 < x

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

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

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

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

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

    if -4.8000000000000004e-103 < x < 5.40000000000000005e-8

    1. Initial program 93.0%

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

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

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

      \[\leadsto \color{blue}{\frac{y}{t \cdot \left(1 + x\right)}} \]
    7. Step-by-step derivation
      1. +-commutative54.0%

        \[\leadsto \frac{y}{t \cdot \color{blue}{\left(x + 1\right)}} \]
    8. Simplified54.0%

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

Alternative 8: 66.7% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.64999999999999995e-103 or 3.5000000000000002e-17 < x

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

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

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

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

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

    if -1.64999999999999995e-103 < x < 3.5000000000000002e-17

    1. Initial program 93.0%

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

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

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

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

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

Alternative 9: 54.4% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;x \leq 1.1 \cdot 10^{-138}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.5000000000000003e-102 or 1.0999999999999999e-138 < x

    1. Initial program 90.6%

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

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

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

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

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

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

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

    if -6.5000000000000003e-102 < x < 1.0999999999999999e-138

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

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

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

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

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

Alternative 10: 52.7% 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 91.2%

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

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

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

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

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

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

Developer target: 99.6% accurate, 0.8× speedup?

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

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

Reproduce

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