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

Percentage Accurate: 90.0% → 96.8%
Time: 12.2s
Alternatives: 12
Speedup: 0.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 90.0% accurate, 1.0× speedup?

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

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

Alternative 1: 96.8% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot t - x\\ t_2 := \frac{x + \frac{y \cdot z - x}{t\_1}}{x + 1}\\ t_3 := \frac{x}{x + 1}\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{+28}:\\ \;\;\;\;\frac{z}{t\_1} \cdot \frac{y}{x + 1}\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-29}:\\ \;\;\;\;\left(\frac{y}{t \cdot \left(x + 1\right)} + t\_3\right) - \frac{x}{t \cdot \left(z \cdot \left(x + 1\right)\right)}\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+226}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_3 + \frac{\frac{y}{x - -1} - \frac{\frac{x}{z}}{x + 1}}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (* z t) x))
        (t_2 (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0)))
        (t_3 (/ x (+ x 1.0))))
   (if (<= t_2 -5e+28)
     (* (/ z t_1) (/ y (+ x 1.0)))
     (if (<= t_2 5e-29)
       (- (+ (/ y (* t (+ x 1.0))) t_3) (/ x (* t (* z (+ x 1.0)))))
       (if (<= t_2 5e+226)
         t_2
         (+ t_3 (/ (- (/ y (- x -1.0)) (/ (/ x z) (+ x 1.0))) t)))))))
