Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, B

Percentage Accurate: 95.6% → 99.4%
Time: 9.9s
Alternatives: 10
Speedup: 0.3×

Specification

?
\[\begin{array}{l} \\ \frac{x}{y - z \cdot t} \end{array} \]
(FPCore (x y z t) :precision binary64 (/ x (- y (* z t))))
double code(double x, double y, double z, double t) {
	return x / (y - (z * t));
}
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 * t))
end function
public static double code(double x, double y, double z, double t) {
	return x / (y - (z * t));
}
def code(x, y, z, t):
	return x / (y - (z * t))
function code(x, y, z, t)
	return Float64(x / Float64(y - Float64(z * t)))
end
function tmp = code(x, y, z, t)
	tmp = x / (y - (z * t));
end
code[x_, y_, z_, t_] := N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 95.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x}{y - z \cdot t} \end{array} \]
(FPCore (x y z t) :precision binary64 (/ x (- y (* z t))))
double code(double x, double y, double z, double t) {
	return x / (y - (z * t));
}
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 * t))
end function
public static double code(double x, double y, double z, double t) {
	return x / (y - (z * t));
}
def code(x, y, z, t):
	return x / (y - (z * t))
function code(x, y, z, t)
	return Float64(x / Float64(y - Float64(z * t)))
end
function tmp = code(x, y, z, t)
	tmp = x / (y - (z * t));
end
code[x_, y_, z_, t_] := N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 99.4% accurate, 0.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot t \leq -\infty:\\ \;\;\;\;\left|\frac{\frac{x_m}{z}}{t}\right|\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+196}:\\ \;\;\;\;\frac{x_m}{y - z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x_m}{z} \cdot \frac{\sqrt[3]{-1}}{t}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= (* z t) (- INFINITY))
    (fabs (/ (/ x_m z) t))
    (if (<= (* z t) 2e+196)
      (/ x_m (- y (* z t)))
      (* (/ x_m z) (/ (cbrt -1.0) t))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((z * t) <= -((double) INFINITY)) {
		tmp = fabs(((x_m / z) / t));
	} else if ((z * t) <= 2e+196) {
		tmp = x_m / (y - (z * t));
	} else {
		tmp = (x_m / z) * (cbrt(-1.0) / t);
	}
	return x_s * tmp;
}
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((z * t) <= -Double.POSITIVE_INFINITY) {
		tmp = Math.abs(((x_m / z) / t));
	} else if ((z * t) <= 2e+196) {
		tmp = x_m / (y - (z * t));
	} else {
		tmp = (x_m / z) * (Math.cbrt(-1.0) / t);
	}
	return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (Float64(z * t) <= Float64(-Inf))
		tmp = abs(Float64(Float64(x_m / z) / t));
	elseif (Float64(z * t) <= 2e+196)
		tmp = Float64(x_m / Float64(y - Float64(z * t)));
	else
		tmp = Float64(Float64(x_m / z) * Float64(cbrt(-1.0) / t));
	end
	return Float64(x_s * tmp)
