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

Percentage Accurate: 89.0% → 95.2%
Time: 12.4s
Alternatives: 14
Speedup: 0.6×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 89.0% accurate, 1.0× speedup?

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

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

Alternative 1: 95.2% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{x + 1}\\ \mathbf{if}\;z \leq -2.3 \cdot 10^{+103}:\\ \;\;\;\;t\_1 + \frac{y}{\left(x + 1\right) \cdot t}\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+134}:\\ \;\;\;\;\frac{x + \frac{\mathsf{fma}\left(z, y, -x\right)}{\mathsf{fma}\left(t, z, -x\right)}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;t\_1 + \frac{\frac{y}{x + 1} + \frac{x}{z \cdot \left(-1 - x\right)}}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ x (+ x 1.0))))
   (if (<= z -2.3e+103)
     (+ t_1 (/ y (* (+ x 1.0) t)))
     (if (<= z 1.35e+134)
       (/ (+ x (/ (fma z y (- x)) (fma t z (- x)))) (+ x 1.0))
       (+ t_1 (/ (+ (/ y (+ x 1.0)) (/ x (* z (- -1.0 x)))) t))))))
double code(double x, double y, double z, double t) {
	double t_1 = x / (x + 1.0);
	double tmp;
	if (z <= -2.3e+103) {
		tmp = t_1 + (y / ((x + 1.0) * t));
	} else if (z <= 1.35e+134) {
		tmp = (x + (fma(z, y, -x) / fma(t, z, -x))) / (x + 1.0);
	} else {
		tmp = t_1 + (((y / (x + 1.0)) + (x / (z * (-1.0 - x)))) / t);
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(x / Float64(x + 1.0))
	tmp = 0.0
	if (z <= -2.3e+103)
		tmp = Float64(t_1 + Float64(y / Float64(Float64(x + 1.0) * t)));
	elseif (z <= 1.35e+134)
		tmp = Float64(Float64(x + Float64(fma(z, y, Float64(-x)) / fma(t, z, Float64(-x)))) / Float64(x + 1.0));
	else
		tmp = Float64(t_1 + Float64(Float64(Float64(y / Float64(x + 1.0)) + Float64(x / Float64(z * Float64(-1.0 - x)))) / t));
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.3e+103], N[(t$95$1 + N[(y / N[(N[(x + 1.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.35e+134], N[(N[(x + N[(N[(z * y + (-x)), $MachinePrecision] / N[(t * z + (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(x / N[(z * N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 1.35 \cdot 10^{+134}:\\
\;\;\;\;\frac{x + \frac{\mathsf{fma}\left(z, y, -x\right)}{\mathsf{fma}\left(t, z, -x\right)}}{x + 1}\\

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


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

    1. Initial program 70.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.30000000000000008e103 < z < 1.35e134

    1. Initial program 98.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.35e134 < z

    1. Initial program 64.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 66.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{x + 1}\\ t_2 := 1 - y \cdot \frac{z}{x}\\ \mathbf{if}\;x \leq -4 \cdot 10^{-70}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -1.1 \cdot 10^{-107}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq -3.1 \cdot 10^{-218}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 2.2 \cdot 10^{-169}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{elif}\;x \leq 7.4 \cdot 10^{-72}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ x (+ x 1.0))) (t_2 (- 1.0 (* y (/ z x)))))
   (if (<= x -4e-70)
     t_1
     (if (<= x -1.1e-107)
       t_2
       (if (<= x -3.1e-218)
         t_1
         (if (<= x 2.2e-169) (/ y t) (if (<= x 7.4e-72) t_2 t_1)))))))
double code(double x, double y, double z, double t) {
	double t_1 = x / (x + 1.0);
	double t_2 = 1.0 - (y * (z / x));
	double tmp;
	if (x <= -4e-70) {
		tmp = t_1;
	} else if (x <= -1.1e-107) {
		tmp = t_2;
	} else if (x <= -3.1e-218) {
		tmp = t_1;
	} else if (x <= 2.2e-169) {
		tmp = y / t;
	} else if (x <= 7.4e-72) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x / (x + 1.0d0)
    t_2 = 1.0d0 - (y * (z / x))
    if (x <= (-4d-70)) then
        tmp = t_1
    else if (x <= (-1.1d-107)) then
        tmp = t_2
    else if (x <= (-3.1d-218)) then
        tmp = t_1
    else if (x <= 2.2d-169) then
        tmp = y / t
    else if (x <= 7.4d-72) then
        tmp = t_2
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x / (x + 1.0);
	double t_2 = 1.0 - (y * (z / x));
	double tmp;
	if (x <= -4e-70) {
		tmp = t_1;
	} else if (x <= -1.1e-107) {
		tmp = t_2;
	} else if (x <= -3.1e-218) {
		tmp = t_1;
	} else if (x <= 2.2e-169) {
		tmp = y / t;
	} else if (x <= 7.4e-72) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x / (x + 1.0)
	t_2 = 1.0 - (y * (z / x))
	tmp = 0
	if x <= -4e-70:
		tmp = t_1
	elif x <= -1.1e-107:
		tmp = t_2
	elif x <= -3.1e-218:
		tmp = t_1
	elif x <= 2.2e-169:
		tmp = y / t
	elif x <= 7.4e-72:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x / Float64(x + 1.0))
	t_2 = Float64(1.0 - Float64(y * Float64(z / x)))
	tmp = 0.0
	if (x <= -4e-70)
		tmp = t_1;
	elseif (x <= -1.1e-107)
		tmp = t_2;
	elseif (x <= -3.1e-218)
		tmp = t_1;
	elseif (x <= 2.2e-169)
		tmp = Float64(y / t);
	elseif (x <= 7.4e-72)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x / (x + 1.0);
	t_2 = 1.0 - (y * (z / x));
	tmp = 0.0;
	if (x <= -4e-70)
		tmp = t_1;
	elseif (x <= -1.1e-107)
		tmp = t_2;
	elseif (x <= -3.1e-218)
		tmp = t_1;
	elseif (x <= 2.2e-169)
		tmp = y / t;
	elseif (x <= 7.4e-72)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4e-70], t$95$1, If[LessEqual[x, -1.1e-107], t$95$2, If[LessEqual[x, -3.1e-218], t$95$1, If[LessEqual[x, 2.2e-169], N[(y / t), $MachinePrecision], If[LessEqual[x, 7.4e-72], t$95$2, t$95$1]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -1.1 \cdot 10^{-107}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq -3.1 \cdot 10^{-218}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \leq 7.4 \cdot 10^{-72}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.99999999999999998e-70 or -1.10000000000000006e-107 < x < -3.09999999999999997e-218 or 7.3999999999999997e-72 < 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 78.9%

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

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

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

    if -3.99999999999999998e-70 < x < -1.10000000000000006e-107 or 2.20000000000000007e-169 < x < 7.3999999999999997e-72

    1. Initial program 96.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.09999999999999997e-218 < x < 2.20000000000000007e-169

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

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

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

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

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

      \[\leadsto y \cdot \color{blue}{\frac{1}{t}} \]
    9. Step-by-step derivation
      1. un-div-inv61.1%

        \[\leadsto \color{blue}{\frac{y}{t}} \]
      2. *-un-lft-identity61.1%

        \[\leadsto \frac{y}{\color{blue}{1 \cdot t}} \]
      3. associate-/r*61.1%

        \[\leadsto \color{blue}{\frac{\frac{y}{1}}{t}} \]
    10. Applied egg-rr61.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{-70}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{elif}\;x \leq -1.1 \cdot 10^{-107}:\\ \;\;\;\;1 - y \cdot \frac{z}{x}\\ \mathbf{elif}\;x \leq -3.1 \cdot 10^{-218}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{elif}\;x \leq 2.2 \cdot 10^{-169}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{elif}\;x \leq 7.4 \cdot 10^{-72}:\\ \;\;\;\;1 - y \cdot \frac{z}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 81.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{-79} \lor \neg \left(t \leq 2.2 \cdot 10^{-201}\right) \land \left(t \leq 8.5 \cdot 10^{-194} \lor \neg \left(t \leq 5.2 \cdot 10^{+49}\right)\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.19999999999999988e-79 or 2.2e-201 < t < 8.5000000000000005e-194 or 5.19999999999999977e49 < t

    1. Initial program 81.3%

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

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

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

    if -3.19999999999999988e-79 < t < 2.2e-201 or 8.5000000000000005e-194 < t < 5.19999999999999977e49

    1. Initial program 96.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.2 \cdot 10^{-79} \lor \neg \left(t \leq 2.2 \cdot 10^{-201}\right) \land \left(t \leq 8.5 \cdot 10^{-194} \lor \neg \left(t \leq 5.2 \cdot 10^{+49}\right)\right):\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;1 + y \cdot \frac{\frac{z}{x}}{-1 - x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 81.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{-78}:\\
\;\;\;\;\frac{x}{x + 1} + \frac{y}{\left(x + 1\right) \cdot t}\\

\mathbf{elif}\;t \leq 2.2 \cdot 10^{-201} \lor \neg \left(t \leq 7.8 \cdot 10^{-194}\right) \land t \leq 5.2 \cdot 10^{+49}:\\
\;\;\;\;1 + y \cdot \frac{\frac{z}{x}}{-1 - x}\\

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


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

    1. Initial program 80.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8000000000000001e-78 < t < 2.2e-201 or 7.7999999999999997e-194 < t < 5.19999999999999977e49

    1. Initial program 96.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.2e-201 < t < 7.7999999999999997e-194 or 5.19999999999999977e49 < t

    1. Initial program 82.4%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.8 \cdot 10^{-78}:\\ \;\;\;\;\frac{x}{x + 1} + \frac{y}{\left(x + 1\right) \cdot t}\\ \mathbf{elif}\;t \leq 2.2 \cdot 10^{-201} \lor \neg \left(t \leq 7.8 \cdot 10^{-194}\right) \land t \leq 5.2 \cdot 10^{+49}:\\ \;\;\;\;1 + y \cdot \frac{\frac{z}{x}}{-1 - x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 95.2% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 70.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.40000000000000004e103 < z < 2.0999999999999999e136

    1. Initial program 98.3%

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

    if 2.0999999999999999e136 < z

    1. Initial program 64.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 95.1% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.40000000000000013e87 or 3.3999999999999998e50 < z

    1. Initial program 74.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.40000000000000013e87 < z < 3.3999999999999998e50

    1. Initial program 98.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 95.2% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{+102} \lor \neg \left(z \leq 3.25 \cdot 10^{+50}\right):\\
\;\;\;\;\frac{x}{x + 1} + \frac{y}{\left(x + 1\right) \cdot t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6.19999999999999973e102 or 3.2500000000000001e50 < z

    1. Initial program 72.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.19999999999999973e102 < z < 3.2500000000000001e50

    1. Initial program 98.7%

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

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

Alternative 8: 79.9% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+60} \lor \neg \left(z \leq 2.1 \cdot 10^{+24}\right):\\
\;\;\;\;\frac{x}{x + 1} + \frac{y}{\left(x + 1\right) \cdot t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.79999999999999999e60 or 2.1000000000000001e24 < z

    1. Initial program 75.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.79999999999999999e60 < z < 2.1000000000000001e24

    1. Initial program 99.2%

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

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

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

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

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

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

Alternative 9: 80.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -90000:\\
\;\;\;\;1 + y \cdot \frac{\frac{z}{x}}{-1 - x}\\

\mathbf{elif}\;x \leq 29.5:\\
\;\;\;\;\frac{x - \frac{\frac{x}{z} - y}{t}}{x + 1}\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9e4 < x < 29.5

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 29.5 < x

    1. Initial program 84.8%

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

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

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

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

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

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

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

Alternative 10: 77.9% accurate, 0.9× speedup?

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

\mathbf{elif}\;x \leq 6.5 \cdot 10^{+28}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -112000 or 6.5000000000000001e28 < x

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -112000 < x < 6.5000000000000001e28

    1. Initial program 89.5%

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

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

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

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

Alternative 11: 66.1% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{-218} \lor \neg \left(x \leq 2.9 \cdot 10^{-81}\right):\\
\;\;\;\;\frac{x}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.09999999999999997e-218 or 2.89999999999999989e-81 < x

    1. Initial program 88.2%

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

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

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

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

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

    if -3.09999999999999997e-218 < x < 2.89999999999999989e-81

    1. Initial program 89.2%

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

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

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

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

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

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

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

      \[\leadsto y \cdot \color{blue}{\frac{1}{t}} \]
    9. Step-by-step derivation
      1. un-div-inv55.0%

        \[\leadsto \color{blue}{\frac{y}{t}} \]
      2. *-un-lft-identity55.0%

        \[\leadsto \frac{y}{\color{blue}{1 \cdot t}} \]
      3. associate-/r*55.0%

        \[\leadsto \color{blue}{\frac{\frac{y}{1}}{t}} \]
    10. Applied egg-rr55.0%

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

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

Alternative 12: 65.9% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{-218} \lor \neg \left(x \leq 1.02 \cdot 10^{-115}\right):\\
\;\;\;\;\frac{x}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.09999999999999997e-218 or 1.02e-115 < x

    1. Initial program 88.4%

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

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

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

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

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

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

    if -3.09999999999999997e-218 < x < 1.02e-115

    1. Initial program 88.5%

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

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

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

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

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

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

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

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

Alternative 13: 68.0% accurate, 1.1× speedup?

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

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

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

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


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

    1. Initial program 85.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.2000000000000001e-47 < x < 1.4999999999999999e-7

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

Alternative 14: 53.5% accurate, 17.0× speedup?

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

\\
1
\end{array}
Derivation
  1. Initial program 88.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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