double code(double x, double y, double z, double t) {
	double t_1 = (z * t) - x;
	double t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
	double t_3 = x / (x + 1.0);
	double tmp;
	if (t_2 <= -5e+28) {
		tmp = (z / t_1) * (y / (x + 1.0));
	} else if (t_2 <= 5e-29) {
		tmp = ((y / (t * (x + 1.0))) + t_3) - (x / (t * (z * (x + 1.0))));
	} else if (t_2 <= 5e+226) {
		tmp = t_2;
	} else {
		tmp = t_3 + (((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) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = (z * t) - x
    t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0d0)
    t_3 = x / (x + 1.0d0)
    if (t_2 <= (-5d+28)) then
        tmp = (z / t_1) * (y / (x + 1.0d0))
    else if (t_2 <= 5d-29) then
        tmp = ((y / (t * (x + 1.0d0))) + t_3) - (x / (t * (z * (x + 1.0d0))))
    else if (t_2 <= 5d+226) then
        tmp = t_2
    else
        tmp = t_3 + (((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 = (z * t) - x;
	double t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
	double t_3 = x / (x + 1.0);
	double tmp;
	if (t_2 <= -5e+28) {
		tmp = (z / t_1) * (y / (x + 1.0));
	} else if (t_2 <= 5e-29) {
		tmp = ((y / (t * (x + 1.0))) + t_3) - (x / (t * (z * (x + 1.0))));
	} else if (t_2 <= 5e+226) {
		tmp = t_2;
	} else {
		tmp = t_3 + (((y / (x - -1.0)) - ((x / z) / (x + 1.0))) / t);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (z * t) - x
	t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0)
	t_3 = x / (x + 1.0)
	tmp = 0
	if t_2 <= -5e+28:
		tmp = (z / t_1) * (y / (x + 1.0))
	elif t_2 <= 5e-29:
		tmp = ((y / (t * (x + 1.0))) + t_3) - (x / (t * (z * (x + 1.0))))
	elif t_2 <= 5e+226:
		tmp = t_2
	else:
		tmp = t_3 + (((y / (x - -1.0)) - ((x / z) / (x + 1.0))) / t)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(z * t) - x)
	t_2 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / t_1)) / Float64(x + 1.0))
	t_3 = Float64(x / Float64(x + 1.0))
	tmp = 0.0
	if (t_2 <= -5e+28)
		tmp = Float64(Float64(z / t_1) * Float64(y / Float64(x + 1.0)));
	elseif (t_2 <= 5e-29)
		tmp = Float64(Float64(Float64(y / Float64(t * Float64(x + 1.0))) + t_3) - Float64(x / Float64(t * Float64(z * Float64(x + 1.0)))));
	elseif (t_2 <= 5e+226)
		tmp = t_2;
	else
		tmp = Float64(t_3 + Float64(Float64(Float64(y / Float64(x - -1.0)) - Float64(Float64(x / z) / Float64(x + 1.0))) / t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * t) - x;
	t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
	t_3 = x / (x + 1.0);
	tmp = 0.0;
	if (t_2 <= -5e+28)
		tmp = (z / t_1) * (y / (x + 1.0));
	elseif (t_2 <= 5e-29)
		tmp = ((y / (t * (x + 1.0))) + t_3) - (x / (t * (z * (x + 1.0))));
	elseif (t_2 <= 5e+226)
		tmp = t_2;
	else
		tmp = t_3 + (((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[(z * t), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+28], N[(N[(z / t$95$1), $MachinePrecision] * N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e-29], N[(N[(N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision] - N[(x / N[(t * N[(z * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+226], t$95$2, N[(t$95$3 + N[(N[(N[(y / N[(x - -1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x / z), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+226}:\\
\;\;\;\;t\_2\\

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


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

    1. Initial program 76.7%

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

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

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

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

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

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

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

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

    if -4.99999999999999957e28 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 4.99999999999999986e-29

    1. Initial program 92.3%

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

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

      \[\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)}} \]

    if 4.99999999999999986e-29 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 5.0000000000000005e226

    1. Initial program 99.9%

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

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

    1. Initial program 37.8%

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

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

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

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

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

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

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

        \[\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} \]
      5. sub-neg89.4%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{x + 1} - \frac{\frac{y}{-1 - x} + \color{blue}{\frac{\frac{x}{z}}{1 + x}}}{t} \]
      14. +-commutative89.4%

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

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

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

Alternative 2: 96.8% accurate, 0.2× speedup?

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

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

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-29}:\\
\;\;\;\;\frac{x + \frac{y - \frac{x}{z}}{t}}{x + 1}\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+226}:\\
\;\;\;\;t\_2\\

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


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

    1. Initial program 76.7%

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

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

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

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

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

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

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

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

    if -4.99999999999999957e28 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 4.99999999999999986e-29

    1. Initial program 92.3%

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

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

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

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

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

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

    if 4.99999999999999986e-29 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 5.0000000000000005e226

    1. Initial program 99.9%

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

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

    1. Initial program 37.8%

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

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

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

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

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

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

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

        \[\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} \]
      5. sub-neg89.4%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{x + 1} - \frac{\frac{y}{-1 - x} + \color{blue}{\frac{\frac{x}{z}}{1 + x}}}{t} \]
      14. +-commutative89.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq -5 \cdot 10^{+28}:\\ \;\;\;\;\frac{z}{z \cdot t - x} \cdot \frac{y}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 5 \cdot 10^{-29}:\\ \;\;\;\;\frac{x + \frac{y - \frac{x}{z}}{t}}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 5 \cdot 10^{+226}:\\ \;\;\;\;\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{\frac{x}{z}}{x + 1}}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 95.6% accurate, 0.2× speedup?

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

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

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-29}:\\
\;\;\;\;\frac{x + \frac{y - \frac{x}{z}}{t}}{x + 1}\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+226}:\\
\;\;\;\;t\_2\\

\mathbf{else}:\\
\;\;\;\;\frac{t + t\_3}{t}\\


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

    1. Initial program 76.7%

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

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

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

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

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

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

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

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

    if -4.99999999999999957e28 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 4.99999999999999986e-29

    1. Initial program 92.3%

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

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

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

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

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

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

    if 4.99999999999999986e-29 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 5.0000000000000005e226

    1. Initial program 99.9%

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

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

    1. Initial program 37.8%

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

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

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

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

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

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

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

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

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

Alternative 4: 79.0% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.1e-33

    1. Initial program 78.3%

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

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

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

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

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

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

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

    if -2.1e-33 < z < 2.7e17

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

    if 2.7e17 < z

    1. Initial program 77.8%

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

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

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

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

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

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

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

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

Alternative 5: 80.1% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -7.29999999999999996e-34

    1. Initial program 78.3%

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

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

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

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

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

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

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

    if -7.29999999999999996e-34 < z < 1e18

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

    if 1e18 < z

    1. Initial program 77.8%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 78.2% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;z \leq 2.7 \cdot 10^{+17}:\\
\;\;\;\;1 - y \cdot \frac{z}{x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.1e-148

    1. Initial program 82.9%

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

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

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

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

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

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

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

    if -5.1e-148 < z < 2.7e17

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{1 - \frac{y \cdot z}{x}} \]
      3. associate-/l*77.8%

        \[\leadsto 1 - \color{blue}{y \cdot \frac{z}{x}} \]
    11. Simplified77.8%

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

    if 2.7e17 < z

    1. Initial program 77.8%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 78.3% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.24999999999999986e-147 or 2.7e17 < z

    1. Initial program 81.1%

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

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

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

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

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

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

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

    if -2.24999999999999986e-147 < z < 2.7e17

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{1 - \frac{y \cdot z}{x}} \]
      3. associate-/l*77.8%

        \[\leadsto 1 - \color{blue}{y \cdot \frac{z}{x}} \]
    11. Simplified77.8%

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

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

Alternative 8: 68.1% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;x \leq 2.55 \cdot 10^{-98}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{t}\\

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


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

    1. Initial program 90.1%

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

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

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

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

    if -730 < x < 2.55000000000000011e-98

    1. Initial program 86.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{y}{\color{blue}{x + 1}}}{t} \]
    11. Simplified52.6%

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

    if 2.55000000000000011e-98 < x

    1. Initial program 88.8%

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

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

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

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

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

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

Alternative 9: 68.1% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 90.1%

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

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

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

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

    if -730 < x < 1.30000000000000007e-98

    1. Initial program 86.7%

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

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

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

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

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

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

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

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

    if 1.30000000000000007e-98 < x

    1. Initial program 88.8%

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

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

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

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

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

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

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

Alternative 10: 68.2% accurate, 1.1× speedup?

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

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

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

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


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

    1. Initial program 90.2%

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

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

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

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

    if -8.9999999999999999e-11 < x < 6.50000000000000033e-99

    1. Initial program 86.6%

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

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

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

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

    if 6.50000000000000033e-99 < x

    1. Initial program 88.8%

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

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

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

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

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

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

Alternative 11: 68.5% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.7e-10 or 1.45e-98 < x

    1. Initial program 89.4%

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

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

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

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

    if -2.7e-10 < x < 1.45e-98

    1. Initial program 86.6%

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

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

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

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

Alternative 12: 54.2% 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 88.1%

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

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

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

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

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

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

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

Reproduce

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

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

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