end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], N[Abs[N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+196], N[(x$95$m / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * N[(N[Power[-1.0, 1/3], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;\left|\frac{\frac{x_m}{z}}{t}\right|\\

\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+196}:\\
\;\;\;\;\frac{x_m}{y - z \cdot t}\\

\mathbf{else}:\\
\;\;\;\;\frac{x_m}{z} \cdot \frac{\sqrt[3]{-1}}{t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -inf.0

    1. Initial program 56.1%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 56.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{t \cdot z}} \]
    4. Step-by-step derivation
      1. associate-*r/56.1%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{t \cdot z}} \]
      2. neg-mul-156.1%

        \[\leadsto \frac{\color{blue}{-x}}{t \cdot z} \]
    5. Simplified56.1%

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

        \[\leadsto \color{blue}{\frac{\frac{-x}{t}}{z}} \]
      2. add-sqr-sqrt73.2%

        \[\leadsto \color{blue}{\sqrt{\frac{\frac{-x}{t}}{z}} \cdot \sqrt{\frac{\frac{-x}{t}}{z}}} \]
      3. sqrt-unprod68.8%

        \[\leadsto \color{blue}{\sqrt{\frac{\frac{-x}{t}}{z} \cdot \frac{\frac{-x}{t}}{z}}} \]
      4. clear-num68.7%

        \[\leadsto \sqrt{\color{blue}{\frac{1}{\frac{z}{\frac{-x}{t}}}} \cdot \frac{\frac{-x}{t}}{z}} \]
      5. clear-num68.6%

        \[\leadsto \sqrt{\frac{1}{\frac{z}{\frac{-x}{t}}} \cdot \color{blue}{\frac{1}{\frac{z}{\frac{-x}{t}}}}} \]
      6. unpow-168.6%

        \[\leadsto \sqrt{\color{blue}{{\left(\frac{z}{\frac{-x}{t}}\right)}^{-1}} \cdot \frac{1}{\frac{z}{\frac{-x}{t}}}} \]
      7. unpow-168.6%

        \[\leadsto \sqrt{{\left(\frac{z}{\frac{-x}{t}}\right)}^{-1} \cdot \color{blue}{{\left(\frac{z}{\frac{-x}{t}}\right)}^{-1}}} \]
      8. pow-prod-up68.7%

        \[\leadsto \sqrt{\color{blue}{{\left(\frac{z}{\frac{-x}{t}}\right)}^{\left(-1 + -1\right)}}} \]
      9. div-inv68.7%

        \[\leadsto \sqrt{{\color{blue}{\left(z \cdot \frac{1}{\frac{-x}{t}}\right)}}^{\left(-1 + -1\right)}} \]
      10. clear-num68.7%

        \[\leadsto \sqrt{{\left(z \cdot \color{blue}{\frac{t}{-x}}\right)}^{\left(-1 + -1\right)}} \]
      11. add-sqr-sqrt15.0%

        \[\leadsto \sqrt{{\left(z \cdot \frac{t}{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}\right)}^{\left(-1 + -1\right)}} \]
      12. sqrt-unprod48.8%

        \[\leadsto \sqrt{{\left(z \cdot \frac{t}{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}\right)}^{\left(-1 + -1\right)}} \]
      13. sqr-neg48.8%

        \[\leadsto \sqrt{{\left(z \cdot \frac{t}{\sqrt{\color{blue}{x \cdot x}}}\right)}^{\left(-1 + -1\right)}} \]
      14. sqrt-unprod53.5%

        \[\leadsto \sqrt{{\left(z \cdot \frac{t}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}\right)}^{\left(-1 + -1\right)}} \]
      15. add-sqr-sqrt68.7%

        \[\leadsto \sqrt{{\left(z \cdot \frac{t}{\color{blue}{x}}\right)}^{\left(-1 + -1\right)}} \]
      16. metadata-eval68.7%

        \[\leadsto \sqrt{{\left(z \cdot \frac{t}{x}\right)}^{\color{blue}{-2}}} \]
    7. Applied egg-rr68.7%

      \[\leadsto \color{blue}{\sqrt{{\left(z \cdot \frac{t}{x}\right)}^{-2}}} \]
    8. Step-by-step derivation
      1. metadata-eval68.7%

        \[\leadsto \sqrt{{\left(z \cdot \frac{t}{x}\right)}^{\color{blue}{\left(2 \cdot -1\right)}}} \]
      2. pow-sqr68.6%

        \[\leadsto \sqrt{\color{blue}{{\left(z \cdot \frac{t}{x}\right)}^{-1} \cdot {\left(z \cdot \frac{t}{x}\right)}^{-1}}} \]
      3. rem-sqrt-square74.4%

        \[\leadsto \color{blue}{\left|{\left(z \cdot \frac{t}{x}\right)}^{-1}\right|} \]
      4. unpow-174.4%

        \[\leadsto \left|\color{blue}{\frac{1}{z \cdot \frac{t}{x}}}\right| \]
      5. *-commutative74.4%

        \[\leadsto \left|\frac{1}{\color{blue}{\frac{t}{x} \cdot z}}\right| \]
      6. associate-*l/56.1%

        \[\leadsto \left|\frac{1}{\color{blue}{\frac{t \cdot z}{x}}}\right| \]
      7. associate-/l*74.4%

        \[\leadsto \left|\frac{1}{\color{blue}{\frac{t}{\frac{x}{z}}}}\right| \]
      8. associate-/l*74.7%

        \[\leadsto \left|\color{blue}{\frac{1 \cdot \frac{x}{z}}{t}}\right| \]
      9. *-lft-identity74.7%

        \[\leadsto \left|\frac{\color{blue}{\frac{x}{z}}}{t}\right| \]
    9. Simplified74.7%

      \[\leadsto \color{blue}{\left|\frac{\frac{x}{z}}{t}\right|} \]

    if -inf.0 < (*.f64 z t) < 1.9999999999999999e196

    1. Initial program 99.9%

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

    if 1.9999999999999999e196 < (*.f64 z t)

    1. Initial program 78.9%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 78.9%

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

        \[\leadsto \color{blue}{-\frac{x}{t \cdot z}} \]
      2. associate-/r*99.8%

        \[\leadsto -\color{blue}{\frac{\frac{x}{t}}{z}} \]
      3. distribute-neg-frac99.8%

        \[\leadsto \color{blue}{\frac{-\frac{x}{t}}{z}} \]
    5. Simplified99.8%

      \[\leadsto \color{blue}{\frac{-\frac{x}{t}}{z}} \]
    6. Step-by-step derivation
      1. add-cbrt-cube73.4%

        \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{-\frac{x}{t}}{z} \cdot \frac{-\frac{x}{t}}{z}\right) \cdot \frac{-\frac{x}{t}}{z}}} \]
      2. pow373.4%

        \[\leadsto \sqrt[3]{\color{blue}{{\left(\frac{-\frac{x}{t}}{z}\right)}^{3}}} \]
      3. distribute-neg-frac73.4%

        \[\leadsto \sqrt[3]{{\left(\frac{\color{blue}{\frac{-x}{t}}}{z}\right)}^{3}} \]
    7. Applied egg-rr73.4%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{\frac{-x}{t}}{z}\right)}^{3}}} \]
    8. Taylor expanded in x around 0 78.9%

      \[\leadsto \color{blue}{\frac{x \cdot \sqrt[3]{-1}}{t \cdot z}} \]
    9. Step-by-step derivation
      1. *-commutative78.9%

        \[\leadsto \frac{x \cdot \sqrt[3]{-1}}{\color{blue}{z \cdot t}} \]
      2. times-frac99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -\infty:\\ \;\;\;\;\left|\frac{\frac{x}{z}}{t}\right|\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+196}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\sqrt[3]{-1}}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 99.5% accurate, 0.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot t \leq -\infty:\\ \;\;\;\;\left|\frac{\frac{x_m}{z}}{t}\right|\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+196}:\\ \;\;\;\;\frac{x_m}{y - z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-x_m}{t}}{z}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= (* z t) (- INFINITY))
    (fabs (/ (/ x_m z) t))
    (if (<= (* z t) 2e+196) (/ x_m (- y (* z t))) (/ (/ (- x_m) t) z)))))
