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

Percentage Accurate: 89.5% → 95.3%
Time: 13.8s
Alternatives: 11
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 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.5% 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: 95.3% accurate, 0.1× 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 -4 \cdot 10^{+18}:\\ \;\;\;\;\frac{y}{x + 1} \cdot \frac{z}{\mathsf{fma}\left(t, z, -x\right)}\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))))
   (if (<= t_1 -4e+18)
     (* (/ y (+ x 1.0)) (/ z (fma t z (- x))))
     (if (<= t_1 INFINITY) t_1 (/ (+ x (/ y t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
	double tmp;
	if (t_1 <= -4e+18) {
		tmp = (y / (x + 1.0)) * (z / fma(t, z, -x));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_1;
	} else {
		tmp = (x + (y / t)) / (x + 1.0);
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0))
	tmp = 0.0
	if (t_1 <= -4e+18)
		tmp = Float64(Float64(y / Float64(x + 1.0)) * Float64(z / fma(t, z, Float64(-x))));
	elseif (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0));
	end
	return 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, -4e+18], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(z / N[(t * z + (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+18}:\\
\;\;\;\;\frac{y}{x + 1} \cdot \frac{z}{\mathsf{fma}\left(t, z, -x\right)}\\

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -4e18

    1. Initial program 82.0%

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

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

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

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

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

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

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

    if -4e18 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < +inf.0

    1. Initial program 97.2%

      \[\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 1))

    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 simplification96.9%

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{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 1)) < +inf.0

    1. Initial program 94.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 1))

    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 2 regimes into one program.
  4. Final simplification95.0%

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

Alternative 3: 79.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{-46}:\\
\;\;\;\;1 - \frac{z \cdot \frac{y}{x}}{x + 1}\\

\mathbf{elif}\;x \leq 2.3 \cdot 10^{-69}:\\
\;\;\;\;\frac{x + \frac{y - \frac{x}{z}}{t}}{x + 1}\\

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


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

    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 0 82.1%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x + 1}{x + 1} - \frac{\frac{y}{\frac{x}{z}}}{x + 1}} \]
      2. pow187.7%

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

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

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

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

        \[\leadsto \color{blue}{1} - \frac{\frac{y}{\frac{x}{z}}}{x + 1} \]
      7. associate-/r/87.7%

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

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

    if -1.15e-46 < x < 2.3000000000000001e-69

    1. Initial program 91.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.3000000000000001e-69 < x

    1. Initial program 94.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{y}{x} \cdot \frac{z}{1 + x}} \]
      4. +-commutative88.9%

        \[\leadsto 1 - \frac{y}{x} \cdot \frac{z}{\color{blue}{x + 1}} \]
    10. Simplified88.9%

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

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

Alternative 4: 78.0% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -6.80000000000000012e-6

    1. Initial program 91.8%

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

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

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

    if -6.80000000000000012e-6 < t < 5.40000000000000009e-11

    1. Initial program 93.8%

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

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

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

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

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

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

        \[\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}{\frac{y}{\frac{x}{z}}}}{1 + x} \]
      6. +-commutative81.9%

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

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

    if 5.40000000000000009e-11 < t

    1. Initial program 92.7%

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

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

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

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

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

Alternative 5: 80.2% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.2e-5 or 2.4e-9 < t

    1. Initial program 92.1%

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

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

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

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

    if -1.2e-5 < t < 2.4e-9

    1. Initial program 93.9%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{1 + -1 \cdot \frac{y \cdot z}{x \cdot \left(1 + x\right)}} \]
    9. Step-by-step derivation
      1. mul-1-neg77.3%

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

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

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

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

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

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

Alternative 6: 79.9% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.1999999999999996e-125 or 1.84999999999999998e-77 < z

    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. Taylor expanded in z around inf 79.4%

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

    if -9.1999999999999996e-125 < z < 1.84999999999999998e-77

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

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

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

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

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

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

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

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

Alternative 7: 64.5% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 91.6%

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

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

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

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

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

    if -2.50000000000000012e-5 < t < 1.2000000000000001e99

    1. Initial program 94.0%

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

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

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

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

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

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

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

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

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

Alternative 8: 67.8% accurate, 1.1× speedup?

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

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

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

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


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

    1. Initial program 92.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.7999999999999999e-27 < x < 1.74999999999999993e-75

    1. Initial program 92.0%

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

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

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

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

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

        \[\leadsto \frac{\frac{y}{t}}{\color{blue}{x + 1}} \]
    8. Simplified40.4%

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

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

    if 1.74999999999999993e-75 < x

    1. Initial program 94.6%

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

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

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

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

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

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

Alternative 9: 66.6% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.00000000000000019e-26 or 5.8000000000000001e-128 < x

    1. Initial program 93.3%

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

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

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

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

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

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

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

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

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

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

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

    if -5.00000000000000019e-26 < x < 5.8000000000000001e-128

    1. Initial program 92.4%

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

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

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

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

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

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

        \[\leadsto \frac{\frac{y}{t}}{\color{blue}{x + 1}} \]
    8. Simplified41.4%

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

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

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

Alternative 10: 55.7% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.8 \cdot 10^{-48}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{-69}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= x -3.8e-48) 1.0 (if (<= x 3.3e-69) x 1.0)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -3.8e-48) {
		tmp = 1.0;
	} else if (x <= 3.3e-69) {
		tmp = x;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (x <= (-3.8d-48)) then
        tmp = 1.0d0
    else if (x <= 3.3d-69) then
        tmp = x
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -3.8e-48) {
		tmp = 1.0;
	} else if (x <= 3.3e-69) {
		tmp = x;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if x <= -3.8e-48:
		tmp = 1.0
	elif x <= 3.3e-69:
		tmp = x
	else:
		tmp = 1.0
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (x <= -3.8e-48)
		tmp = 1.0;
	elseif (x <= 3.3e-69)
		tmp = x;
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (x <= -3.8e-48)
		tmp = 1.0;
	elseif (x <= 3.3e-69)
		tmp = x;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.8e-48], 1.0, If[LessEqual[x, 3.3e-69], x, 1.0]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 3.3 \cdot 10^{-69}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.80000000000000002e-48 or 3.3e-69 < x

    1. Initial program 93.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.80000000000000002e-48 < x < 3.3e-69

    1. Initial program 91.9%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 - \frac{1}{t \cdot z}\right)} \]
    10. Step-by-step derivation
      1. distribute-lft-out--33.4%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \frac{1}{t \cdot z}} \]
      2. *-rgt-identity33.4%

        \[\leadsto \color{blue}{x} - x \cdot \frac{1}{t \cdot z} \]
      3. *-commutative33.4%

        \[\leadsto x - x \cdot \frac{1}{\color{blue}{z \cdot t}} \]
      4. associate-*r/33.4%

        \[\leadsto x - \color{blue}{\frac{x \cdot 1}{z \cdot t}} \]
      5. *-rgt-identity33.4%

        \[\leadsto x - \frac{\color{blue}{x}}{z \cdot t} \]
    11. Simplified33.4%

      \[\leadsto \color{blue}{x - \frac{x}{z \cdot t}} \]
    12. Taylor expanded in z around inf 23.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.8 \cdot 10^{-48}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{-69}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 52.9% 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 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 0 65.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+65.4%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{1} \]
  9. Final simplification54.9%

    \[\leadsto 1 \]
  10. 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 2024026 
(FPCore (x y z t)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, A"
  :precision binary64

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

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