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

Percentage Accurate: 89.2% → 94.7%
Time: 15.6s
Alternatives: 14
Speedup: 0.6×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 89.2% 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: 94.7% accurate, 0.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.61999999999999993e165

    1. Initial program 75.4%

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

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

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

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

    if -1.61999999999999993e165 < z < 3.2000000000000001e111

    1. Initial program 98.2%

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

    if 3.2000000000000001e111 < z

    1. Initial program 68.4%

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

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

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

      \[\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. +-commutative90.1%

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

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

        \[\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. +-commutative90.1%

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

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

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

Alternative 2: 95.1% accurate, 0.4× speedup?

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

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

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


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

    1. Initial program 96.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x + \left(z \cdot y - x\right) \cdot \left(\color{blue}{\frac{1}{t}} \cdot {\left(z - \frac{x}{t}\right)}^{-1}\right)}{x + 1} \]
    11. Applied egg-rr97.0%

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

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

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

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

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

    if 5e307 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1))

    1. Initial program 18.5%

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

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

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

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

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

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

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

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

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

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

Alternative 3: 81.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -750000 \lor \neg \left(t \leq -1.8 \cdot 10^{-64} \lor \neg \left(t \leq -2.8 \cdot 10^{-115}\right) \land t \leq 3.2 \cdot 10^{-138}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -7.5e5 or -1.7999999999999999e-64 < t < -2.79999999999999987e-115 or 3.2000000000000001e-138 < t

    1. Initial program 86.9%

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

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

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

    if -7.5e5 < t < -1.7999999999999999e-64 or -2.79999999999999987e-115 < t < 3.2000000000000001e-138

    1. Initial program 96.3%

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

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in t around 0 80.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+80.2%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -750000 \lor \neg \left(t \leq -1.8 \cdot 10^{-64} \lor \neg \left(t \leq -2.8 \cdot 10^{-115}\right) \land t \leq 3.2 \cdot 10^{-138}\right):\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x + 1\right) - y \cdot \frac{z}{x}}{x + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 81.8% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;t \leq -1.45 \cdot 10^{-118} \lor \neg \left(t \leq 3.1 \cdot 10^{-139}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.3e6 or -9.50000000000000043e-64 < t < -1.4499999999999999e-118 or 3.0999999999999999e-139 < t

    1. Initial program 86.9%

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

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

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

    if -1.3e6 < t < -9.50000000000000043e-64

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

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

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

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

    if -1.4499999999999999e-118 < t < 3.0999999999999999e-139

    1. Initial program 95.5%

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

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}} \]
    4. Add Preprocessing
    5. Taylor expanded in t around 0 80.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+80.4%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1300000:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{elif}\;t \leq -9.5 \cdot 10^{-64}:\\ \;\;\;\;\frac{x + \frac{x - y \cdot z}{x}}{x + 1}\\ \mathbf{elif}\;t \leq -1.45 \cdot 10^{-118} \lor \neg \left(t \leq 3.1 \cdot 10^{-139}\right):\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x + 1\right) - y \cdot \frac{z}{x}}{x + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 94.7% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.49999999999999995e165 or 8.50000000000000025e96 < z

    1. Initial program 71.7%

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

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

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

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

    if -1.49999999999999995e165 < z < 8.50000000000000025e96

    1. Initial program 98.2%

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

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

Alternative 6: 81.6% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7.20000000000000016e-96 or 1.85000000000000008e-123 < z

    1. Initial program 84.8%

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

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

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

    if -7.20000000000000016e-96 < z < 1.85000000000000008e-123

    1. Initial program 99.9%

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

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

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

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

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

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

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

Alternative 7: 68.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := 1 + \frac{-1}{x}\\
\mathbf{if}\;x \leq -4.6 \cdot 10^{-23}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 4.8 \cdot 10^{-79}:\\
\;\;\;\;y \cdot \frac{1}{t}\\

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

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


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

    1. Initial program 88.6%

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

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

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

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

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

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

    if -4.6000000000000002e-23 < x < 4.80000000000000011e-79

    1. Initial program 92.5%

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

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

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

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

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

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

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

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

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

    if 4.80000000000000011e-79 < x < 1

    1. Initial program 78.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot x\right)} \]
    9. Step-by-step derivation
      1. *-rgt-identity59.6%

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

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

        \[\leadsto x \cdot \color{blue}{\left(1 - x \cdot 1\right)} \]
      4. *-rgt-identity59.6%

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

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

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

Alternative 8: 79.0% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7800 or 4.99999999999999977e-7 < x

    1. Initial program 89.2%

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

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

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

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

    if -7800 < x < 4.99999999999999977e-7

    1. Initial program 90.5%

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

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

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

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

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

Alternative 9: 71.4% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{-16}:\\
\;\;\;\;\frac{1}{\frac{x + 1}{x}}\\