x_m = fabs(x);
x_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((z * t) <= -((double) INFINITY)) {
		tmp = fabs(((x_m / z) / t));
	} else if ((z * t) <= 2e+196) {
		tmp = x_m / (y - (z * t));
	} else {
		tmp = (-x_m / t) / z;
	}
	return x_s * tmp;
}
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((z * t) <= -Double.POSITIVE_INFINITY) {
		tmp = Math.abs(((x_m / z) / t));
	} else if ((z * t) <= 2e+196) {
		tmp = x_m / (y - (z * t));
	} else {
		tmp = (-x_m / t) / z;
	}
	return x_s * tmp;
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if (z * t) <= -math.inf:
		tmp = math.fabs(((x_m / z) / t))
	elif (z * t) <= 2e+196:
		tmp = x_m / (y - (z * t))
	else:
		tmp = (-x_m / t) / z
	return x_s * tmp
x_m = abs(x)
x_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (Float64(z * t) <= Float64(-Inf))
		tmp = abs(Float64(Float64(x_m / z) / t));
	elseif (Float64(z * t) <= 2e+196)
		tmp = Float64(x_m / Float64(y - Float64(z * t)));
	else
		tmp = Float64(Float64(Float64(-x_m) / t) / z);
	end
	return Float64(x_s * tmp)
end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if ((z * t) <= -Inf)
		tmp = abs(((x_m / z) / t));
	elseif ((z * t) <= 2e+196)
		tmp = x_m / (y - (z * t));
	else
		tmp = (-x_m / t) / z;
	end
	tmp_2 = x_s * tmp;
end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], N[Abs[N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+196], N[(x$95$m / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-x$95$m) / t), $MachinePrecision] / z), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;\left|\frac{\frac{x_m}{z}}{t}\right|\\

