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

Percentage Accurate: 89.3% → 97.1%
Time: 17.6s
Alternatives: 17
Speedup: 0.3×

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 17 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.3% accurate, 1.0× speedup?

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

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

Alternative 1: 97.1% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{x + 1}\\ t_2 := \mathsf{fma}\left(t, z, -x\right)\\ \left(t\_1 + \frac{y}{x + 1} \cdot \frac{z}{t\_2}\right) - \frac{t\_1}{t\_2} \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ x (+ x 1.0))) (t_2 (fma t z (- x))))
   (- (+ t_1 (* (/ y (+ x 1.0)) (/ z t_2))) (/ t_1 t_2))))
double code(double x, double y, double z, double t) {
	double t_1 = x / (x + 1.0);
	double t_2 = fma(t, z, -x);
	return (t_1 + ((y / (x + 1.0)) * (z / t_2))) - (t_1 / t_2);
}
function code(x, y, z, t)
	t_1 = Float64(x / Float64(x + 1.0))
	t_2 = fma(t, z, Float64(-x))
	return Float64(Float64(t_1 + Float64(Float64(y / Float64(x + 1.0)) * Float64(z / t_2))) - Float64(t_1 / t_2))
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * z + (-x)), $MachinePrecision]}, N[(N[(t$95$1 + N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(z / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 / t$95$2), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{x}{x + 1}\\
t_2 := \mathsf{fma}\left(t, z, -x\right)\\
\left(t\_1 + \frac{y}{x + 1} \cdot \frac{z}{t\_2}\right) - \frac{t\_1}{t\_2}
\end{array}
\end{array}
Derivation
  1. Initial program 91.4%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(\frac{x}{x + 1} + \frac{y}{x + 1} \cdot \frac{z}{\mathsf{fma}\left(t, z, -x\right)}\right) - \frac{\frac{x}{x + 1}}{\mathsf{fma}\left(t, z, -x\right)} \]
  9. Add Preprocessing

Alternative 2: 96.5% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+271}:\\
\;\;\;\;t\_2\\

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


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

    1. Initial program 82.9%

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{x + 1}{x + \frac{y \cdot z - x}{z \cdot t - x}}}} \]
      2. associate-/r/83.0%

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

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

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

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

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

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

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

    if -2e4 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 1.99999999999999991e271

    1. Initial program 98.7%

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

    if 1.99999999999999991e271 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1))

    1. Initial program 38.3%

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

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

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

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

Alternative 3: 80.4% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

    if -1.55000000000000002e-54 < x < 7.19999999999999977e-155

    1. Initial program 94.1%

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

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

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

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

    if 7.19999999999999977e-155 < x

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

        \[\leadsto \color{blue}{\frac{1}{\frac{x + 1}{x + \frac{y \cdot z - x}{z \cdot t - x}}}} \]
      2. associate-/r/96.7%

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

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

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

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

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

Alternative 4: 79.8% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

    if -9.99999999999999995e-56 < x < 2.8499999999999998e-27

    1. Initial program 95.4%

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

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

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

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

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

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

    if 2.8499999999999998e-27 < x

    1. Initial program 95.5%

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

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

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

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

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

Alternative 5: 80.6% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

    if -9.5000000000000006e-55 < x < 1.5000000000000001e-29

    1. Initial program 95.4%

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

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

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

    if 1.5000000000000001e-29 < x

    1. Initial program 95.5%

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

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

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

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

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

Alternative 6: 79.5% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.25000000000000008e-153 or 3.14999999999999983e-83 < z

    1. Initial program 87.5%

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

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

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

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

    if -1.25000000000000008e-153 < z < 3.14999999999999983e-83

    1. Initial program 99.9%

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

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

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

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

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

Alternative 7: 82.2% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.6 \cdot 10^{-40} \lor \neg \left(t \leq 1.15 \cdot 10^{-11}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.6e-40 or 1.15000000000000007e-11 < t

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

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

    if -4.6e-40 < t < 1.15000000000000007e-11

    1. Initial program 94.2%

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 80.7% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

    if -4.60000000000000023e-55 < x < 1.5000000000000001e-29

    1. Initial program 95.4%

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

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

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

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

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

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

    if 1.5000000000000001e-29 < x

    1. Initial program 95.5%

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

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

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

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

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

Alternative 9: 67.1% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;x \leq -7 \cdot 10^{-143} \lor \neg \left(x \leq 1.7 \cdot 10^{-25}\right):\\
\;\;\;\;\frac{x}{x + 1}\\

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


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

    1. Initial program 81.5%

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{x + 1}{x + \frac{y \cdot z - x}{z \cdot t - x}}}} \]
      2. associate-/r/81.4%

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

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

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

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

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

    if -1.9000000000000001e-56 < x < -7.00000000000000011e-143 or 1.70000000000000001e-25 < x

    1. Initial program 96.2%

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

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

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

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

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

    if -7.00000000000000011e-143 < x < 1.70000000000000001e-25

    1. Initial program 94.8%

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

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

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

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

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

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

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

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

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