\mathbf{elif}\;x \leq 9.8 \cdot 10^{-76}:\\
\;\;\;\;y \cdot \frac{z}{z \cdot t - x}\\

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


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

    1. Initial program 88.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.8e-16 < x < 9.79999999999999944e-76

    1. Initial program 92.6%

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

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

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

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

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

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

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

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

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

    if 9.79999999999999944e-76 < x

    1. Initial program 86.5%

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

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

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

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

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

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

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

Alternative 10: 69.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.6 \cdot 10^{-25}:\\ \;\;\;\;\frac{1}{\frac{x + 1}{x}}\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{-77}:\\ \;\;\;\;\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 -4.6e-25)
   (/ 1.0 (/ (+ x 1.0) x))
   (if (<= x 8.5e-77) (/ y (* t (+ x 1.0))) (/ x (+ x 1.0)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -4.6e-25) {
		tmp = 1.0 / ((x + 1.0) / x);
	} else if (x <= 8.5e-77) {
		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 <= (-4.6d-25)) then
        tmp = 1.0d0 / ((x + 1.0d0) / x)
    else if (x <= 8.5d-77) 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 <= -4.6e-25) {
		tmp = 1.0 / ((x + 1.0) / x);
	} else if (x <= 8.5e-77) {
		tmp = y / (t * (x + 1.0));
	} else {
		tmp = x / (x + 1.0);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if x <= -4.6e-25:
		tmp = 1.0 / ((x + 1.0) / x)
	elif x <= 8.5e-77:
		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 <= -4.6e-25)
		tmp = Float64(1.0 / Float64(Float64(x + 1.0) / x));
	elseif (x <= 8.5e-77)
		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 <= -4.6e-25)
		tmp = 1.0 / ((x + 1.0) / x);
	elseif (x <= 8.5e-77)
		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, -4.6e-25], N[(1.0 / N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.5e-77], 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 -4.6 \cdot 10^{-25}:\\
\;\;\;\;\frac{1}{\frac{x + 1}{x}}\\

\mathbf{elif}\;x \leq 8.5 \cdot 10^{-77}:\\
\;\;\;\;\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 < -4.5999999999999998e-25

    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. Step-by-step derivation
      1. clear-num88.8%

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

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

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

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

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

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

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

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

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

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

    if -4.5999999999999998e-25 < x < 8.4999999999999998e-77

    1. Initial program 92.5%

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

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

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

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

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

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

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

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

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

    if 8.4999999999999998e-77 < x

    1. Initial program 86.5%

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

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

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

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

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

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

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

Alternative 11: 69.7% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-26} \lor \neg \left(x \leq 1.05 \cdot 10^{-76}\right):\\
\;\;\;\;\frac{x}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.4499999999999999e-26 or 1.04999999999999996e-76 < x

    1. Initial program 87.6%

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

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

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

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

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

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

    if -1.4499999999999999e-26 < x < 1.04999999999999996e-76

    1. Initial program 92.5%

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

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

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

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

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

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

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

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

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

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

Alternative 12: 69.7% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;x \leq 3.7 \cdot 10^{-78}:\\
\;\;\;\;y \cdot \frac{1}{t}\\

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


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

    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. Step-by-step derivation
      1. clear-num88.8%

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

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

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

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

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

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

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

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

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

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

    if -5.80000000000000026e-28 < x < 3.70000000000000006e-78

    1. Initial program 92.5%

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

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

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

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

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

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

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

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

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

    if 3.70000000000000006e-78 < x

    1. Initial program 86.5%

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

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

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

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

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

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

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

Alternative 13: 26.2% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+188}:\\
\;\;\;\;x \cdot \left(1 - x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.7999999999999998e188

    1. Initial program 87.8%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot x\right)} \]
    9. Step-by-step derivation
      1. *-rgt-identity50.3%

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

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

        \[\leadsto x \cdot \color{blue}{\left(1 - x \cdot 1\right)} \]
      4. *-rgt-identity50.3%

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

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

    if -3.7999999999999998e188 < t

    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 y around inf 35.4%

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

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

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

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

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

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

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

Alternative 14: 12.7% accurate, 17.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
	return x;
}
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
end function
public static double code(double x, double y, double z, double t) {
	return x;
}
def code(x, y, z, t):
	return x
function code(x, y, z, t)
	return x
end
function tmp = code(x, y, z, t)
	tmp = x;
end
code[x_, y_, z_, t_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 89.9%

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

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

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

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

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

    \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot x\right)} \]
  9. Step-by-step derivation
    1. *-rgt-identity14.0%

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

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

      \[\leadsto x \cdot \color{blue}{\left(1 - x \cdot 1\right)} \]
    4. *-rgt-identity14.0%

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

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

    \[\leadsto \color{blue}{x} \]
  12. Final simplification14.8%

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

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

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