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

Percentage Accurate: 88.7% → 97.8%
Time: 16.0s
Alternatives: 11
Speedup: 0.7×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 88.7% accurate, 1.0× speedup?

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

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

Alternative 1: 97.8% accurate, 0.6× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.90000000000000013e-36 or 6.20000000000000031e-53 < z

    1. Initial program 78.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.90000000000000013e-36 < z < 6.20000000000000031e-53

    1. Initial program 99.9%

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

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

Alternative 2: 67.4% accurate, 0.6× speedup?

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

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

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

\mathbf{elif}\;x \leq 2 \cdot 10^{-32}:\\
\;\;\;\;1 - z \cdot \frac{y}{x}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -6.60000000000000001e-17

    1. Initial program 88.7%

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

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

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

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

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

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

    if -6.60000000000000001e-17 < x < 4.50000000000000009e-90 or 2.00000000000000011e-32 < x < 5.1999999999999999e-20

    1. Initial program 87.5%

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

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

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

      \[\leadsto \frac{y \cdot z}{\color{blue}{t \cdot z}} \]
    7. Step-by-step derivation
      1. times-frac52.0%

        \[\leadsto \color{blue}{\frac{y}{t} \cdot \frac{z}{z}} \]
      2. pow152.0%

        \[\leadsto \frac{y}{t} \cdot \frac{\color{blue}{{z}^{1}}}{z} \]
      3. pow152.0%

        \[\leadsto \frac{y}{t} \cdot \frac{{z}^{1}}{\color{blue}{{z}^{1}}} \]
      4. pow-div52.0%

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

        \[\leadsto \frac{y}{t} \cdot {z}^{\color{blue}{0}} \]
      6. metadata-eval52.0%

        \[\leadsto \frac{y}{t} \cdot \color{blue}{1} \]
    8. Applied egg-rr52.0%

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

    if 4.50000000000000009e-90 < x < 2.00000000000000011e-32

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

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

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

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

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

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

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

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

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

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

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

    if 5.1999999999999999e-20 < x

    1. Initial program 84.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{\color{blue}{1 + x}}{x}} \]
      3. inv-pow85.6%

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

        \[\leadsto {\left(\frac{\color{blue}{x + 1}}{x}\right)}^{-1} \]
    9. Applied egg-rr85.6%

      \[\leadsto \color{blue}{{\left(\frac{x + 1}{x}\right)}^{-1}} \]
    10. Step-by-step derivation
      1. unpow-185.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.6 \cdot 10^{-17}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{-90}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{elif}\;x \leq 2 \cdot 10^{-32}:\\ \;\;\;\;1 - z \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{-20}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 + \frac{1}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 67.3% accurate, 0.6× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.1400000000000001e-14

    1. Initial program 88.7%

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

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

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

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

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

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

    if -1.1400000000000001e-14 < x < 1.14999999999999993e-88 or 1.35000000000000008e-37 < x < 3.3999999999999997e-20

    1. Initial program 87.5%

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

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

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

      \[\leadsto \frac{y \cdot z}{\color{blue}{t \cdot z}} \]
    7. Step-by-step derivation
      1. times-frac52.0%

        \[\leadsto \color{blue}{\frac{y}{t} \cdot \frac{z}{z}} \]
      2. pow152.0%

        \[\leadsto \frac{y}{t} \cdot \frac{\color{blue}{{z}^{1}}}{z} \]
      3. pow152.0%

        \[\leadsto \frac{y}{t} \cdot \frac{{z}^{1}}{\color{blue}{{z}^{1}}} \]
      4. pow-div52.0%

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

        \[\leadsto \frac{y}{t} \cdot {z}^{\color{blue}{0}} \]
      6. metadata-eval52.0%

        \[\leadsto \frac{y}{t} \cdot \color{blue}{1} \]
    8. Applied egg-rr52.0%

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

    if 1.14999999999999993e-88 < x < 1.35000000000000008e-37

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

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

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

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

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

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

    if 3.3999999999999997e-20 < x

    1. Initial program 84.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{\color{blue}{1 + x}}{x}} \]
      3. inv-pow85.6%

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

        \[\leadsto {\left(\frac{\color{blue}{x + 1}}{x}\right)}^{-1} \]
    9. Applied egg-rr85.6%

      \[\leadsto \color{blue}{{\left(\frac{x + 1}{x}\right)}^{-1}} \]
    10. Step-by-step derivation
      1. unpow-185.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.14 \cdot 10^{-14}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{-88}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{-37}:\\ \;\;\;\;1 + z \cdot \frac{t - y}{x}\\ \mathbf{elif}\;x \leq 3.4 \cdot 10^{-20}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 + \frac{1}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 90.3% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.7999999999999999e-153 or 4.39999999999999964e-217 < z

    1. Initial program 84.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.7999999999999999e-153 < z < 4.39999999999999964e-217

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

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

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

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

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

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

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

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

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

Alternative 5: 89.8% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7.20000000000000025e-83 or 9.50000000000000062e-220 < z

    1. Initial program 83.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.20000000000000025e-83 < z < 9.50000000000000062e-220

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

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

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

