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

Percentage Accurate: 89.1% → 98.9%
Time: 12.9s
Alternatives: 9
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 9 alternatives:

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

Initial Program: 89.1% accurate, 1.0× speedup?

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

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

Alternative 1: 98.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{x + 1}\\ t_2 := x - z \cdot t\\ \mathbf{if}\;\frac{x - \frac{y \cdot z - x}{t\_2}}{x + 1} \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{\frac{z}{x + 1}}{z \cdot t - x}, t\_1\right) + \frac{t\_1}{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 (/ x (+ x 1.0))) (t_2 (- x (* z t))))
   (if (<= (/ (- x (/ (- (* y z) x) t_2)) (+ x 1.0)) INFINITY)
     (+ (fma y (/ (/ z (+ x 1.0)) (- (* z t) x)) t_1) (/ t_1 t_2))
     (/ (+ x (/ y t)) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
	double t_1 = x / (x + 1.0);
	double t_2 = x - (z * t);
	double tmp;
	if (((x - (((y * z) - x) / t_2)) / (x + 1.0)) <= ((double) INFINITY)) {
		tmp = fma(y, ((z / (x + 1.0)) / ((z * t) - x)), t_1) + (t_1 / t_2);
	} else {
		tmp = (x + (y / t)) / (x + 1.0);
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(x / Float64(x + 1.0))
	t_2 = Float64(x - Float64(z * t))
	tmp = 0.0
	if (Float64(Float64(x - Float64(Float64(Float64(y * z) - x) / t_2)) / Float64(x + 1.0)) <= Inf)
		tmp = Float64(fma(y, Float64(Float64(z / Float64(x + 1.0)) / Float64(Float64(z * t) - x)), t_1) + Float64(t_1 / t_2));
	else
		tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0));
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(x - N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(y * N[(N[(z / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(t$95$1 / t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{x}{x + 1}\\
t_2 := x - z \cdot t\\
\mathbf{if}\;\frac{x - \frac{y \cdot z - x}{t\_2}}{x + 1} \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{\frac{z}{x + 1}}{z \cdot t - x}, t\_1\right) + \frac{t\_1}{t\_2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < +inf.0

    1. Initial program 92.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if +inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 0.0%

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

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

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

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

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

Alternative 2: 96.6% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+304}:\\
\;\;\;\;t\_1\\

\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 #s(literal 1 binary64))) < -1e114

    1. Initial program 58.8%

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

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

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

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

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

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

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

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

    if -1e114 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 4.9999999999999997e304

    1. Initial program 98.9%

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

    if 4.9999999999999997e304 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 28.1%

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

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

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

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

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

Alternative 3: 65.9% accurate, 0.7× speedup?

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

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

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

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

\mathbf{elif}\;x \leq 1.8 \cdot 10^{-84}:\\
\;\;\;\;\frac{y \cdot z}{-x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -7.00000000000000032e-103 or 1.80000000000000002e-84 < x

    1. Initial program 87.8%

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

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

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

      \[\leadsto \frac{x + \color{blue}{\frac{y}{t}}}{x + 1} \]
    6. Taylor expanded in x around inf 74.5%

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

    if -7.00000000000000032e-103 < x < 1.3200000000000001e-157

    1. Initial program 88.2%

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

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

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

      \[\leadsto \frac{x + \color{blue}{\frac{y}{t}}}{x + 1} \]
    6. Taylor expanded in x around 0 58.7%

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

    if 1.3200000000000001e-157 < x < 1.55000000000000007e-105

    1. Initial program 99.7%

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

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

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

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

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

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

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

    if 1.55000000000000007e-105 < x < 1.80000000000000002e-84

    1. Initial program 75.9%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7 \cdot 10^{-103}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 1.32 \cdot 10^{-157}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{elif}\;x \leq 1.55 \cdot 10^{-105}:\\ \;\;\;\;x \cdot \left(1 + \frac{-1}{z \cdot t}\right)\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{-84}:\\ \;\;\;\;\frac{y \cdot z}{-x}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 81.1% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.8499999999999999e-52 or 3.7e-16 < z

    1. Initial program 78.1%

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

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

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

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

    if -1.8499999999999999e-52 < z < 3.7e-16

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x - \frac{1}{\frac{z \cdot t}{x} + \color{blue}{-1}}}{x + 1} \]
    11. Simplified81.2%

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

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

Alternative 5: 81.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.22 \cdot 10^{-51} \lor \neg \left(z \leq 3.1 \cdot 10^{-16}\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.22e-51) (not (<= z 3.1e-16)))
   (/ (+ 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.22e-51) || !(z <= 3.1e-16)) {
		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.22d-51)) .or. (.not. (z <= 3.1d-16))) 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.22e-51) || !(z <= 3.1e-16)) {
		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.22e-51) or not (z <= 3.1e-16):
		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.22e-51) || !(z <= 3.1e-16))
		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.22e-51) || ~((z <= 3.1e-16)))
		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.22e-51], N[Not[LessEqual[z, 3.1e-16]], $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.22 \cdot 10^{-51} \lor \neg \left(z \leq 3.1 \cdot 10^{-16}\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.21999999999999998e-51 or 3.1000000000000001e-16 < z

    1. Initial program 78.1%

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

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

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

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

    if -1.21999999999999998e-51 < z < 3.1000000000000001e-16

    1. Initial program 99.8%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.22 \cdot 10^{-51} \lor \neg \left(z \leq 3.1 \cdot 10^{-16}\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 6: 75.9% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.4 \cdot 10^{-53} \lor \neg \left(z \leq 8.4 \cdot 10^{-72}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7.39999999999999965e-53 or 8.4e-72 < z

    1. Initial program 80.3%

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

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

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

    if -7.39999999999999965e-53 < z < 8.4e-72

    1. Initial program 99.8%

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

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

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

      \[\leadsto \frac{x + \color{blue}{\frac{y}{t}}}{x + 1} \]
    6. Taylor expanded in x around inf 69.6%

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

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

Alternative 7: 66.7% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.9500000000000001e-103 or 4.5999999999999996e-90 < 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. Taylor expanded in z around inf 62.3%

      \[\leadsto \frac{x + \color{blue}{\frac{y}{t}}}{x + 1} \]
    6. Taylor expanded in x around inf 73.7%

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

    if -1.9500000000000001e-103 < x < 4.5999999999999996e-90

    1. Initial program 89.3%

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

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

      \[\leadsto \frac{x + \color{blue}{\frac{y}{t}}}{x + 1} \]
    6. Taylor expanded in x around 0 55.4%

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

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

Alternative 8: 54.9% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;x \leq 1.05 \cdot 10^{-101}:\\
\;\;\;\;x\\

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


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

    1. Initial program 88.1%

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

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

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

      \[\leadsto \frac{x + \color{blue}{\frac{y}{t}}}{x + 1} \]
    6. Taylor expanded in x around inf 72.8%

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

    if -1.65e-110 < x < 1.05000000000000008e-101

    1. Initial program 89.1%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.65 \cdot 10^{-110}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-101}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 53.6% accurate, 17.0× speedup?

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

\\
1
\end{array}
Derivation
  1. Initial program 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 68.1%

    \[\leadsto \frac{x + \color{blue}{\frac{y}{t}}}{x + 1} \]
  6. Taylor expanded in x around inf 51.9%

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

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

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

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