\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+196}:\\
\;\;\;\;\frac{x_m}{y - z \cdot t}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{-x_m}{t}}{z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -inf.0

    1. Initial program 56.1%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 56.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{t \cdot z}} \]
    4. Step-by-step derivation
      1. associate-*r/56.1%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{t \cdot z}} \]
      2. neg-mul-156.1%

        \[\leadsto \frac{\color{blue}{-x}}{t \cdot z} \]
    5. Simplified56.1%

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

        \[\leadsto \color{blue}{\frac{\frac{-x}{t}}{z}} \]
      2. add-sqr-sqrt73.2%

        \[\leadsto \color{blue}{\sqrt{\frac{\frac{-x}{t}}{z}} \cdot \sqrt{\frac{\frac{-x}{t}}{z}}} \]
      3. sqrt-unprod68.8%

        \[\leadsto \color{blue}{\sqrt{\frac{\frac{-x}{t}}{z} \cdot \frac{\frac{-x}{t}}{z}}} \]
      4. clear-num68.7%

        \[\leadsto \sqrt{\color{blue}{\frac{1}{\frac{z}{\frac{-x}{t}}}} \cdot \frac{\frac{-x}{t}}{z}} \]
      5. clear-num68.6%

        \[\leadsto \sqrt{\frac{1}{\frac{z}{\frac{-x}{t}}} \cdot \color{blue}{\frac{1}{\frac{z}{\frac{-x}{t}}}}} \]
      6. unpow-168.6%

        \[\leadsto \sqrt{\color{blue}{{\left(\frac{z}{\frac{-x}{t}}\right)}^{-1}} \cdot \frac{1}{\frac{z}{\frac{-x}{t}}}} \]
      7. unpow-168.6%

        \[\leadsto \sqrt{{\left(\frac{z}{\frac{-x}{t}}\right)}^{-1} \cdot \color{blue}{{\left(\frac{z}{\frac{-x}{t}}\right)}^{-1}}} \]
      8. pow-prod-up68.7%

        \[\leadsto \sqrt{\color{blue}{{\left(\frac{z}{\frac{-x}{t}}\right)}^{\left(-1 + -1\right)}}} \]
      9. div-inv68.7%

        \[\leadsto \sqrt{{\color{blue}{\left(z \cdot \frac{1}{\frac{-x}{t}}\right)}}^{\left(-1 + -1\right)}} \]
      10. clear-num68.7%

        \[\leadsto \sqrt{{\left(z \cdot \color{blue}{\frac{t}{-x}}\right)}^{\left(-1 + -1\right)}} \]
      11. add-sqr-sqrt15.0%

        \[\leadsto \sqrt{{\left(z \cdot \frac{t}{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}\right)}^{\left(-1 + -1\right)}} \]
      12. sqrt-unprod48.8%

        \[\leadsto \sqrt{{\left(z \cdot \frac{t}{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}\right)}^{\left(-1 + -1\right)}} \]
      13. sqr-neg48.8%

        \[\leadsto \sqrt{{\left(z \cdot \frac{t}{\sqrt{\color{blue}{x \cdot x}}}\right)}^{\left(-1 + -1\right)}} \]
      14. sqrt-unprod53.5%

        \[\leadsto \sqrt{{\left(z \cdot \frac{t}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}\right)}^{\left(-1 + -1\right)}} \]
      15. add-sqr-sqrt68.7%

        \[\leadsto \sqrt{{\left(z \cdot \frac{t}{\color{blue}{x}}\right)}^{\left(-1 + -1\right)}} \]
      16. metadata-eval68.7%

        \[\leadsto \sqrt{{\left(z \cdot \frac{t}{x}\right)}^{\color{blue}{-2}}} \]
    7. Applied egg-rr68.7%

      \[\leadsto \color{blue}{\sqrt{{\left(z \cdot \frac{t}{x}\right)}^{-2}}} \]
    8. Step-by-step derivation
      1. metadata-eval68.7%

        \[\leadsto \sqrt{{\left(z \cdot \frac{t}{x}\right)}^{\color{blue}{\left(2 \cdot -1\right)}}} \]
      2. pow-sqr68.6%

        \[\leadsto \sqrt{\color{blue}{{\left(z \cdot \frac{t}{x}\right)}^{-1} \cdot {\left(z \cdot \frac{t}{x}\right)}^{-1}}} \]
      3. rem-sqrt-square74.4%

        \[\leadsto \color{blue}{\left|{\left(z \cdot \frac{t}{x}\right)}^{-1}\right|} \]
      4. unpow-174.4%

        \[\leadsto \left|\color{blue}{\frac{1}{z \cdot \frac{t}{x}}}\right| \]
      5. *-commutative74.4%

        \[\leadsto \left|\frac{1}{\color{blue}{\frac{t}{x} \cdot z}}\right| \]
      6. associate-*l/56.1%

        \[\leadsto \left|\frac{1}{\color{blue}{\frac{t \cdot z}{x}}}\right| \]
      7. associate-/l*74.4%

        \[\leadsto \left|\frac{1}{\color{blue}{\frac{t}{\frac{x}{z}}}}\right| \]
      8. associate-/l*74.7%

        \[\leadsto \left|\color{blue}{\frac{1 \cdot \frac{x}{z}}{t}}\right| \]
      9. *-lft-identity74.7%

        \[\leadsto \left|\frac{\color{blue}{\frac{x}{z}}}{t}\right| \]
    9. Simplified74.7%

      \[\leadsto \color{blue}{\left|\frac{\frac{x}{z}}{t}\right|} \]

    if -inf.0 < (*.f64 z t) < 1.9999999999999999e196

    1. Initial program 99.9%

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

    if 1.9999999999999999e196 < (*.f64 z t)

    1. Initial program 78.9%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 78.9%

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

        \[\leadsto \color{blue}{-\frac{x}{t \cdot z}} \]
      2. associate-/r*99.8%

        \[\leadsto -\color{blue}{\frac{\frac{x}{t}}{z}} \]
      3. distribute-neg-frac99.8%

        \[\leadsto \color{blue}{\frac{-\frac{x}{t}}{z}} \]
    5. Simplified99.8%

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

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

Alternative 3: 99.5% accurate, 0.3× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot t \leq -\infty \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+196}\right):\\ \;\;\;\;\frac{\frac{-x_m}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x_m}{y - z \cdot t}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (or (<= (* z t) (- INFINITY)) (not (<= (* z t) 2e+196)))
    (/ (/ (- x_m) t) z)
    (/ x_m (- y (* z t))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (((z * t) <= -((double) INFINITY)) || !((z * t) <= 2e+196)) {
		tmp = (-x_m / t) / z;
	} else {
		tmp = x_m / (y - (z * t));
	}
	return x_s * tmp;
}
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (((z * t) <= -Double.POSITIVE_INFINITY) || !((z * t) <= 2e+196)) {
		tmp = (-x_m / t) / z;
	} else {
		tmp = x_m / (y - (z * t));
	}
	return x_s * tmp;
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if ((z * t) <= -math.inf) or not ((z * t) <= 2e+196):
		tmp = (-x_m / t) / z
	else:
		tmp = x_m / (y - (z * t))
	return x_s * tmp
x_m = abs(x)
x_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if ((Float64(z * t) <= Float64(-Inf)) || !(Float64(z * t) <= 2e+196))
		tmp = Float64(Float64(Float64(-x_m) / t) / z);
	else
		tmp = Float64(x_m / Float64(y - Float64(z * t)));
	end
	return Float64(x_s * tmp)
end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if (((z * t) <= -Inf) || ~(((z * t) <= 2e+196)))
		tmp = (-x_m / t) / z;
	else
		tmp = x_m / (y - (z * t));
	end
	tmp_2 = x_s * tmp;
end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[Or[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], N[Not[LessEqual[N[(z * t), $MachinePrecision], 2e+196]], $MachinePrecision]], N[(N[((-x$95$m) / t), $MachinePrecision] / z), $MachinePrecision], N[(x$95$m / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+196}\right):\\
\;\;\;\;\frac{\frac{-x_m}{t}}{z}\\

