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

Percentage Accurate: 89.1% → 94.1%
Time: 14.8s
Alternatives: 10
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 10 alternatives:

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

Initial Program: 89.1% 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.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.8 \cdot 10^{+173} \lor \neg \left(z \leq 1.15 \cdot 10^{+177}\right):\\ \;\;\;\;\frac{x + \frac{y}{t}}{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 -4.8e+173) (not (<= z 1.15e+177)))
   (/ (+ x (/ y t)) (+ 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 <= -4.8e+173) || !(z <= 1.15e+177)) {
		tmp = (x + (y / t)) / (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 <= (-4.8d+173)) .or. (.not. (z <= 1.15d+177))) then
        tmp = (x + (y / t)) / (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 <= -4.8e+173) || !(z <= 1.15e+177)) {
		tmp = (x + (y / t)) / (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 <= -4.8e+173) or not (z <= 1.15e+177):
		tmp = (x + (y / t)) / (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 <= -4.8e+173) || !(z <= 1.15e+177))
		tmp = Float64(Float64(x + Float64(y / t)) / 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 <= -4.8e+173) || ~((z <= 1.15e+177)))
		tmp = (x + (y / t)) / (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, -4.8e+173], N[Not[LessEqual[z, 1.15e+177]], $MachinePrecision]], N[(N[(x + N[(y / t), $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 -4.8 \cdot 10^{+173} \lor \neg \left(z \leq 1.15 \cdot 10^{+177}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{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 < -4.7999999999999998e173 or 1.15e177 < z

    1. Initial program 57.0%

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

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

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

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

    if -4.7999999999999998e173 < z < 1.15e177

    1. Initial program 96.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.8 \cdot 10^{+173} \lor \neg \left(z \leq 1.15 \cdot 10^{+177}\right):\\ \;\;\;\;\frac{x + \frac{y}{t}}{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.5% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;x \leq -5.2 \cdot 10^{-93}:\\
\;\;\;\;\frac{1}{\frac{1}{x}}\\

\mathbf{elif}\;x \leq -6.8 \cdot 10^{-110}:\\
\;\;\;\;1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -5.5000000000000003e-8 or -5.1999999999999997e-93 < x < -6.8000000000000002e-110 or 8.9999999999999999e-63 < x

    1. Initial program 89.1%

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

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

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

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

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

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

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

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

    if -5.5000000000000003e-8 < x < -5.1999999999999997e-93

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

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

        \[\leadsto \color{blue}{{\left(\frac{x + 1}{x + \frac{y \cdot z - x}{z \cdot t - x}}\right)}^{-1}} \]
      3. fma-neg99.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-rr99.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-199.6%

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

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

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

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

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

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

    if -6.8000000000000002e-110 < x < 8.9999999999999999e-63

    1. Initial program 84.6%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{-8}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -5.2 \cdot 10^{-93}:\\ \;\;\;\;\frac{1}{\frac{1}{x}}\\ \mathbf{elif}\;x \leq -6.8 \cdot 10^{-110}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-63}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 80.4% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 88.8%

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

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

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

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

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

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

    if -3.49999999999999974e-110 < x < 6.7999999999999997e-41

    1. Initial program 85.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x + \left(\frac{y}{t} - \frac{\color{blue}{\frac{x}{z}}}{t}\right)}{x + 1} \]
      14. div-sub83.2%

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

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

    if 6.7999999999999997e-41 < x

    1. Initial program 91.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 80.3% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 88.8%

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

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

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

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

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

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

    if -3.3999999999999998e-112 < x < 1.65000000000000012e-41

    1. Initial program 85.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x + \left(\frac{y}{t} - \frac{\color{blue}{\frac{x}{z}}}{t}\right)}{x + 1} \]
      14. div-sub83.2%

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

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

    if 1.65000000000000012e-41 < x

    1. Initial program 91.7%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 82.9% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.4 \cdot 10^{-106} \lor \neg \left(t \leq 4 \cdot 10^{-89}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.39999999999999982e-106 or 4.00000000000000015e-89 < t

    1. Initial program 84.0%

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

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

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

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

    if -3.39999999999999982e-106 < t < 4.00000000000000015e-89

    1. Initial program 93.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 75.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.05 \cdot 10^{+71}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-62}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= x -2.05e+71) 1.0 (if (<= x 1.4e-62) (/ (+ x (/ y t)) (+ x 1.0)) 1.0)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -2.05e+71) {
		tmp = 1.0;
	} else if (x <= 1.4e-62) {
		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.05d+71)) then
        tmp = 1.0d0
    else if (x <= 1.4d-62) 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.05e+71) {
		tmp = 1.0;
	} else if (x <= 1.4e-62) {
		tmp = (x + (y / t)) / (x + 1.0);
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if x <= -2.05e+71:
		tmp = 1.0
	elif x <= 1.4e-62:
		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.05e+71)
		tmp = 1.0;
	elseif (x <= 1.4e-62)
		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.05e+71)
		tmp = 1.0;
	elseif (x <= 1.4e-62)
		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.05e+71], 1.0, If[LessEqual[x, 1.4e-62], 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.05 \cdot 10^{+71}:\\
\;\;\;\;1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.0500000000000001e71 or 1.40000000000000001e-62 < x

    1. Initial program 89.0%

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

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

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

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

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

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

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

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

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

    if -2.0500000000000001e71 < x < 1.40000000000000001e-62

    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 z around inf 72.9%

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

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

Alternative 7: 67.5% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.8000000000000001e-111 or 8.89999999999999988e-63 < x

    1. Initial program 90.3%

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

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

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

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

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

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

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

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

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

    if -4.8000000000000001e-111 < x < 8.89999999999999988e-63

    1. Initial program 84.6%

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

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

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

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

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

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

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

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

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

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

Alternative 8: 68.3% accurate, 1.3× speedup?

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

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

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

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


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

    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.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}} \]

    if -1.8e-59 < x < 1.02000000000000005e-62

    1. Initial program 85.8%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y}{t} + x}}{x + 1} \]
      2. div-inv72.9%

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, \frac{1}{t}, x\right)}}{x + 1} \]
    7. Applied egg-rr72.9%

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

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

    if 1.02000000000000005e-62 < x

    1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

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