Alternative 6: 76.4% accurate, 0.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.10000000000000017e35 or 3e5 < 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 y around inf 87.7%

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

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

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

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

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

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

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

    if -5.10000000000000017e35 < x < 3e5

    1. Initial program 86.1%

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

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

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

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

Alternative 7: 76.2% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 91.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x - \color{blue}{\frac{y}{\frac{x}{z}}}}{1 + x} \]
      4. +-commutative97.8%

        \[\leadsto \frac{x - \frac{y}{\frac{x}{z}}}{\color{blue}{x + 1}} \]
    10. Simplified97.8%

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

    if -2.79999999999999995e81 < x < 2.7e5

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

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

    if 2.7e5 < x

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{1} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification80.4%

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

Alternative 8: 66.7% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 88.7%

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

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

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

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

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

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

    if -6.29999999999999982e-15 < x < 8.79999999999999943e-82

    1. Initial program 87.3%

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

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

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

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

      \[\leadsto \frac{y \cdot z}{\color{blue}{t \cdot z}} \]
    7. Step-by-step derivation
      1. times-frac52.0%

        \[\leadsto \color{blue}{\frac{y}{t} \cdot \frac{z}{z}} \]
      2. pow152.0%

        \[\leadsto \frac{y}{t} \cdot \frac{\color{blue}{{z}^{1}}}{z} \]
      3. pow152.0%

        \[\leadsto \frac{y}{t} \cdot \frac{{z}^{1}}{\color{blue}{{z}^{1}}} \]
      4. pow-div52.0%

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

        \[\leadsto \frac{y}{t} \cdot {z}^{\color{blue}{0}} \]
      6. metadata-eval52.0%

        \[\leadsto \frac{y}{t} \cdot \color{blue}{1} \]
    8. Applied egg-rr52.0%

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

    if 8.79999999999999943e-82 < x

    1. Initial program 85.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{x + 1}{x}}} \]
      2. +-commutative78.2%

        \[\leadsto \frac{1}{\frac{\color{blue}{1 + x}}{x}} \]
      3. inv-pow78.2%

        \[\leadsto \color{blue}{{\left(\frac{1 + x}{x}\right)}^{-1}} \]
      4. +-commutative78.2%

        \[\leadsto {\left(\frac{\color{blue}{x + 1}}{x}\right)}^{-1} \]
    9. Applied egg-rr78.2%

      \[\leadsto \color{blue}{{\left(\frac{x + 1}{x}\right)}^{-1}} \]
    10. Step-by-step derivation
      1. unpow-178.2%

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

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

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

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

Alternative 9: 66.8% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-17} \lor \neg \left(x \leq 2.55 \cdot 10^{-82}\right):\\
\;\;\;\;\frac{x}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.1999999999999999e-17 or 2.54999999999999996e-82 < x

    1. Initial program 87.2%

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

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

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

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

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

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

    if -7.1999999999999999e-17 < x < 2.54999999999999996e-82

    1. Initial program 87.3%

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

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

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

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

      \[\leadsto \frac{y \cdot z}{\color{blue}{t \cdot z}} \]
    7. Step-by-step derivation
      1. times-frac52.0%

        \[\leadsto \color{blue}{\frac{y}{t} \cdot \frac{z}{z}} \]
      2. pow152.0%

        \[\leadsto \frac{y}{t} \cdot \frac{\color{blue}{{z}^{1}}}{z} \]
      3. pow152.0%

        \[\leadsto \frac{y}{t} \cdot \frac{{z}^{1}}{\color{blue}{{z}^{1}}} \]
      4. pow-div52.0%

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

        \[\leadsto \frac{y}{t} \cdot {z}^{\color{blue}{0}} \]
      6. metadata-eval52.0%

        \[\leadsto \frac{y}{t} \cdot \color{blue}{1} \]
    8. Applied egg-rr52.0%

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

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

Alternative 10: 66.4% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;x \leq 0.18:\\
\;\;\;\;\frac{y}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.65e-22 or 0.17999999999999999 < x

    1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

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

    if -1.65e-22 < x < 0.17999999999999999

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

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

      \[\leadsto \frac{y \cdot z}{\color{blue}{t \cdot z}} \]
    7. Step-by-step derivation
      1. times-frac48.0%

        \[\leadsto \color{blue}{\frac{y}{t} \cdot \frac{z}{z}} \]
      2. pow148.0%

        \[\leadsto \frac{y}{t} \cdot \frac{\color{blue}{{z}^{1}}}{z} \]
      3. pow148.0%

        \[\leadsto \frac{y}{t} \cdot \frac{{z}^{1}}{\color{blue}{{z}^{1}}} \]
      4. pow-div48.0%

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

        \[\leadsto \frac{y}{t} \cdot {z}^{\color{blue}{0}} \]
      6. metadata-eval48.0%

        \[\leadsto \frac{y}{t} \cdot \color{blue}{1} \]
    8. Applied egg-rr48.0%

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

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

Alternative 11: 53.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 87.2%

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

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

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

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

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

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

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

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

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

    \[\leadsto 1 \]
  10. Add Preprocessing

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

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

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