\mathbf{else}:\\
\;\;\;\;\frac{x_m}{y - z \cdot t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -inf.0 or 1.9999999999999999e196 < (*.f64 z t)

    1. Initial program 70.8%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 70.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{t \cdot z}} \]
    4. Step-by-step derivation
      1. mul-1-neg70.8%

        \[\leadsto \color{blue}{-\frac{x}{t \cdot z}} \]
      2. associate-/r*99.9%

        \[\leadsto -\color{blue}{\frac{\frac{x}{t}}{z}} \]
      3. distribute-neg-frac99.9%

        \[\leadsto \color{blue}{\frac{-\frac{x}{t}}{z}} \]
    5. Simplified99.9%

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

    if -inf.0 < (*.f64 z t) < 1.9999999999999999e196

    1. Initial program 99.9%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification99.9%

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

Alternative 4: 76.8% accurate, 0.3× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+23} \lor \neg \left(z \cdot t \leq 10^{+36}\right):\\ \;\;\;\;\frac{-x_m}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x_m}{y}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (or (<= (* z t) -5e+23) (not (<= (* z t) 1e+36)))
    (/ (- x_m) (* z t))
    (/ x_m y))))
x_m = fabs(x);
x_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (((z * t) <= -5e+23) || !((z * t) <= 1e+36)) {
		tmp = -x_m / (z * t);
	} else {
		tmp = x_m / y;
	}
	return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (((z * t) <= (-5d+23)) .or. (.not. ((z * t) <= 1d+36))) then
        tmp = -x_m / (z * t)
    else
        tmp = x_m / y
    end if
    code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (((z * t) <= -5e+23) || !((z * t) <= 1e+36)) {
		tmp = -x_m / (z * t);
	} else {
		tmp = x_m / y;
	}
	return x_s * tmp;
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if ((z * t) <= -5e+23) or not ((z * t) <= 1e+36):
		tmp = -x_m / (z * t)
	else:
		tmp = x_m / y
	return x_s * tmp
x_m = abs(x)
x_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if ((Float64(z * t) <= -5e+23) || !(Float64(z * t) <= 1e+36))
		tmp = Float64(Float64(-x_m) / Float64(z * t));
	else
		tmp = Float64(x_m / y);
	end
	return Float64(x_s * tmp)
end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if (((z * t) <= -5e+23) || ~(((z * t) <= 1e+36)))
		tmp = -x_m / (z * t);
	else
		tmp = x_m / y;
	end
	tmp_2 = x_s * tmp;
end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[Or[LessEqual[N[(z * t), $MachinePrecision], -5e+23], N[Not[LessEqual[N[(z * t), $MachinePrecision], 1e+36]], $MachinePrecision]], N[((-x$95$m) / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x$95$m / y), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+23} \lor \neg \left(z \cdot t \leq 10^{+36}\right):\\
\;\;\;\;\frac{-x_m}{z \cdot t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -4.9999999999999999e23 or 1.00000000000000004e36 < (*.f64 z t)

    1. Initial program 89.8%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 76.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{t \cdot z}} \]
    4. Step-by-step derivation
      1. associate-*r/76.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{t \cdot z}} \]
      2. neg-mul-176.8%

        \[\leadsto \frac{\color{blue}{-x}}{t \cdot z} \]
    5. Simplified76.8%

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

    if -4.9999999999999999e23 < (*.f64 z t) < 1.00000000000000004e36

    1. Initial program 99.9%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 78.2%

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

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

Alternative 5: 79.7% accurate, 0.3× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+23} \lor \neg \left(z \cdot t \leq 10^{+36}\right):\\ \;\;\;\;\frac{\frac{-x_m}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x_m}{y}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (or (<= (* z t) -5e+23) (not (<= (* z t) 1e+36)))
    (/ (/ (- x_m) t) z)
    (/ x_m y))))
x_m = fabs(x);
x_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (((z * t) <= -5e+23) || !((z * t) <= 1e+36)) {
		tmp = (-x_m / t) / z;
	} else {
		tmp = x_m / y;
	}
	return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (((z * t) <= (-5d+23)) .or. (.not. ((z * t) <= 1d+36))) then
        tmp = (-x_m / t) / z
    else
        tmp = x_m / y
    end if
    code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (((z * t) <= -5e+23) || !((z * t) <= 1e+36)) {
		tmp = (-x_m / t) / z;
	} else {
		tmp = x_m / y;
	}
	return x_s * tmp;
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if ((z * t) <= -5e+23) or not ((z * t) <= 1e+36):
		tmp = (-x_m / t) / z
	else:
		tmp = x_m / y
	return x_s * tmp
x_m = abs(x)
x_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if ((Float64(z * t) <= -5e+23) || !(Float64(z * t) <= 1e+36))
		tmp = Float64(Float64(Float64(-x_m) / t) / z);
	else
		tmp = Float64(x_m / y);
	end
	return Float64(x_s * tmp)
end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if (((z * t) <= -5e+23) || ~(((z * t) <= 1e+36)))
		tmp = (-x_m / t) / z;
	else
		tmp = x_m / y;
	end
	tmp_2 = x_s * tmp;