Alternative 9: 2.6% 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.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-1}}{-\frac{x + 1}{x}} \]
    3. div-inv49.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{1}{-\frac{x + 1}{x}}} \]
    4. div-inv49.0%

      \[\leadsto -1 \cdot \frac{1}{-\color{blue}{\left(x + 1\right) \cdot \frac{1}{x}}} \]
    5. +-commutative49.0%

      \[\leadsto -1 \cdot \frac{1}{-\color{blue}{\left(1 + x\right)} \cdot \frac{1}{x}} \]
    6. distribute-lft-neg-in49.0%

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

      \[\leadsto -1 \cdot \frac{1}{\left(-\color{blue}{\left(x + 1\right)}\right) \cdot \frac{1}{x}} \]
    8. add-sqr-sqrt23.7%

      \[\leadsto -1 \cdot \frac{1}{\left(-\left(x + 1\right)\right) \cdot \frac{1}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}} \]
    9. sqrt-unprod13.1%

      \[\leadsto -1 \cdot \frac{1}{\left(-\left(x + 1\right)\right) \cdot \frac{1}{\color{blue}{\sqrt{x \cdot x}}}} \]
    10. sqr-neg13.1%

      \[\leadsto -1 \cdot \frac{1}{\left(-\left(x + 1\right)\right) \cdot \frac{1}{\sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)}}}} \]
    11. sqrt-unprod1.3%

      \[\leadsto -1 \cdot \frac{1}{\left(-\left(x + 1\right)\right) \cdot \frac{1}{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}} \]
    12. add-sqr-sqrt2.8%

      \[\leadsto -1 \cdot \frac{1}{\left(-\left(x + 1\right)\right) \cdot \frac{1}{\color{blue}{-x}}} \]
    13. div-inv2.8%

      \[\leadsto -1 \cdot \frac{1}{\color{blue}{\frac{-\left(x + 1\right)}{-x}}} \]
    14. frac-2neg2.8%

      \[\leadsto -1 \cdot \frac{1}{\color{blue}{\frac{x + 1}{x}}} \]
    15. +-commutative2.8%

      \[\leadsto -1 \cdot \frac{1}{\frac{\color{blue}{1 + x}}{x}} \]
    16. clear-num2.8%

      \[\leadsto -1 \cdot \color{blue}{\frac{x}{1 + x}} \]
  11. Applied egg-rr2.8%

    \[\leadsto \color{blue}{-1 \cdot \frac{x}{1 + x}} \]
  12. Step-by-step derivation
    1. associate-*r/2.8%

      \[\leadsto \color{blue}{\frac{-1 \cdot x}{1 + x}} \]
    2. mul-1-neg2.8%

      \[\leadsto \frac{\color{blue}{-x}}{1 + x} \]
    3. +-commutative2.8%

      \[\leadsto \frac{-x}{\color{blue}{x + 1}} \]
  13. Simplified2.8%

    \[\leadsto \color{blue}{\frac{-x}{x + 1}} \]
  14. Taylor expanded in x around inf 2.8%

    \[\leadsto \color{blue}{-1} \]
  15. Final simplification2.8%

    \[\leadsto -1 \]
  16. Add Preprocessing

Alternative 10: 53.3% 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.7%

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

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

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

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

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

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

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

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

    \[\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 2024034 
(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)))