Alternative 10: 78.1% accurate, 0.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.59999999999999993e-56 or 1.4500000000000001e44 < 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 z around 0 85.8%

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

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

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

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

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

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

    if -1.59999999999999993e-56 < x < 1.4500000000000001e44

    1. Initial program 95.7%

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

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

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

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

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

Alternative 11: 71.2% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 82.8%

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{x + 1}{x + \frac{y \cdot z - x}{z \cdot t - x}}}} \]
      2. associate-/r/82.8%

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

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

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

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

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

    if -1.52e-18 < x < 8.50000000000000033e-27

    1. Initial program 93.5%

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{x + 1}{x + \frac{y \cdot z - x}{z \cdot t - x}}}} \]
      2. associate-/r/93.5%

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

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

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

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

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

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

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

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

    if 8.50000000000000033e-27 < x

    1. Initial program 95.5%

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

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

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

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

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

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

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

Alternative 12: 76.9% accurate, 0.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.35e-56 or 1.49999999999999987e-4 < x

    1. Initial program 88.0%

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{x + 1}{x + \frac{y \cdot z - x}{z \cdot t - x}}}} \]
      2. associate-/r/87.9%

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

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

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

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

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

    if -2.35e-56 < x < 1.49999999999999987e-4

    1. Initial program 95.4%

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

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

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

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

Alternative 13: 77.8% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 83.3%

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{x + 1}{x + \frac{y \cdot z - x}{z \cdot t - x}}}} \]
      2. associate-/r/83.3%

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

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

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

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

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

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

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

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

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

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

    if -1.35e-20 < x < 8.80000000000000031e-4

    1. Initial program 93.5%

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

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

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

    if 8.80000000000000031e-4 < x

    1. Initial program 95.4%

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{x + 1}{x + \frac{y \cdot z - x}{z \cdot t - x}}}} \]
      2. associate-/r/95.2%

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

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

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

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

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

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

Alternative 14: 61.3% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{-23} \lor \neg \left(t \leq 0.038\right):\\
\;\;\;\;\frac{x}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -9.50000000000000058e-23 or 0.0379999999999999991 < t

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

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

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

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

    if -9.50000000000000058e-23 < t < 0.0379999999999999991

    1. Initial program 94.2%

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{x + 1}{x + \frac{y \cdot z - x}{z \cdot t - x}}}} \]
      2. associate-/r/94.2%

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

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

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

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

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

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

Alternative 15: 61.3% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;t \leq 9.5 \cdot 10^{-6}:\\
\;\;\;\;1\\

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


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

    1. Initial program 91.5%

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

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

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

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

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

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

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

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

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

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

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

    if -1.70000000000000001e-25 < t < 9.5000000000000005e-6

    1. Initial program 94.2%

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{x + 1}{x + \frac{y \cdot z - x}{z \cdot t - x}}}} \]
      2. associate-/r/94.2%

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

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

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

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

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

    if 9.5000000000000005e-6 < t

    1. Initial program 85.6%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.7 \cdot 10^{-25}:\\ \;\;\;\;\frac{1}{\frac{x + 1}{x}}\\ \mathbf{elif}\;t \leq 9.5 \cdot 10^{-6}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 55.8% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;x \leq 4.8 \cdot 10^{-5}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.0000000000000001e-56 or 4.8000000000000001e-5 < x

    1. Initial program 88.0%

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{x + 1}{x + \frac{y \cdot z - x}{z \cdot t - x}}}} \]
      2. associate-/r/87.9%

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

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

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

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

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

    if -2.0000000000000001e-56 < x < 4.8000000000000001e-5

    1. Initial program 95.4%

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

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

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

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

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

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification56.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{-56}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{-5}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 52.9% 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 91.4%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{x + 1}{x + \frac{y \cdot z - x}{z \cdot t - x}}}} \]
    2. associate-/r/91.4%

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

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

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

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

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

    \[\leadsto 1 \]
  10. Add Preprocessing

Developer target: 99.5% accurate, 0.8× speedup?

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

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

Reproduce

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

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

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