end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[Or[LessEqual[N[(z * t), $MachinePrecision], -5e+23], N[Not[LessEqual[N[(z * t), $MachinePrecision], 1e+36]], $MachinePrecision]], N[(N[((-x$95$m) / t), $MachinePrecision] / z), $MachinePrecision], N[(x$95$m / y), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+23} \lor \neg \left(z \cdot t \leq 10^{+36}\right):\\
\;\;\;\;\frac{\frac{-x_m}{t}}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -4.9999999999999999e23 or 1.00000000000000004e36 < (*.f64 z t)

    1. Initial program 89.8%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 76.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{t \cdot z}} \]
    4. Step-by-step derivation
      1. mul-1-neg76.8%

        \[\leadsto \color{blue}{-\frac{x}{t \cdot z}} \]
      2. associate-/r*84.2%

        \[\leadsto -\color{blue}{\frac{\frac{x}{t}}{z}} \]
      3. distribute-neg-frac84.2%

        \[\leadsto \color{blue}{\frac{-\frac{x}{t}}{z}} \]
    5. Simplified84.2%

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

    if -4.9999999999999999e23 < (*.f64 z t) < 1.00000000000000004e36

    1. Initial program 99.9%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 78.2%

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

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

Alternative 6: 63.5% accurate, 0.4× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+164} \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+160}\right):\\ \;\;\;\;\frac{x_m}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x_m}{y}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (or (<= (* z t) -2e+164) (not (<= (* z t) 2e+160)))
    (/ x_m (* z t))
    (/ x_m y))))
x_m = fabs(x);
x_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (((z * t) <= -2e+164) || !((z * t) <= 2e+160)) {
		tmp = x_m / (z * t);
	} else {
		tmp = x_m / y;
	}
	return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (((z * t) <= (-2d+164)) .or. (.not. ((z * t) <= 2d+160))) then
        tmp = x_m / (z * t)
    else
        tmp = x_m / y
    end if
    code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (((z * t) <= -2e+164) || !((z * t) <= 2e+160)) {
		tmp = x_m / (z * t);
	} else {
		tmp = x_m / y;
	}
	return x_s * tmp;
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if ((z * t) <= -2e+164) or not ((z * t) <= 2e+160):
		tmp = x_m / (z * t)
	else:
		tmp = x_m / y
	return x_s * tmp
x_m = abs(x)
x_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if ((Float64(z * t) <= -2e+164) || !(Float64(z * t) <= 2e+160))
		tmp = Float64(x_m / Float64(z * t));
	else
		tmp = Float64(x_m / y);
	end
	return Float64(x_s * tmp)
end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if (((z * t) <= -2e+164) || ~(((z * t) <= 2e+160)))
		tmp = x_m / (z * t);
	else
		tmp = x_m / y;
	end
	tmp_2 = x_s * tmp;
end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[Or[LessEqual[N[(z * t), $MachinePrecision], -2e+164], N[Not[LessEqual[N[(z * t), $MachinePrecision], 2e+160]], $MachinePrecision]], N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x$95$m / y), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+164} \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+160}\right):\\
\;\;\;\;\frac{x_m}{z \cdot t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -2e164 or 2.00000000000000001e160 < (*.f64 z t)

    1. Initial program 82.9%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 79.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{t \cdot z}} \]
    4. Step-by-step derivation
      1. associate-*r/79.2%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{t \cdot z}} \]
      2. neg-mul-179.2%

        \[\leadsto \frac{\color{blue}{-x}}{t \cdot z} \]
    5. Simplified79.2%

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

        \[\leadsto \color{blue}{\frac{\frac{-x}{t}}{z}} \]
      2. expm1-log1p-u91.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{-x}{t}}{z}\right)\right)} \]
      3. expm1-udef50.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{-x}{t}}{z}\right)} - 1} \]
      4. associate-/r*50.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{-x}{t \cdot z}}\right)} - 1 \]
      5. add-sqr-sqrt17.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{t \cdot z}\right)} - 1 \]
      6. sqrt-unprod44.7%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{t \cdot z}\right)} - 1 \]
      7. sqr-neg44.7%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\sqrt{\color{blue}{x \cdot x}}}{t \cdot z}\right)} - 1 \]
      8. sqrt-unprod31.9%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{t \cdot z}\right)} - 1 \]
      9. add-sqr-sqrt48.0%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{x}}{t \cdot z}\right)} - 1 \]
    7. Applied egg-rr48.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{t \cdot z}\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def47.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{t \cdot z}\right)\right)} \]
      2. expm1-log1p47.6%

        \[\leadsto \color{blue}{\frac{x}{t \cdot z}} \]
      3. *-commutative47.6%

        \[\leadsto \frac{x}{\color{blue}{z \cdot t}} \]
    9. Simplified47.6%

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

    if -2e164 < (*.f64 z t) < 2.00000000000000001e160

    1. Initial program 99.9%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 65.2%

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

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

Alternative 7: 55.9% accurate, 0.7× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x_s \cdot \begin{array}{l} \mathbf{if}\;t \leq 1.2 \cdot 10^{+263}:\\ \;\;\;\;\frac{x_m}{y}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{x_m}{t}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (* x_s (if (<= t 1.2e+263) (/ x_m y) (* z (/ x_m t)))))
x_m = fabs(x);
x_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (t <= 1.2e+263) {
		tmp = x_m / y;
	} else {
		tmp = z * (x_m / t);
	}
	return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= 1.2d+263) then
        tmp = x_m / y
    else
        tmp = z * (x_m / t)
    end if
    code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (t <= 1.2e+263) {
		tmp = x_m / y;
	} else {
		tmp = z * (x_m / t);
	}
	return x_s * tmp;
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if t <= 1.2e+263:
		tmp = x_m / y
	else:
		tmp = z * (x_m / t)
	return x_s * tmp
x_m = abs(x)
x_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (t <= 1.2e+263)
		tmp = Float64(x_m / y);
	else
		tmp = Float64(z * Float64(x_m / t));
	end
	return Float64(x_s * tmp)
end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if (t <= 1.2e+263)
		tmp = x_m / y;
	else
		tmp = z * (x_m / t);
	end
	tmp_2 = x_s * tmp;
end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[t, 1.2e+263], N[(x$95$m / y), $MachinePrecision], N[(z * N[(x$95$m / t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq 1.2 \cdot 10^{+263}:\\
\;\;\;\;\frac{x_m}{y}\\

\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x_m}{t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 1.2e263

    1. Initial program 95.2%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 52.6%

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

    if 1.2e263 < t

    1. Initial program 94.0%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 76.4%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{t \cdot z}} \]
    4. Step-by-step derivation
      1. mul-1-neg76.4%

        \[\leadsto \color{blue}{-\frac{x}{t \cdot z}} \]
      2. associate-/r*78.9%

        \[\leadsto -\color{blue}{\frac{\frac{x}{t}}{z}} \]
      3. distribute-neg-frac78.9%

        \[\leadsto \color{blue}{\frac{-\frac{x}{t}}{z}} \]
    5. Simplified78.9%

      \[\leadsto \color{blue}{\frac{-\frac{x}{t}}{z}} \]
    6. Step-by-step derivation
      1. add-cbrt-cube66.8%

        \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{-\frac{x}{t}}{z} \cdot \frac{-\frac{x}{t}}{z}\right) \cdot \frac{-\frac{x}{t}}{z}}} \]
      2. pow366.8%

        \[\leadsto \sqrt[3]{\color{blue}{{\left(\frac{-\frac{x}{t}}{z}\right)}^{3}}} \]
      3. distribute-neg-frac66.8%

        \[\leadsto \sqrt[3]{{\left(\frac{\color{blue}{\frac{-x}{t}}}{z}\right)}^{3}} \]
    7. Applied egg-rr66.8%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{\frac{-x}{t}}{z}\right)}^{3}}} \]
    8. Taylor expanded in x around 0 76.4%

      \[\leadsto \color{blue}{\frac{x \cdot \sqrt[3]{-1}}{t \cdot z}} \]
    9. Step-by-step derivation
      1. *-commutative76.4%

        \[\leadsto \frac{x \cdot \sqrt[3]{-1}}{\color{blue}{z \cdot t}} \]
      2. times-frac81.9%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{\sqrt[3]{-1}}{t}} \]
    10. Simplified81.9%

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{\sqrt[3]{-1}}{t}} \]
    11. Applied egg-rr33.1%

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

        \[\leadsto \color{blue}{\frac{x}{t} \cdot z} \]
    13. Simplified48.2%

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

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

Alternative 8: 55.0% accurate, 2.3× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x_s \cdot \frac{x_m}{y} \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t) :precision binary64 (* x_s (/ x_m y)))
x_m = fabs(x);
x_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	return x_s * (x_m / y);
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x_s * (x_m / y)
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	return x_s * (x_m / y);
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	return x_s * (x_m / y)
x_m = abs(x)
x_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	return Float64(x_s * Float64(x_m / y))
end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp = code(x_s, x_m, y, z, t)
	tmp = x_s * (x_m / y);
end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x_s \cdot \frac{x_m}{y}
\end{array}
Derivation
  1. Initial program 95.1%

    \[\frac{x}{y - z \cdot t} \]
  2. Add Preprocessing
  3. Taylor expanded in y around inf 51.5%

    \[\leadsto \color{blue}{\frac{x}{y}} \]
  4. Final simplification51.5%

    \[\leadsto \frac{x}{y} \]
  5. Add Preprocessing

Alternative 9: 3.5% accurate, 7.0× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x_s \cdot 1 \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t) :precision binary64 (* x_s 1.0))
x_m = fabs(x);
x_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	return x_s * 1.0;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x_s * 1.0d0
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	return x_s * 1.0;
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	return x_s * 1.0
x_m = abs(x)
x_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	return Float64(x_s * 1.0)
end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp = code(x_s, x_m, y, z, t)
	tmp = x_s * 1.0;
end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * 1.0), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x_s \cdot 1
\end{array}
Derivation
  1. Initial program 95.1%

    \[\frac{x}{y - z \cdot t} \]
  2. Add Preprocessing
  3. Taylor expanded in y around 0 51.6%

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

      \[\leadsto \color{blue}{-\frac{x}{t \cdot z}} \]
    2. associate-/r*55.7%

      \[\leadsto -\color{blue}{\frac{\frac{x}{t}}{z}} \]
    3. distribute-neg-frac55.7%

      \[\leadsto \color{blue}{\frac{-\frac{x}{t}}{z}} \]
  5. Simplified55.7%

    \[\leadsto \color{blue}{\frac{-\frac{x}{t}}{z}} \]
  6. Step-by-step derivation
    1. add-cbrt-cube40.7%

      \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{-\frac{x}{t}}{z} \cdot \frac{-\frac{x}{t}}{z}\right) \cdot \frac{-\frac{x}{t}}{z}}} \]
    2. pow340.7%

      \[\leadsto \sqrt[3]{\color{blue}{{\left(\frac{-\frac{x}{t}}{z}\right)}^{3}}} \]
    3. distribute-neg-frac40.7%

      \[\leadsto \sqrt[3]{{\left(\frac{\color{blue}{\frac{-x}{t}}}{z}\right)}^{3}} \]
  7. Applied egg-rr40.7%

    \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{\frac{-x}{t}}{z}\right)}^{3}}} \]
  8. Taylor expanded in x around 0 51.6%

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

      \[\leadsto \frac{x \cdot \sqrt[3]{-1}}{\color{blue}{z \cdot t}} \]
    2. times-frac52.8%

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{\sqrt[3]{-1}}{t}} \]
  10. Simplified52.8%

    \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{\sqrt[3]{-1}}{t}} \]
  11. Applied egg-rr0.8%

    \[\leadsto \color{blue}{\frac{\sqrt{x \cdot \left(z \cdot t\right)}}{\sqrt{x \cdot \left(z \cdot t\right)}}} \]
  12. Step-by-step derivation
    1. *-inverses3.7%

      \[\leadsto \color{blue}{1} \]
  13. Simplified3.7%

    \[\leadsto \color{blue}{1} \]
  14. Final simplification3.7%

    \[\leadsto 1 \]
  15. Add Preprocessing

Alternative 10: 4.3% accurate, 7.0× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x_s \cdot x_m \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t) :precision binary64 (* x_s x_m))
x_m = fabs(x);
x_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	return x_s * x_m;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x_s * x_m
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	return x_s * x_m;
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	return x_s * x_m
x_m = abs(x)
x_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	return Float64(x_s * x_m)
end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp = code(x_s, x_m, y, z, t)
	tmp = x_s * x_m;
end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * x$95$m), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x_s \cdot x_m
\end{array}
Derivation
  1. Initial program 95.1%

    \[\frac{x}{y - z \cdot t} \]
  2. Add Preprocessing
  3. Taylor expanded in y around 0 51.6%

    \[\leadsto \color{blue}{-1 \cdot \frac{x}{t \cdot z}} \]
  4. Step-by-step derivation
    1. associate-*r/51.6%

      \[\leadsto \color{blue}{\frac{-1 \cdot x}{t \cdot z}} \]
    2. neg-mul-151.6%

      \[\leadsto \frac{\color{blue}{-x}}{t \cdot z} \]
  5. Simplified51.6%

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

      \[\leadsto \color{blue}{\frac{\frac{-x}{t}}{z}} \]
    2. expm1-log1p-u47.0%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{-x}{t}}{z}\right)\right)} \]
    3. expm1-udef32.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{-x}{t}}{z}\right)} - 1} \]
    4. associate-/r*33.1%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{-x}{t \cdot z}}\right)} - 1 \]
    5. add-sqr-sqrt13.7%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{t \cdot z}\right)} - 1 \]
    6. sqrt-unprod26.5%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{t \cdot z}\right)} - 1 \]
    7. sqr-neg26.5%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{\sqrt{\color{blue}{x \cdot x}}}{t \cdot z}\right)} - 1 \]
    8. sqrt-unprod14.9%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{t \cdot z}\right)} - 1 \]
    9. add-sqr-sqrt24.8%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{x}}{t \cdot z}\right)} - 1 \]
  7. Applied egg-rr24.8%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{t \cdot z}\right)} - 1} \]
  8. Step-by-step derivation
    1. expm1-def18.0%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{t \cdot z}\right)\right)} \]
    2. expm1-log1p20.1%

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

      \[\leadsto \frac{x}{\color{blue}{z \cdot t}} \]
  9. Simplified20.1%

    \[\leadsto \color{blue}{\frac{x}{z \cdot t}} \]
  10. Applied egg-rr3.1%

    \[\leadsto \color{blue}{\sqrt{z \cdot t} \cdot \frac{x}{\sqrt{z \cdot t}}} \]
  11. Step-by-step derivation
    1. *-commutative3.1%

      \[\leadsto \color{blue}{\frac{x}{\sqrt{z \cdot t}} \cdot \sqrt{z \cdot t}} \]
    2. associate-*l/1.7%

      \[\leadsto \color{blue}{\frac{x \cdot \sqrt{z \cdot t}}{\sqrt{z \cdot t}}} \]
    3. associate-/l*1.3%

      \[\leadsto \color{blue}{\frac{x}{\frac{\sqrt{z \cdot t}}{\sqrt{z \cdot t}}}} \]
    4. *-inverses4.2%

      \[\leadsto \frac{x}{\color{blue}{1}} \]
  12. Simplified4.2%

    \[\leadsto \color{blue}{\frac{x}{1}} \]
  13. Final simplification4.2%

    \[\leadsto x \]
  14. Add Preprocessing

Developer target: 96.1% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{1}{\frac{y}{x} - \frac{z}{x} \cdot t}\\
\mathbf{if}\;x < -1.618195973607049 \cdot 10^{+50}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x < 2.1378306434876444 \cdot 10^{+131}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024018 
(FPCore (x y z t)
  :name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, B"
  :precision binary64

  :herbie-target
  (if (< x -1.618195973607049e+50) (/ 1.0 (- (/ y x) (* (/ z x) t))) (if (< x 2.1378306434876444e+131) (/ x (- y (* z t))) (/ 1.0 (- (/ y x) (* (/ z x) t)))))

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