2nthrt (problem 3.4.6)

Percentage Accurate: 54.6% → 84.3%
Time: 34.0s
Alternatives: 24
Speedup: 1.8×

Specification

?
\[\begin{array}{l} \\ {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \end{array} \]
(FPCore (x n)
 :precision binary64
 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
	return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
	return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n):
	return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n)
	return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n)))
end
function tmp = code(x, n)
	tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n));
end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\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 24 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: 54.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \end{array} \]
(FPCore (x n)
 :precision binary64
 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
	return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
	return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n):
	return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n)
	return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n)))
end
function tmp = code(x, n)
	tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n));
end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}

Alternative 1: 84.3% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}\\ \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n} - \log x\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_0 \cdot t\_0, t\_0, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (cbrt (- (pow x (/ 1.0 n))))))
   (if (<= (/ 1.0 n) -1e-173)
     (/ (exp (/ (log x) n)) (* x n))
     (if (<= (/ 1.0 n) 5e-13)
       (/
        (+
         (log1p x)
         (- (* 0.5 (/ (- (pow (log1p x) 2.0) (pow (log x) 2.0)) n)) (log x)))
        n)
       (fma (* t_0 t_0) t_0 (exp (/ (log1p x) n)))))))
double code(double x, double n) {
	double t_0 = cbrt(-pow(x, (1.0 / n)));
	double tmp;
	if ((1.0 / n) <= -1e-173) {
		tmp = exp((log(x) / n)) / (x * n);
	} else if ((1.0 / n) <= 5e-13) {
		tmp = (log1p(x) + ((0.5 * ((pow(log1p(x), 2.0) - pow(log(x), 2.0)) / n)) - log(x))) / n;
	} else {
		tmp = fma((t_0 * t_0), t_0, exp((log1p(x) / n)));
	}
	return tmp;
}
function code(x, n)
	t_0 = cbrt(Float64(-(x ^ Float64(1.0 / n))))
	tmp = 0.0
	if (Float64(1.0 / n) <= -1e-173)
		tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n));
	elseif (Float64(1.0 / n) <= 5e-13)
		tmp = Float64(Float64(log1p(x) + Float64(Float64(0.5 * Float64(Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)) / n)) - log(x))) / n);
	else
		tmp = fma(Float64(t_0 * t_0), t_0, exp(Float64(log1p(x) / n)));
	end
	return tmp
end
code[x_, n_] := Block[{t$95$0 = N[Power[(-N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), 1/3], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-173], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-13], N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(0.5 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(t$95$0 * t$95$0), $MachinePrecision] * t$95$0 + N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n} - \log x\right)}{n}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0 \cdot t\_0, t\_0, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 1 n) < -1e-173

    1. Initial program 72.1%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 85.8%

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    4. Step-by-step derivation
      1. mul-1-neg85.8%

        \[\leadsto \frac{e^{\color{blue}{-\frac{\log \left(\frac{1}{x}\right)}{n}}}}{n \cdot x} \]
      2. log-rec85.8%

        \[\leadsto \frac{e^{-\frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      3. mul-1-neg85.8%

        \[\leadsto \frac{e^{-\frac{\color{blue}{-1 \cdot \log x}}{n}}}{n \cdot x} \]
      4. distribute-neg-frac85.8%

        \[\leadsto \frac{e^{\color{blue}{\frac{--1 \cdot \log x}{n}}}}{n \cdot x} \]
      5. mul-1-neg85.8%

        \[\leadsto \frac{e^{\frac{-\color{blue}{\left(-\log x\right)}}{n}}}{n \cdot x} \]
      6. remove-double-neg85.8%

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x}}{n}}}{n \cdot x} \]
      7. *-commutative85.8%

        \[\leadsto \frac{e^{\frac{\log x}{n}}}{\color{blue}{x \cdot n}} \]
    5. Simplified85.8%

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]

    if -1e-173 < (/.f64 1 n) < 4.9999999999999999e-13

    1. Initial program 39.2%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 85.7%

      \[\leadsto \color{blue}{\frac{\left(\log \left(1 + x\right) + 0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n}\right) - \left(\log x + 0.5 \cdot \frac{{\log x}^{2}}{n}\right)}{n}} \]
    4. Step-by-step derivation
      1. associate--l+85.7%

        \[\leadsto \frac{\color{blue}{\log \left(1 + x\right) + \left(0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n} - \left(\log x + 0.5 \cdot \frac{{\log x}^{2}}{n}\right)\right)}}{n} \]
      2. log1p-define85.7%

        \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} + \left(0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n} - \left(\log x + 0.5 \cdot \frac{{\log x}^{2}}{n}\right)\right)}{n} \]
      3. +-commutative85.7%

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n} - \color{blue}{\left(0.5 \cdot \frac{{\log x}^{2}}{n} + \log x\right)}\right)}{n} \]
      4. associate--r+85.7%

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) + \color{blue}{\left(\left(0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n}\right) - \log x\right)}}{n} \]
      5. distribute-lft-out--85.7%

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) + \left(\color{blue}{0.5 \cdot \left(\frac{{\log \left(1 + x\right)}^{2}}{n} - \frac{{\log x}^{2}}{n}\right)} - \log x\right)}{n} \]
      6. div-sub85.7%

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \color{blue}{\frac{{\log \left(1 + x\right)}^{2} - {\log x}^{2}}{n}} - \log x\right)}{n} \]
      7. log1p-define85.7%

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\color{blue}{\left(\mathsf{log1p}\left(x\right)\right)}}^{2} - {\log x}^{2}}{n} - \log x\right)}{n} \]
    5. Simplified85.7%

      \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n} - \log x\right)}{n}} \]

    if 4.9999999999999999e-13 < (/.f64 1 n)

    1. Initial program 49.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg49.6%

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + \left(-{x}^{\left(\frac{1}{n}\right)}\right)} \]
      2. +-commutative49.6%

        \[\leadsto \color{blue}{\left(-{x}^{\left(\frac{1}{n}\right)}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \]
      3. add-cube-cbrt49.6%

        \[\leadsto \color{blue}{\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}} + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
      4. fma-define49.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
      5. pow-to-exp49.8%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
      6. un-div-inv49.8%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
      7. +-commutative49.8%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
      8. log1p-define99.4%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right) \]
    4. Applied egg-rr99.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification87.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n} - \log x\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 86.1% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.052:\\ \;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}}{n}\right) - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= x 0.052)
   (/
    (-
     (+
      (log1p x)
      (/
       (+
        (* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0)))
        (*
         0.16666666666666666
         (/ (- (pow (log1p x) 3.0) (pow (log x) 3.0)) n)))
       n))
     (log x))
    n)
   (/ (exp (/ (log x) n)) (* x n))))
double code(double x, double n) {
	double tmp;
	if (x <= 0.052) {
		tmp = ((log1p(x) + (((0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) + (0.16666666666666666 * ((pow(log1p(x), 3.0) - pow(log(x), 3.0)) / n))) / n)) - log(x)) / n;
	} else {
		tmp = exp((log(x) / n)) / (x * n);
	}
	return tmp;
}
public static double code(double x, double n) {
	double tmp;
	if (x <= 0.052) {
		tmp = ((Math.log1p(x) + (((0.5 * (Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0))) + (0.16666666666666666 * ((Math.pow(Math.log1p(x), 3.0) - Math.pow(Math.log(x), 3.0)) / n))) / n)) - Math.log(x)) / n;
	} else {
		tmp = Math.exp((Math.log(x) / n)) / (x * n);
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if x <= 0.052:
		tmp = ((math.log1p(x) + (((0.5 * (math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0))) + (0.16666666666666666 * ((math.pow(math.log1p(x), 3.0) - math.pow(math.log(x), 3.0)) / n))) / n)) - math.log(x)) / n
	else:
		tmp = math.exp((math.log(x) / n)) / (x * n)
	return tmp
function code(x, n)
	tmp = 0.0
	if (x <= 0.052)
		tmp = Float64(Float64(Float64(log1p(x) + Float64(Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) + Float64(0.16666666666666666 * Float64(Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0)) / n))) / n)) - log(x)) / n);
	else
		tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n));
	end
	return tmp
end
code[x_, n_] := If[LessEqual[x, 0.052], N[(N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.052:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}}{n}\right) - \log x}{n}\\

\mathbf{else}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.0519999999999999976

    1. Initial program 45.2%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around -inf 76.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{\left(-1 \cdot \log \left(1 + x\right) + -1 \cdot \frac{\left(-1 \cdot \frac{-0.16666666666666666 \cdot {\log \left(1 + x\right)}^{3} - -0.16666666666666666 \cdot {\log x}^{3}}{n} + 0.5 \cdot {\log \left(1 + x\right)}^{2}\right) - 0.5 \cdot {\log x}^{2}}{n}\right) - -1 \cdot \log x}{n}} \]
    4. Simplified76.7%

      \[\leadsto \color{blue}{\frac{\log x - \left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}}{n}\right)}{-n}} \]

    if 0.0519999999999999976 < x

    1. Initial program 70.5%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 96.6%

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    4. Step-by-step derivation
      1. mul-1-neg96.6%

        \[\leadsto \frac{e^{\color{blue}{-\frac{\log \left(\frac{1}{x}\right)}{n}}}}{n \cdot x} \]
      2. log-rec96.6%

        \[\leadsto \frac{e^{-\frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      3. mul-1-neg96.6%

        \[\leadsto \frac{e^{-\frac{\color{blue}{-1 \cdot \log x}}{n}}}{n \cdot x} \]
      4. distribute-neg-frac96.6%

        \[\leadsto \frac{e^{\color{blue}{\frac{--1 \cdot \log x}{n}}}}{n \cdot x} \]
      5. mul-1-neg96.6%

        \[\leadsto \frac{e^{\frac{-\color{blue}{\left(-\log x\right)}}{n}}}{n \cdot x} \]
      6. remove-double-neg96.6%

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x}}{n}}}{n \cdot x} \]
      7. *-commutative96.6%

        \[\leadsto \frac{e^{\frac{\log x}{n}}}{\color{blue}{x \cdot n}} \]
    5. Simplified96.6%

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.052:\\ \;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}}{n}\right) - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 84.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-15}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n} - \log x\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;{\left({\left(\sqrt[3]{\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}}\right)}^{3}\right)}^{3}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= (/ 1.0 n) -1e-173)
   (/ (exp (/ (log x) n)) (* x n))
   (if (<= (/ 1.0 n) 5e-15)
     (/
      (+
       (log1p x)
       (- (* 0.5 (/ (- (pow (log1p x) 2.0) (pow (log x) 2.0)) n)) (log x)))
      n)
     (pow
      (pow (cbrt (cbrt (- (exp (/ (log1p x) n)) (pow x (/ 1.0 n))))) 3.0)
      3.0))))
double code(double x, double n) {
	double tmp;
	if ((1.0 / n) <= -1e-173) {
		tmp = exp((log(x) / n)) / (x * n);
	} else if ((1.0 / n) <= 5e-15) {
		tmp = (log1p(x) + ((0.5 * ((pow(log1p(x), 2.0) - pow(log(x), 2.0)) / n)) - log(x))) / n;
	} else {
		tmp = pow(pow(cbrt(cbrt((exp((log1p(x) / n)) - pow(x, (1.0 / n))))), 3.0), 3.0);
	}
	return tmp;
}
public static double code(double x, double n) {
	double tmp;
	if ((1.0 / n) <= -1e-173) {
		tmp = Math.exp((Math.log(x) / n)) / (x * n);
	} else if ((1.0 / n) <= 5e-15) {
		tmp = (Math.log1p(x) + ((0.5 * ((Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0)) / n)) - Math.log(x))) / n;
	} else {
		tmp = Math.pow(Math.pow(Math.cbrt(Math.cbrt((Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n))))), 3.0), 3.0);
	}
	return tmp;
}
function code(x, n)
	tmp = 0.0
	if (Float64(1.0 / n) <= -1e-173)
		tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n));
	elseif (Float64(1.0 / n) <= 5e-15)
		tmp = Float64(Float64(log1p(x) + Float64(Float64(0.5 * Float64(Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)) / n)) - log(x))) / n);
	else
		tmp = (cbrt(cbrt(Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))))) ^ 3.0) ^ 3.0;
	end
	return tmp
end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-173], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-15], N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(0.5 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[Power[N[Power[N[Power[N[Power[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision], 3.0], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n} - \log x\right)}{n}\\

\mathbf{else}:\\
\;\;\;\;{\left({\left(\sqrt[3]{\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}}\right)}^{3}\right)}^{3}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 1 n) < -1e-173

    1. Initial program 72.1%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 85.8%

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    4. Step-by-step derivation
      1. mul-1-neg85.8%

        \[\leadsto \frac{e^{\color{blue}{-\frac{\log \left(\frac{1}{x}\right)}{n}}}}{n \cdot x} \]
      2. log-rec85.8%

        \[\leadsto \frac{e^{-\frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      3. mul-1-neg85.8%

        \[\leadsto \frac{e^{-\frac{\color{blue}{-1 \cdot \log x}}{n}}}{n \cdot x} \]
      4. distribute-neg-frac85.8%

        \[\leadsto \frac{e^{\color{blue}{\frac{--1 \cdot \log x}{n}}}}{n \cdot x} \]
      5. mul-1-neg85.8%

        \[\leadsto \frac{e^{\frac{-\color{blue}{\left(-\log x\right)}}{n}}}{n \cdot x} \]
      6. remove-double-neg85.8%

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x}}{n}}}{n \cdot x} \]
      7. *-commutative85.8%

        \[\leadsto \frac{e^{\frac{\log x}{n}}}{\color{blue}{x \cdot n}} \]
    5. Simplified85.8%

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]

    if -1e-173 < (/.f64 1 n) < 4.99999999999999999e-15

    1. Initial program 39.5%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 86.6%

      \[\leadsto \color{blue}{\frac{\left(\log \left(1 + x\right) + 0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n}\right) - \left(\log x + 0.5 \cdot \frac{{\log x}^{2}}{n}\right)}{n}} \]
    4. Step-by-step derivation
      1. associate--l+86.6%

        \[\leadsto \frac{\color{blue}{\log \left(1 + x\right) + \left(0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n} - \left(\log x + 0.5 \cdot \frac{{\log x}^{2}}{n}\right)\right)}}{n} \]
      2. log1p-define86.6%

        \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} + \left(0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n} - \left(\log x + 0.5 \cdot \frac{{\log x}^{2}}{n}\right)\right)}{n} \]
      3. +-commutative86.6%

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n} - \color{blue}{\left(0.5 \cdot \frac{{\log x}^{2}}{n} + \log x\right)}\right)}{n} \]
      4. associate--r+86.6%

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) + \color{blue}{\left(\left(0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n}\right) - \log x\right)}}{n} \]
      5. distribute-lft-out--86.6%

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) + \left(\color{blue}{0.5 \cdot \left(\frac{{\log \left(1 + x\right)}^{2}}{n} - \frac{{\log x}^{2}}{n}\right)} - \log x\right)}{n} \]
      6. div-sub86.6%

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \color{blue}{\frac{{\log \left(1 + x\right)}^{2} - {\log x}^{2}}{n}} - \log x\right)}{n} \]
      7. log1p-define86.6%

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\color{blue}{\left(\mathsf{log1p}\left(x\right)\right)}}^{2} - {\log x}^{2}}{n} - \log x\right)}{n} \]
    5. Simplified86.6%

      \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n} - \log x\right)}{n}} \]

    if 4.99999999999999999e-15 < (/.f64 1 n)

    1. Initial program 48.3%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt48.3%

        \[\leadsto \color{blue}{\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}} \]
      2. pow348.3%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}} \]
      3. pow-to-exp48.3%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3} \]
      4. un-div-inv48.3%

        \[\leadsto {\left(\sqrt[3]{e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3} \]
      5. +-commutative48.3%

        \[\leadsto {\left(\sqrt[3]{e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3} \]
      6. log1p-define96.3%

        \[\leadsto {\left(\sqrt[3]{e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3} \]
    4. Applied egg-rr96.3%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}} \]
    5. Step-by-step derivation
      1. add-cube-cbrt96.4%

        \[\leadsto {\color{blue}{\left(\left(\sqrt[3]{\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}} \cdot \sqrt[3]{\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}}\right) \cdot \sqrt[3]{\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}}\right)}}^{3} \]
      2. pow396.4%

        \[\leadsto {\color{blue}{\left({\left(\sqrt[3]{\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}}\right)}^{3}\right)}}^{3} \]
    6. Applied egg-rr96.4%

      \[\leadsto {\color{blue}{\left({\left(\sqrt[3]{\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}}\right)}^{3}\right)}}^{3} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification87.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-15}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n} - \log x\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;{\left({\left(\sqrt[3]{\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}}\right)}^{3}\right)}^{3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 84.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-15}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n} - \log x\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= (/ 1.0 n) -1e-173)
   (/ (exp (/ (log x) n)) (* x n))
   (if (<= (/ 1.0 n) 5e-15)
     (/
      (+
       (log1p x)
       (- (* 0.5 (/ (- (pow (log1p x) 2.0) (pow (log x) 2.0)) n)) (log x)))
      n)
     (pow (cbrt (- (exp (/ (log1p x) n)) (pow x (/ 1.0 n)))) 3.0))))
double code(double x, double n) {
	double tmp;
	if ((1.0 / n) <= -1e-173) {
		tmp = exp((log(x) / n)) / (x * n);
	} else if ((1.0 / n) <= 5e-15) {
		tmp = (log1p(x) + ((0.5 * ((pow(log1p(x), 2.0) - pow(log(x), 2.0)) / n)) - log(x))) / n;
	} else {
		tmp = pow(cbrt((exp((log1p(x) / n)) - pow(x, (1.0 / n)))), 3.0);
	}
	return tmp;
}
public static double code(double x, double n) {
	double tmp;
	if ((1.0 / n) <= -1e-173) {
		tmp = Math.exp((Math.log(x) / n)) / (x * n);
	} else if ((1.0 / n) <= 5e-15) {
		tmp = (Math.log1p(x) + ((0.5 * ((Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0)) / n)) - Math.log(x))) / n;
	} else {
		tmp = Math.pow(Math.cbrt((Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n)))), 3.0);
	}
	return tmp;
}
function code(x, n)
	tmp = 0.0
	if (Float64(1.0 / n) <= -1e-173)
		tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n));
	elseif (Float64(1.0 / n) <= 5e-15)
		tmp = Float64(Float64(log1p(x) + Float64(Float64(0.5 * Float64(Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)) / n)) - log(x))) / n);
	else
		tmp = cbrt(Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n)))) ^ 3.0;
	end
	return tmp
end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-173], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-15], N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(0.5 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[Power[N[Power[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n} - \log x\right)}{n}\\

\mathbf{else}:\\
\;\;\;\;{\left(\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 1 n) < -1e-173

    1. Initial program 72.1%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 85.8%

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    4. Step-by-step derivation
      1. mul-1-neg85.8%

        \[\leadsto \frac{e^{\color{blue}{-\frac{\log \left(\frac{1}{x}\right)}{n}}}}{n \cdot x} \]
      2. log-rec85.8%

        \[\leadsto \frac{e^{-\frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      3. mul-1-neg85.8%

        \[\leadsto \frac{e^{-\frac{\color{blue}{-1 \cdot \log x}}{n}}}{n \cdot x} \]
      4. distribute-neg-frac85.8%

        \[\leadsto \frac{e^{\color{blue}{\frac{--1 \cdot \log x}{n}}}}{n \cdot x} \]
      5. mul-1-neg85.8%

        \[\leadsto \frac{e^{\frac{-\color{blue}{\left(-\log x\right)}}{n}}}{n \cdot x} \]
      6. remove-double-neg85.8%

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x}}{n}}}{n \cdot x} \]
      7. *-commutative85.8%

        \[\leadsto \frac{e^{\frac{\log x}{n}}}{\color{blue}{x \cdot n}} \]
    5. Simplified85.8%

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]

    if -1e-173 < (/.f64 1 n) < 4.99999999999999999e-15

    1. Initial program 39.5%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 86.6%

      \[\leadsto \color{blue}{\frac{\left(\log \left(1 + x\right) + 0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n}\right) - \left(\log x + 0.5 \cdot \frac{{\log x}^{2}}{n}\right)}{n}} \]
    4. Step-by-step derivation
      1. associate--l+86.6%

        \[\leadsto \frac{\color{blue}{\log \left(1 + x\right) + \left(0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n} - \left(\log x + 0.5 \cdot \frac{{\log x}^{2}}{n}\right)\right)}}{n} \]
      2. log1p-define86.6%

        \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} + \left(0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n} - \left(\log x + 0.5 \cdot \frac{{\log x}^{2}}{n}\right)\right)}{n} \]
      3. +-commutative86.6%

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n} - \color{blue}{\left(0.5 \cdot \frac{{\log x}^{2}}{n} + \log x\right)}\right)}{n} \]
      4. associate--r+86.6%

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) + \color{blue}{\left(\left(0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n}\right) - \log x\right)}}{n} \]
      5. distribute-lft-out--86.6%

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) + \left(\color{blue}{0.5 \cdot \left(\frac{{\log \left(1 + x\right)}^{2}}{n} - \frac{{\log x}^{2}}{n}\right)} - \log x\right)}{n} \]
      6. div-sub86.6%

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \color{blue}{\frac{{\log \left(1 + x\right)}^{2} - {\log x}^{2}}{n}} - \log x\right)}{n} \]
      7. log1p-define86.6%

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\color{blue}{\left(\mathsf{log1p}\left(x\right)\right)}}^{2} - {\log x}^{2}}{n} - \log x\right)}{n} \]
    5. Simplified86.6%

      \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n} - \log x\right)}{n}} \]

    if 4.99999999999999999e-15 < (/.f64 1 n)

    1. Initial program 48.3%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt48.3%

        \[\leadsto \color{blue}{\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}} \]
      2. pow348.3%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}} \]
      3. pow-to-exp48.3%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3} \]
      4. un-div-inv48.3%

        \[\leadsto {\left(\sqrt[3]{e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3} \]
      5. +-commutative48.3%

        \[\leadsto {\left(\sqrt[3]{e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3} \]
      6. log1p-define96.3%

        \[\leadsto {\left(\sqrt[3]{e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3} \]
    4. Applied egg-rr96.3%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification87.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-15}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n} - \log x\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 84.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-15}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= (/ 1.0 n) -1e-173)
   (/ (exp (/ (log x) n)) (* x n))
   (if (<= (/ 1.0 n) 5e-15)
     (/ (log (/ (+ x 1.0) x)) n)
     (pow (cbrt (- (exp (/ (log1p x) n)) (pow x (/ 1.0 n)))) 3.0))))
double code(double x, double n) {
	double tmp;
	if ((1.0 / n) <= -1e-173) {
		tmp = exp((log(x) / n)) / (x * n);
	} else if ((1.0 / n) <= 5e-15) {
		tmp = log(((x + 1.0) / x)) / n;
	} else {
		tmp = pow(cbrt((exp((log1p(x) / n)) - pow(x, (1.0 / n)))), 3.0);
	}
	return tmp;
}
public static double code(double x, double n) {
	double tmp;
	if ((1.0 / n) <= -1e-173) {
		tmp = Math.exp((Math.log(x) / n)) / (x * n);
	} else if ((1.0 / n) <= 5e-15) {
		tmp = Math.log(((x + 1.0) / x)) / n;
	} else {
		tmp = Math.pow(Math.cbrt((Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n)))), 3.0);
	}
	return tmp;
}
function code(x, n)
	tmp = 0.0
	if (Float64(1.0 / n) <= -1e-173)
		tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n));
	elseif (Float64(1.0 / n) <= 5e-15)
		tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n);
	else
		tmp = cbrt(Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n)))) ^ 3.0;
	end
	return tmp
end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-173], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-15], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[Power[N[Power[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\

\mathbf{else}:\\
\;\;\;\;{\left(\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 1 n) < -1e-173

    1. Initial program 72.1%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 85.8%

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    4. Step-by-step derivation
      1. mul-1-neg85.8%

        \[\leadsto \frac{e^{\color{blue}{-\frac{\log \left(\frac{1}{x}\right)}{n}}}}{n \cdot x} \]
      2. log-rec85.8%

        \[\leadsto \frac{e^{-\frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      3. mul-1-neg85.8%

        \[\leadsto \frac{e^{-\frac{\color{blue}{-1 \cdot \log x}}{n}}}{n \cdot x} \]
      4. distribute-neg-frac85.8%

        \[\leadsto \frac{e^{\color{blue}{\frac{--1 \cdot \log x}{n}}}}{n \cdot x} \]
      5. mul-1-neg85.8%

        \[\leadsto \frac{e^{\frac{-\color{blue}{\left(-\log x\right)}}{n}}}{n \cdot x} \]
      6. remove-double-neg85.8%

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x}}{n}}}{n \cdot x} \]
      7. *-commutative85.8%

        \[\leadsto \frac{e^{\frac{\log x}{n}}}{\color{blue}{x \cdot n}} \]
    5. Simplified85.8%

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]

    if -1e-173 < (/.f64 1 n) < 4.99999999999999999e-15

    1. Initial program 39.5%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 86.2%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Step-by-step derivation
      1. diff-log86.4%

        \[\leadsto \frac{\color{blue}{\log \left(\frac{1 + x}{x}\right)}}{n} \]
      2. +-commutative86.4%

        \[\leadsto \frac{\log \left(\frac{\color{blue}{x + 1}}{x}\right)}{n} \]
    5. Applied egg-rr86.4%

      \[\leadsto \frac{\color{blue}{\log \left(\frac{x + 1}{x}\right)}}{n} \]

    if 4.99999999999999999e-15 < (/.f64 1 n)

    1. Initial program 48.3%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt48.3%

        \[\leadsto \color{blue}{\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}} \]
      2. pow348.3%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}} \]
      3. pow-to-exp48.3%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3} \]
      4. un-div-inv48.3%

        \[\leadsto {\left(\sqrt[3]{e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3} \]
      5. +-commutative48.3%

        \[\leadsto {\left(\sqrt[3]{e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3} \]
      6. log1p-define96.3%

        \[\leadsto {\left(\sqrt[3]{e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3} \]
    4. Applied egg-rr96.3%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification87.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-15}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 84.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt[3]{e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= (/ 1.0 n) -1e-173)
   (/ (exp (/ (log x) n)) (* x n))
   (if (<= (/ 1.0 n) 5e-13)
     (/ (log (/ (+ x 1.0) x)) n)
     (pow (cbrt (- (exp (/ x n)) (pow x (/ 1.0 n)))) 3.0))))
double code(double x, double n) {
	double tmp;
	if ((1.0 / n) <= -1e-173) {
		tmp = exp((log(x) / n)) / (x * n);
	} else if ((1.0 / n) <= 5e-13) {
		tmp = log(((x + 1.0) / x)) / n;
	} else {
		tmp = pow(cbrt((exp((x / n)) - pow(x, (1.0 / n)))), 3.0);
	}
	return tmp;
}
public static double code(double x, double n) {
	double tmp;
	if ((1.0 / n) <= -1e-173) {
		tmp = Math.exp((Math.log(x) / n)) / (x * n);
	} else if ((1.0 / n) <= 5e-13) {
		tmp = Math.log(((x + 1.0) / x)) / n;
	} else {
		tmp = Math.pow(Math.cbrt((Math.exp((x / n)) - Math.pow(x, (1.0 / n)))), 3.0);
	}
	return tmp;
}
function code(x, n)
	tmp = 0.0
	if (Float64(1.0 / n) <= -1e-173)
		tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n));
	elseif (Float64(1.0 / n) <= 5e-13)
		tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n);
	else
		tmp = cbrt(Float64(exp(Float64(x / n)) - (x ^ Float64(1.0 / n)))) ^ 3.0;
	end
	return tmp
end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-173], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-13], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[Power[N[Power[N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\

\mathbf{else}:\\
\;\;\;\;{\left(\sqrt[3]{e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 1 n) < -1e-173

    1. Initial program 72.1%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 85.8%

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    4. Step-by-step derivation
      1. mul-1-neg85.8%

        \[\leadsto \frac{e^{\color{blue}{-\frac{\log \left(\frac{1}{x}\right)}{n}}}}{n \cdot x} \]
      2. log-rec85.8%

        \[\leadsto \frac{e^{-\frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      3. mul-1-neg85.8%

        \[\leadsto \frac{e^{-\frac{\color{blue}{-1 \cdot \log x}}{n}}}{n \cdot x} \]
      4. distribute-neg-frac85.8%

        \[\leadsto \frac{e^{\color{blue}{\frac{--1 \cdot \log x}{n}}}}{n \cdot x} \]
      5. mul-1-neg85.8%

        \[\leadsto \frac{e^{\frac{-\color{blue}{\left(-\log x\right)}}{n}}}{n \cdot x} \]
      6. remove-double-neg85.8%

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x}}{n}}}{n \cdot x} \]
      7. *-commutative85.8%

        \[\leadsto \frac{e^{\frac{\log x}{n}}}{\color{blue}{x \cdot n}} \]
    5. Simplified85.8%

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]

    if -1e-173 < (/.f64 1 n) < 4.9999999999999999e-13

    1. Initial program 39.2%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 85.3%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Step-by-step derivation
      1. diff-log85.5%

        \[\leadsto \frac{\color{blue}{\log \left(\frac{1 + x}{x}\right)}}{n} \]
      2. +-commutative85.5%

        \[\leadsto \frac{\log \left(\frac{\color{blue}{x + 1}}{x}\right)}{n} \]
    5. Applied egg-rr85.5%

      \[\leadsto \frac{\color{blue}{\log \left(\frac{x + 1}{x}\right)}}{n} \]

    if 4.9999999999999999e-13 < (/.f64 1 n)

    1. Initial program 49.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt49.6%

        \[\leadsto \color{blue}{\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}} \]
      2. pow349.6%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}} \]
      3. pow-to-exp49.6%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3} \]
      4. un-div-inv49.6%

        \[\leadsto {\left(\sqrt[3]{e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3} \]
      5. +-commutative49.6%

        \[\leadsto {\left(\sqrt[3]{e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3} \]
      6. log1p-define99.3%

        \[\leadsto {\left(\sqrt[3]{e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3} \]
    4. Applied egg-rr99.3%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}} \]
    5. Taylor expanded in x around 0 99.3%

      \[\leadsto {\left(\sqrt[3]{e^{\color{blue}{\frac{x}{n}}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification87.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt[3]{e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 84.4% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-15}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= (/ 1.0 n) -1e-173)
   (/ (exp (/ (log x) n)) (* x n))
   (if (<= (/ 1.0 n) 5e-15)
     (/ (log (/ (+ x 1.0) x)) n)
     (- (exp (/ (log1p x) n)) (pow x (/ 1.0 n))))))
double code(double x, double n) {
	double tmp;
	if ((1.0 / n) <= -1e-173) {
		tmp = exp((log(x) / n)) / (x * n);
	} else if ((1.0 / n) <= 5e-15) {
		tmp = log(((x + 1.0) / x)) / n;
	} else {
		tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
	}
	return tmp;
}
public static double code(double x, double n) {
	double tmp;
	if ((1.0 / n) <= -1e-173) {
		tmp = Math.exp((Math.log(x) / n)) / (x * n);
	} else if ((1.0 / n) <= 5e-15) {
		tmp = Math.log(((x + 1.0) / x)) / n;
	} else {
		tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if (1.0 / n) <= -1e-173:
		tmp = math.exp((math.log(x) / n)) / (x * n)
	elif (1.0 / n) <= 5e-15:
		tmp = math.log(((x + 1.0) / x)) / n
	else:
		tmp = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n))
	return tmp
function code(x, n)
	tmp = 0.0
	if (Float64(1.0 / n) <= -1e-173)
		tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n));
	elseif (Float64(1.0 / n) <= 5e-15)
		tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n);
	else
		tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n)));
	end
	return tmp
end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-173], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-15], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\

\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 1 n) < -1e-173

    1. Initial program 72.1%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 85.8%

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    4. Step-by-step derivation
      1. mul-1-neg85.8%

        \[\leadsto \frac{e^{\color{blue}{-\frac{\log \left(\frac{1}{x}\right)}{n}}}}{n \cdot x} \]
      2. log-rec85.8%

        \[\leadsto \frac{e^{-\frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      3. mul-1-neg85.8%

        \[\leadsto \frac{e^{-\frac{\color{blue}{-1 \cdot \log x}}{n}}}{n \cdot x} \]
      4. distribute-neg-frac85.8%

        \[\leadsto \frac{e^{\color{blue}{\frac{--1 \cdot \log x}{n}}}}{n \cdot x} \]
      5. mul-1-neg85.8%

        \[\leadsto \frac{e^{\frac{-\color{blue}{\left(-\log x\right)}}{n}}}{n \cdot x} \]
      6. remove-double-neg85.8%

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x}}{n}}}{n \cdot x} \]
      7. *-commutative85.8%

        \[\leadsto \frac{e^{\frac{\log x}{n}}}{\color{blue}{x \cdot n}} \]
    5. Simplified85.8%

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]

    if -1e-173 < (/.f64 1 n) < 4.99999999999999999e-15

    1. Initial program 39.5%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 86.2%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Step-by-step derivation
      1. diff-log86.4%

        \[\leadsto \frac{\color{blue}{\log \left(\frac{1 + x}{x}\right)}}{n} \]
      2. +-commutative86.4%

        \[\leadsto \frac{\log \left(\frac{\color{blue}{x + 1}}{x}\right)}{n} \]
    5. Applied egg-rr86.4%

      \[\leadsto \frac{\color{blue}{\log \left(\frac{x + 1}{x}\right)}}{n} \]

    if 4.99999999999999999e-15 < (/.f64 1 n)

    1. Initial program 48.3%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around 0 48.3%

      \[\leadsto \color{blue}{e^{\frac{\log \left(1 + x\right)}{n}}} - {x}^{\left(\frac{1}{n}\right)} \]
    4. Step-by-step derivation
      1. log1p-define96.3%

        \[\leadsto e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}} - {x}^{\left(\frac{1}{n}\right)} \]
    5. Simplified96.3%

      \[\leadsto \color{blue}{e^{\frac{\mathsf{log1p}\left(x\right)}{n}}} - {x}^{\left(\frac{1}{n}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification87.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-15}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 81.0% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + x \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right)\right) - {x}^{\left(\frac{1}{n}\right)}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= (/ 1.0 n) -1e-173)
   (/ (exp (/ (log x) n)) (* x n))
   (if (<= (/ 1.0 n) 5e-13)
     (/ (log (/ (+ x 1.0) x)) n)
     (-
      (+
       1.0
       (*
        x
        (+
         (/ 1.0 n)
         (* x (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n)))))))
      (pow x (/ 1.0 n))))))
double code(double x, double n) {
	double tmp;
	if ((1.0 / n) <= -1e-173) {
		tmp = exp((log(x) / n)) / (x * n);
	} else if ((1.0 / n) <= 5e-13) {
		tmp = log(((x + 1.0) / x)) / n;
	} else {
		tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / n))))))) - pow(x, (1.0 / n));
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: tmp
    if ((1.0d0 / n) <= (-1d-173)) then
        tmp = exp((log(x) / n)) / (x * n)
    else if ((1.0d0 / n) <= 5d-13) then
        tmp = log(((x + 1.0d0) / x)) / n
    else
        tmp = (1.0d0 + (x * ((1.0d0 / n) + (x * ((0.5d0 * (1.0d0 / (n ** 2.0d0))) + (0.5d0 * ((-1.0d0) / n))))))) - (x ** (1.0d0 / n))
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double tmp;
	if ((1.0 / n) <= -1e-173) {
		tmp = Math.exp((Math.log(x) / n)) / (x * n);
	} else if ((1.0 / n) <= 5e-13) {
		tmp = Math.log(((x + 1.0) / x)) / n;
	} else {
		tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / Math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))))) - Math.pow(x, (1.0 / n));
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if (1.0 / n) <= -1e-173:
		tmp = math.exp((math.log(x) / n)) / (x * n)
	elif (1.0 / n) <= 5e-13:
		tmp = math.log(((x + 1.0) / x)) / n
	else:
		tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))))) - math.pow(x, (1.0 / n))
	return tmp
function code(x, n)
	tmp = 0.0
	if (Float64(1.0 / n) <= -1e-173)
		tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n));
	elseif (Float64(1.0 / n) <= 5e-13)
		tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n);
	else
		tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(x * Float64(Float64(0.5 * Float64(1.0 / (n ^ 2.0))) + Float64(0.5 * Float64(-1.0 / n))))))) - (x ^ Float64(1.0 / n)));
	end
	return tmp
end
function tmp_2 = code(x, n)
	tmp = 0.0;
	if ((1.0 / n) <= -1e-173)
		tmp = exp((log(x) / n)) / (x * n);
	elseif ((1.0 / n) <= 5e-13)
		tmp = log(((x + 1.0) / x)) / n;
	else
		tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / (n ^ 2.0))) + (0.5 * (-1.0 / n))))))) - (x ^ (1.0 / n));
	end
	tmp_2 = tmp;
end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-173], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-13], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(x * N[(N[(0.5 * N[(1.0 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\

\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + x \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right)\right) - {x}^{\left(\frac{1}{n}\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 1 n) < -1e-173

    1. Initial program 72.1%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 85.8%

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    4. Step-by-step derivation
      1. mul-1-neg85.8%

        \[\leadsto \frac{e^{\color{blue}{-\frac{\log \left(\frac{1}{x}\right)}{n}}}}{n \cdot x} \]
      2. log-rec85.8%

        \[\leadsto \frac{e^{-\frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      3. mul-1-neg85.8%

        \[\leadsto \frac{e^{-\frac{\color{blue}{-1 \cdot \log x}}{n}}}{n \cdot x} \]
      4. distribute-neg-frac85.8%

        \[\leadsto \frac{e^{\color{blue}{\frac{--1 \cdot \log x}{n}}}}{n \cdot x} \]
      5. mul-1-neg85.8%

        \[\leadsto \frac{e^{\frac{-\color{blue}{\left(-\log x\right)}}{n}}}{n \cdot x} \]
      6. remove-double-neg85.8%

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x}}{n}}}{n \cdot x} \]
      7. *-commutative85.8%

        \[\leadsto \frac{e^{\frac{\log x}{n}}}{\color{blue}{x \cdot n}} \]
    5. Simplified85.8%

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]

    if -1e-173 < (/.f64 1 n) < 4.9999999999999999e-13

    1. Initial program 39.2%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 85.3%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Step-by-step derivation
      1. diff-log85.5%

        \[\leadsto \frac{\color{blue}{\log \left(\frac{1 + x}{x}\right)}}{n} \]
      2. +-commutative85.5%

        \[\leadsto \frac{\log \left(\frac{\color{blue}{x + 1}}{x}\right)}{n} \]
    5. Applied egg-rr85.5%

      \[\leadsto \frac{\color{blue}{\log \left(\frac{x + 1}{x}\right)}}{n} \]

    if 4.9999999999999999e-13 < (/.f64 1 n)

    1. Initial program 49.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 81.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + x \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right)\right) - {x}^{\left(\frac{1}{n}\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 66.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+252}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{+208}:\\ \;\;\;\;1 - t\_0\\ \mathbf{elif}\;\frac{1}{n} \leq -4 \cdot 10^{+161}:\\ \;\;\;\;0\\ \mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{x}}{n}\right)\right)\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+130}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (log (/ (+ x 1.0) x)) n)))
   (if (<= (/ 1.0 n) -1e+252)
     t_1
     (if (<= (/ 1.0 n) -1e+208)
       (- 1.0 t_0)
       (if (<= (/ 1.0 n) -4e+161)
         0.0
         (if (<= (/ 1.0 n) -1e-173)
           (log1p (expm1 (/ (/ 1.0 x) n)))
           (if (<= (/ 1.0 n) 5e-13)
             t_1
             (if (<= (/ 1.0 n) 2e+130)
               (- (+ 1.0 (/ x n)) t_0)
               (/
                (+
                 (/ 1.0 n)
                 (/
                  (/
                   (- (* n 0.3333333333333333) (* 0.5 (* x n)))
                   (* n (* x n)))
                  x))
                x)))))))))
double code(double x, double n) {
	double t_0 = pow(x, (1.0 / n));
	double t_1 = log(((x + 1.0) / x)) / n;
	double tmp;
	if ((1.0 / n) <= -1e+252) {
		tmp = t_1;
	} else if ((1.0 / n) <= -1e+208) {
		tmp = 1.0 - t_0;
	} else if ((1.0 / n) <= -4e+161) {
		tmp = 0.0;
	} else if ((1.0 / n) <= -1e-173) {
		tmp = log1p(expm1(((1.0 / x) / n)));
	} else if ((1.0 / n) <= 5e-13) {
		tmp = t_1;
	} else if ((1.0 / n) <= 2e+130) {
		tmp = (1.0 + (x / n)) - t_0;
	} else {
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	}
	return tmp;
}
public static double code(double x, double n) {
	double t_0 = Math.pow(x, (1.0 / n));
	double t_1 = Math.log(((x + 1.0) / x)) / n;
	double tmp;
	if ((1.0 / n) <= -1e+252) {
		tmp = t_1;
	} else if ((1.0 / n) <= -1e+208) {
		tmp = 1.0 - t_0;
	} else if ((1.0 / n) <= -4e+161) {
		tmp = 0.0;
	} else if ((1.0 / n) <= -1e-173) {
		tmp = Math.log1p(Math.expm1(((1.0 / x) / n)));
	} else if ((1.0 / n) <= 5e-13) {
		tmp = t_1;
	} else if ((1.0 / n) <= 2e+130) {
		tmp = (1.0 + (x / n)) - t_0;
	} else {
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	}
	return tmp;
}
def code(x, n):
	t_0 = math.pow(x, (1.0 / n))
	t_1 = math.log(((x + 1.0) / x)) / n
	tmp = 0
	if (1.0 / n) <= -1e+252:
		tmp = t_1
	elif (1.0 / n) <= -1e+208:
		tmp = 1.0 - t_0
	elif (1.0 / n) <= -4e+161:
		tmp = 0.0
	elif (1.0 / n) <= -1e-173:
		tmp = math.log1p(math.expm1(((1.0 / x) / n)))
	elif (1.0 / n) <= 5e-13:
		tmp = t_1
	elif (1.0 / n) <= 2e+130:
		tmp = (1.0 + (x / n)) - t_0
	else:
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x
	return tmp
function code(x, n)
	t_0 = x ^ Float64(1.0 / n)
	t_1 = Float64(log(Float64(Float64(x + 1.0) / x)) / n)
	tmp = 0.0
	if (Float64(1.0 / n) <= -1e+252)
		tmp = t_1;
	elseif (Float64(1.0 / n) <= -1e+208)
		tmp = Float64(1.0 - t_0);
	elseif (Float64(1.0 / n) <= -4e+161)
		tmp = 0.0;
	elseif (Float64(1.0 / n) <= -1e-173)
		tmp = log1p(expm1(Float64(Float64(1.0 / x) / n)));
	elseif (Float64(1.0 / n) <= 5e-13)
		tmp = t_1;
	elseif (Float64(1.0 / n) <= 2e+130)
		tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0);
	else
		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(n * 0.3333333333333333) - Float64(0.5 * Float64(x * n))) / Float64(n * Float64(x * n))) / x)) / x);
	end
	return tmp
end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+252], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+208], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e+161], 0.0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-173], N[Log[1 + N[(Exp[N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-13], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+130], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(n * 0.3333333333333333), $MachinePrecision] - N[(0.5 * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(n * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+252}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{+208}:\\
\;\;\;\;1 - t\_0\\

\mathbf{elif}\;\frac{1}{n} \leq -4 \cdot 10^{+161}:\\
\;\;\;\;0\\

\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{x}}{n}\right)\right)\\

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+130}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if (/.f64 1 n) < -1.0000000000000001e252 or -1e-173 < (/.f64 1 n) < 4.9999999999999999e-13

    1. Initial program 46.5%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 83.7%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Step-by-step derivation
      1. diff-log83.9%

        \[\leadsto \frac{\color{blue}{\log \left(\frac{1 + x}{x}\right)}}{n} \]
      2. +-commutative83.9%

        \[\leadsto \frac{\log \left(\frac{\color{blue}{x + 1}}{x}\right)}{n} \]
    5. Applied egg-rr83.9%

      \[\leadsto \frac{\color{blue}{\log \left(\frac{x + 1}{x}\right)}}{n} \]

    if -1.0000000000000001e252 < (/.f64 1 n) < -9.9999999999999998e207

    1. Initial program 100.0%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 73.6%

      \[\leadsto \color{blue}{1} - {x}^{\left(\frac{1}{n}\right)} \]

    if -9.9999999999999998e207 < (/.f64 1 n) < -4.0000000000000002e161

    1. Initial program 100.0%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + \left(-{x}^{\left(\frac{1}{n}\right)}\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(-{x}^{\left(\frac{1}{n}\right)}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \]
      3. add-cube-cbrt100.0%

        \[\leadsto \color{blue}{\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}} + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
      4. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
      5. pow-to-exp100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
      6. un-div-inv100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
      7. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
      8. log1p-define100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right) \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)} \]
    5. Taylor expanded in x around inf 84.6%

      \[\leadsto \color{blue}{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + {\left(\sqrt[3]{-1}\right)}^{3} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
    6. Step-by-step derivation
      1. rem-cube-cbrt84.6%

        \[\leadsto e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + \color{blue}{-1} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      2. distribute-rgt1-in84.6%

        \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
      3. metadata-eval84.6%

        \[\leadsto \color{blue}{0} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      4. mul0-lft84.9%

        \[\leadsto \color{blue}{0} \]
    7. Simplified84.9%

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

    if -4.0000000000000002e161 < (/.f64 1 n) < -1e-173

    1. Initial program 60.9%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 46.6%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around -inf 30.9%

      \[\leadsto \frac{\color{blue}{-1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{0.25 \cdot \frac{1}{x} - 0.3333333333333333}{x} - 0.5}{x} - 1}{x}}}{n} \]
    5. Taylor expanded in x around inf 39.6%

      \[\leadsto \color{blue}{\frac{1}{n \cdot x}} \]
    6. Step-by-step derivation
      1. *-commutative39.6%

        \[\leadsto \frac{1}{\color{blue}{x \cdot n}} \]
    7. Simplified39.6%

      \[\leadsto \color{blue}{\frac{1}{x \cdot n}} \]
    8. Step-by-step derivation
      1. log1p-expm1-u59.8%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{x \cdot n}\right)\right)} \]
      2. associate-/r*61.2%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{\frac{\frac{1}{x}}{n}}\right)\right) \]
    9. Applied egg-rr61.2%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{x}}{n}\right)\right)} \]

    if 4.9999999999999999e-13 < (/.f64 1 n) < 2.0000000000000001e130

    1. Initial program 75.1%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 75.2%

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

    if 2.0000000000000001e130 < (/.f64 1 n)

    1. Initial program 22.5%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 6.1%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around -inf 80.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
    5. Step-by-step derivation
      1. associate-*r/80.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}{x}} \]
      2. mul-1-neg80.8%

        \[\leadsto \frac{\color{blue}{-\left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}}{x} \]
      3. associate-*r/80.8%

        \[\leadsto \frac{-\left(\color{blue}{\frac{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x}} - \frac{1}{n}\right)}{x} \]
      4. mul-1-neg80.8%

        \[\leadsto \frac{-\left(\frac{\color{blue}{-\left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}}{x} - \frac{1}{n}\right)}{x} \]
      5. associate-*r/80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\color{blue}{\frac{0.3333333333333333 \cdot 1}{n \cdot x}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      6. metadata-eval80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{\color{blue}{0.3333333333333333}}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      7. *-commutative80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{\color{blue}{x \cdot n}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      8. associate-*r/80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)}{x} - \frac{1}{n}\right)}{x} \]
      9. metadata-eval80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{\color{blue}{0.5}}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
    6. Simplified80.8%

      \[\leadsto \color{blue}{\frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}\right)}{x} - \frac{1}{n}\right)}{x}} \]
    7. Step-by-step derivation
      1. frac-sub87.1%

        \[\leadsto \frac{-\left(\frac{-\color{blue}{\frac{0.3333333333333333 \cdot n - \left(x \cdot n\right) \cdot 0.5}{\left(x \cdot n\right) \cdot n}}}{x} - \frac{1}{n}\right)}{x} \]
    8. Applied egg-rr87.1%

      \[\leadsto \frac{-\left(\frac{-\color{blue}{\frac{0.3333333333333333 \cdot n - \left(x \cdot n\right) \cdot 0.5}{\left(x \cdot n\right) \cdot n}}}{x} - \frac{1}{n}\right)}{x} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification74.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+252}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{+208}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;\frac{1}{n} \leq -4 \cdot 10^{+161}:\\ \;\;\;\;0\\ \mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{x}}{n}\right)\right)\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+130}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 80.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+130}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= (/ 1.0 n) -1e-173)
   (/ (exp (/ (log x) n)) (* x n))
   (if (<= (/ 1.0 n) 5e-13)
     (/ (log (/ (+ x 1.0) x)) n)
     (if (<= (/ 1.0 n) 2e+130)
       (- (+ 1.0 (/ x n)) (pow x (/ 1.0 n)))
       (/
        (+
         (/ 1.0 n)
         (/ (/ (- (* n 0.3333333333333333) (* 0.5 (* x n))) (* n (* x n))) x))
        x)))))
double code(double x, double n) {
	double tmp;
	if ((1.0 / n) <= -1e-173) {
		tmp = exp((log(x) / n)) / (x * n);
	} else if ((1.0 / n) <= 5e-13) {
		tmp = log(((x + 1.0) / x)) / n;
	} else if ((1.0 / n) <= 2e+130) {
		tmp = (1.0 + (x / n)) - pow(x, (1.0 / n));
	} else {
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: tmp
    if ((1.0d0 / n) <= (-1d-173)) then
        tmp = exp((log(x) / n)) / (x * n)
    else if ((1.0d0 / n) <= 5d-13) then
        tmp = log(((x + 1.0d0) / x)) / n
    else if ((1.0d0 / n) <= 2d+130) then
        tmp = (1.0d0 + (x / n)) - (x ** (1.0d0 / n))
    else
        tmp = ((1.0d0 / n) + ((((n * 0.3333333333333333d0) - (0.5d0 * (x * n))) / (n * (x * n))) / x)) / x
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double tmp;
	if ((1.0 / n) <= -1e-173) {
		tmp = Math.exp((Math.log(x) / n)) / (x * n);
	} else if ((1.0 / n) <= 5e-13) {
		tmp = Math.log(((x + 1.0) / x)) / n;
	} else if ((1.0 / n) <= 2e+130) {
		tmp = (1.0 + (x / n)) - Math.pow(x, (1.0 / n));
	} else {
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if (1.0 / n) <= -1e-173:
		tmp = math.exp((math.log(x) / n)) / (x * n)
	elif (1.0 / n) <= 5e-13:
		tmp = math.log(((x + 1.0) / x)) / n
	elif (1.0 / n) <= 2e+130:
		tmp = (1.0 + (x / n)) - math.pow(x, (1.0 / n))
	else:
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x
	return tmp
function code(x, n)
	tmp = 0.0
	if (Float64(1.0 / n) <= -1e-173)
		tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n));
	elseif (Float64(1.0 / n) <= 5e-13)
		tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n);
	elseif (Float64(1.0 / n) <= 2e+130)
		tmp = Float64(Float64(1.0 + Float64(x / n)) - (x ^ Float64(1.0 / n)));
	else
		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(n * 0.3333333333333333) - Float64(0.5 * Float64(x * n))) / Float64(n * Float64(x * n))) / x)) / x);
	end
	return tmp
end
function tmp_2 = code(x, n)
	tmp = 0.0;
	if ((1.0 / n) <= -1e-173)
		tmp = exp((log(x) / n)) / (x * n);
	elseif ((1.0 / n) <= 5e-13)
		tmp = log(((x + 1.0) / x)) / n;
	elseif ((1.0 / n) <= 2e+130)
		tmp = (1.0 + (x / n)) - (x ^ (1.0 / n));
	else
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	end
	tmp_2 = tmp;
end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-173], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-13], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+130], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(n * 0.3333333333333333), $MachinePrecision] - N[(0.5 * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(n * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\

\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+130}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 1 n) < -1e-173

    1. Initial program 72.1%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 85.8%

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    4. Step-by-step derivation
      1. mul-1-neg85.8%

        \[\leadsto \frac{e^{\color{blue}{-\frac{\log \left(\frac{1}{x}\right)}{n}}}}{n \cdot x} \]
      2. log-rec85.8%

        \[\leadsto \frac{e^{-\frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      3. mul-1-neg85.8%

        \[\leadsto \frac{e^{-\frac{\color{blue}{-1 \cdot \log x}}{n}}}{n \cdot x} \]
      4. distribute-neg-frac85.8%

        \[\leadsto \frac{e^{\color{blue}{\frac{--1 \cdot \log x}{n}}}}{n \cdot x} \]
      5. mul-1-neg85.8%

        \[\leadsto \frac{e^{\frac{-\color{blue}{\left(-\log x\right)}}{n}}}{n \cdot x} \]
      6. remove-double-neg85.8%

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x}}{n}}}{n \cdot x} \]
      7. *-commutative85.8%

        \[\leadsto \frac{e^{\frac{\log x}{n}}}{\color{blue}{x \cdot n}} \]
    5. Simplified85.8%

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]

    if -1e-173 < (/.f64 1 n) < 4.9999999999999999e-13

    1. Initial program 39.2%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 85.3%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Step-by-step derivation
      1. diff-log85.5%

        \[\leadsto \frac{\color{blue}{\log \left(\frac{1 + x}{x}\right)}}{n} \]
      2. +-commutative85.5%

        \[\leadsto \frac{\log \left(\frac{\color{blue}{x + 1}}{x}\right)}{n} \]
    5. Applied egg-rr85.5%

      \[\leadsto \frac{\color{blue}{\log \left(\frac{x + 1}{x}\right)}}{n} \]

    if 4.9999999999999999e-13 < (/.f64 1 n) < 2.0000000000000001e130

    1. Initial program 75.1%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 75.2%

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

    if 2.0000000000000001e130 < (/.f64 1 n)

    1. Initial program 22.5%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 6.1%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around -inf 80.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
    5. Step-by-step derivation
      1. associate-*r/80.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}{x}} \]
      2. mul-1-neg80.8%

        \[\leadsto \frac{\color{blue}{-\left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}}{x} \]
      3. associate-*r/80.8%

        \[\leadsto \frac{-\left(\color{blue}{\frac{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x}} - \frac{1}{n}\right)}{x} \]
      4. mul-1-neg80.8%

        \[\leadsto \frac{-\left(\frac{\color{blue}{-\left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}}{x} - \frac{1}{n}\right)}{x} \]
      5. associate-*r/80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\color{blue}{\frac{0.3333333333333333 \cdot 1}{n \cdot x}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      6. metadata-eval80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{\color{blue}{0.3333333333333333}}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      7. *-commutative80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{\color{blue}{x \cdot n}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      8. associate-*r/80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)}{x} - \frac{1}{n}\right)}{x} \]
      9. metadata-eval80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{\color{blue}{0.5}}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
    6. Simplified80.8%

      \[\leadsto \color{blue}{\frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}\right)}{x} - \frac{1}{n}\right)}{x}} \]
    7. Step-by-step derivation
      1. frac-sub87.1%

        \[\leadsto \frac{-\left(\frac{-\color{blue}{\frac{0.3333333333333333 \cdot n - \left(x \cdot n\right) \cdot 0.5}{\left(x \cdot n\right) \cdot n}}}{x} - \frac{1}{n}\right)}{x} \]
    8. Applied egg-rr87.1%

      \[\leadsto \frac{-\left(\frac{-\color{blue}{\frac{0.3333333333333333 \cdot n - \left(x \cdot n\right) \cdot 0.5}{\left(x \cdot n\right) \cdot n}}}{x} - \frac{1}{n}\right)}{x} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification85.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-173}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+130}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 68.5% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ t_1 := 1 - t\_0\\ t_2 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+252}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{+208}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{1}{n} \leq -4 \cdot 10^{+161}:\\ \;\;\;\;0\\ \mathbf{elif}\;\frac{1}{n} \leq -10000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+130}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (pow x (/ 1.0 n)))
        (t_1 (- 1.0 t_0))
        (t_2 (/ (log (/ (+ x 1.0) x)) n)))
   (if (<= (/ 1.0 n) -1e+252)
     t_2
     (if (<= (/ 1.0 n) -1e+208)
       t_1
       (if (<= (/ 1.0 n) -4e+161)
         0.0
         (if (<= (/ 1.0 n) -10000.0)
           t_1
           (if (<= (/ 1.0 n) 5e-13)
             t_2
             (if (<= (/ 1.0 n) 2e+130)
               (- (+ 1.0 (/ x n)) t_0)
               (/
                (+
                 (/ 1.0 n)
                 (/
                  (/
                   (- (* n 0.3333333333333333) (* 0.5 (* x n)))
                   (* n (* x n)))
                  x))
                x)))))))))
double code(double x, double n) {
	double t_0 = pow(x, (1.0 / n));
	double t_1 = 1.0 - t_0;
	double t_2 = log(((x + 1.0) / x)) / n;
	double tmp;
	if ((1.0 / n) <= -1e+252) {
		tmp = t_2;
	} else if ((1.0 / n) <= -1e+208) {
		tmp = t_1;
	} else if ((1.0 / n) <= -4e+161) {
		tmp = 0.0;
	} else if ((1.0 / n) <= -10000.0) {
		tmp = t_1;
	} else if ((1.0 / n) <= 5e-13) {
		tmp = t_2;
	} else if ((1.0 / n) <= 2e+130) {
		tmp = (1.0 + (x / n)) - t_0;
	} else {
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = x ** (1.0d0 / n)
    t_1 = 1.0d0 - t_0
    t_2 = log(((x + 1.0d0) / x)) / n
    if ((1.0d0 / n) <= (-1d+252)) then
        tmp = t_2
    else if ((1.0d0 / n) <= (-1d+208)) then
        tmp = t_1
    else if ((1.0d0 / n) <= (-4d+161)) then
        tmp = 0.0d0
    else if ((1.0d0 / n) <= (-10000.0d0)) then
        tmp = t_1
    else if ((1.0d0 / n) <= 5d-13) then
        tmp = t_2
    else if ((1.0d0 / n) <= 2d+130) then
        tmp = (1.0d0 + (x / n)) - t_0
    else
        tmp = ((1.0d0 / n) + ((((n * 0.3333333333333333d0) - (0.5d0 * (x * n))) / (n * (x * n))) / x)) / x
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double t_0 = Math.pow(x, (1.0 / n));
	double t_1 = 1.0 - t_0;
	double t_2 = Math.log(((x + 1.0) / x)) / n;
	double tmp;
	if ((1.0 / n) <= -1e+252) {
		tmp = t_2;
	} else if ((1.0 / n) <= -1e+208) {
		tmp = t_1;
	} else if ((1.0 / n) <= -4e+161) {
		tmp = 0.0;
	} else if ((1.0 / n) <= -10000.0) {
		tmp = t_1;
	} else if ((1.0 / n) <= 5e-13) {
		tmp = t_2;
	} else if ((1.0 / n) <= 2e+130) {
		tmp = (1.0 + (x / n)) - t_0;
	} else {
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	}
	return tmp;
}
def code(x, n):
	t_0 = math.pow(x, (1.0 / n))
	t_1 = 1.0 - t_0
	t_2 = math.log(((x + 1.0) / x)) / n
	tmp = 0
	if (1.0 / n) <= -1e+252:
		tmp = t_2
	elif (1.0 / n) <= -1e+208:
		tmp = t_1
	elif (1.0 / n) <= -4e+161:
		tmp = 0.0
	elif (1.0 / n) <= -10000.0:
		tmp = t_1
	elif (1.0 / n) <= 5e-13:
		tmp = t_2
	elif (1.0 / n) <= 2e+130:
		tmp = (1.0 + (x / n)) - t_0
	else:
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x
	return tmp
function code(x, n)
	t_0 = x ^ Float64(1.0 / n)
	t_1 = Float64(1.0 - t_0)
	t_2 = Float64(log(Float64(Float64(x + 1.0) / x)) / n)
	tmp = 0.0
	if (Float64(1.0 / n) <= -1e+252)
		tmp = t_2;
	elseif (Float64(1.0 / n) <= -1e+208)
		tmp = t_1;
	elseif (Float64(1.0 / n) <= -4e+161)
		tmp = 0.0;
	elseif (Float64(1.0 / n) <= -10000.0)
		tmp = t_1;
	elseif (Float64(1.0 / n) <= 5e-13)
		tmp = t_2;
	elseif (Float64(1.0 / n) <= 2e+130)
		tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0);
	else
		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(n * 0.3333333333333333) - Float64(0.5 * Float64(x * n))) / Float64(n * Float64(x * n))) / x)) / x);
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = x ^ (1.0 / n);
	t_1 = 1.0 - t_0;
	t_2 = log(((x + 1.0) / x)) / n;
	tmp = 0.0;
	if ((1.0 / n) <= -1e+252)
		tmp = t_2;
	elseif ((1.0 / n) <= -1e+208)
		tmp = t_1;
	elseif ((1.0 / n) <= -4e+161)
		tmp = 0.0;
	elseif ((1.0 / n) <= -10000.0)
		tmp = t_1;
	elseif ((1.0 / n) <= 5e-13)
		tmp = t_2;
	elseif ((1.0 / n) <= 2e+130)
		tmp = (1.0 + (x / n)) - t_0;
	else
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+252], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+208], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e+161], 0.0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -10000.0], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-13], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+130], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(n * 0.3333333333333333), $MachinePrecision] - N[(0.5 * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(n * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := 1 - t\_0\\
t_2 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+252}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{+208}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{1}{n} \leq -4 \cdot 10^{+161}:\\
\;\;\;\;0\\

\mathbf{elif}\;\frac{1}{n} \leq -10000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+130}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if (/.f64 1 n) < -1.0000000000000001e252 or -1e4 < (/.f64 1 n) < 4.9999999999999999e-13

    1. Initial program 40.1%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 74.3%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Step-by-step derivation
      1. diff-log74.6%

        \[\leadsto \frac{\color{blue}{\log \left(\frac{1 + x}{x}\right)}}{n} \]
      2. +-commutative74.6%

        \[\leadsto \frac{\log \left(\frac{\color{blue}{x + 1}}{x}\right)}{n} \]
    5. Applied egg-rr74.6%

      \[\leadsto \frac{\color{blue}{\log \left(\frac{x + 1}{x}\right)}}{n} \]

    if -1.0000000000000001e252 < (/.f64 1 n) < -9.9999999999999998e207 or -4.0000000000000002e161 < (/.f64 1 n) < -1e4

    1. Initial program 100.0%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 66.5%

      \[\leadsto \color{blue}{1} - {x}^{\left(\frac{1}{n}\right)} \]

    if -9.9999999999999998e207 < (/.f64 1 n) < -4.0000000000000002e161

    1. Initial program 100.0%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + \left(-{x}^{\left(\frac{1}{n}\right)}\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(-{x}^{\left(\frac{1}{n}\right)}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \]
      3. add-cube-cbrt100.0%

        \[\leadsto \color{blue}{\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}} + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
      4. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
      5. pow-to-exp100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
      6. un-div-inv100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
      7. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
      8. log1p-define100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right) \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)} \]
    5. Taylor expanded in x around inf 84.6%

      \[\leadsto \color{blue}{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + {\left(\sqrt[3]{-1}\right)}^{3} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
    6. Step-by-step derivation
      1. rem-cube-cbrt84.6%

        \[\leadsto e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + \color{blue}{-1} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      2. distribute-rgt1-in84.6%

        \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
      3. metadata-eval84.6%

        \[\leadsto \color{blue}{0} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      4. mul0-lft84.9%

        \[\leadsto \color{blue}{0} \]
    7. Simplified84.9%

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

    if 4.9999999999999999e-13 < (/.f64 1 n) < 2.0000000000000001e130

    1. Initial program 75.1%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 75.2%

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

    if 2.0000000000000001e130 < (/.f64 1 n)

    1. Initial program 22.5%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 6.1%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around -inf 80.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
    5. Step-by-step derivation
      1. associate-*r/80.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}{x}} \]
      2. mul-1-neg80.8%

        \[\leadsto \frac{\color{blue}{-\left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}}{x} \]
      3. associate-*r/80.8%

        \[\leadsto \frac{-\left(\color{blue}{\frac{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x}} - \frac{1}{n}\right)}{x} \]
      4. mul-1-neg80.8%

        \[\leadsto \frac{-\left(\frac{\color{blue}{-\left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}}{x} - \frac{1}{n}\right)}{x} \]
      5. associate-*r/80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\color{blue}{\frac{0.3333333333333333 \cdot 1}{n \cdot x}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      6. metadata-eval80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{\color{blue}{0.3333333333333333}}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      7. *-commutative80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{\color{blue}{x \cdot n}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      8. associate-*r/80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)}{x} - \frac{1}{n}\right)}{x} \]
      9. metadata-eval80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{\color{blue}{0.5}}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
    6. Simplified80.8%

      \[\leadsto \color{blue}{\frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}\right)}{x} - \frac{1}{n}\right)}{x}} \]
    7. Step-by-step derivation
      1. frac-sub87.1%

        \[\leadsto \frac{-\left(\frac{-\color{blue}{\frac{0.3333333333333333 \cdot n - \left(x \cdot n\right) \cdot 0.5}{\left(x \cdot n\right) \cdot n}}}{x} - \frac{1}{n}\right)}{x} \]
    8. Applied egg-rr87.1%

      \[\leadsto \frac{-\left(\frac{-\color{blue}{\frac{0.3333333333333333 \cdot n - \left(x \cdot n\right) \cdot 0.5}{\left(x \cdot n\right) \cdot n}}}{x} - \frac{1}{n}\right)}{x} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification74.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+252}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{+208}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;\frac{1}{n} \leq -4 \cdot 10^{+161}:\\ \;\;\;\;0\\ \mathbf{elif}\;\frac{1}{n} \leq -10000:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+130}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 68.5% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+252}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{+208}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\frac{1}{n} \leq -4 \cdot 10^{+161}:\\ \;\;\;\;0\\ \mathbf{elif}\;\frac{1}{n} \leq -10000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+130}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (log (/ (+ x 1.0) x)) n)))
   (if (<= (/ 1.0 n) -1e+252)
     t_1
     (if (<= (/ 1.0 n) -1e+208)
       t_0
       (if (<= (/ 1.0 n) -4e+161)
         0.0
         (if (<= (/ 1.0 n) -10000.0)
           t_0
           (if (<= (/ 1.0 n) 5e-13)
             t_1
             (if (<= (/ 1.0 n) 2e+130)
               t_0
               (/
                (+
                 (/ 1.0 n)
                 (/
                  (/
                   (- (* n 0.3333333333333333) (* 0.5 (* x n)))
                   (* n (* x n)))
                  x))
                x)))))))))
double code(double x, double n) {
	double t_0 = 1.0 - pow(x, (1.0 / n));
	double t_1 = log(((x + 1.0) / x)) / n;
	double tmp;
	if ((1.0 / n) <= -1e+252) {
		tmp = t_1;
	} else if ((1.0 / n) <= -1e+208) {
		tmp = t_0;
	} else if ((1.0 / n) <= -4e+161) {
		tmp = 0.0;
	} else if ((1.0 / n) <= -10000.0) {
		tmp = t_0;
	} else if ((1.0 / n) <= 5e-13) {
		tmp = t_1;
	} else if ((1.0 / n) <= 2e+130) {
		tmp = t_0;
	} else {
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 1.0d0 - (x ** (1.0d0 / n))
    t_1 = log(((x + 1.0d0) / x)) / n
    if ((1.0d0 / n) <= (-1d+252)) then
        tmp = t_1
    else if ((1.0d0 / n) <= (-1d+208)) then
        tmp = t_0
    else if ((1.0d0 / n) <= (-4d+161)) then
        tmp = 0.0d0
    else if ((1.0d0 / n) <= (-10000.0d0)) then
        tmp = t_0
    else if ((1.0d0 / n) <= 5d-13) then
        tmp = t_1
    else if ((1.0d0 / n) <= 2d+130) then
        tmp = t_0
    else
        tmp = ((1.0d0 / n) + ((((n * 0.3333333333333333d0) - (0.5d0 * (x * n))) / (n * (x * n))) / x)) / x
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double t_0 = 1.0 - Math.pow(x, (1.0 / n));
	double t_1 = Math.log(((x + 1.0) / x)) / n;
	double tmp;
	if ((1.0 / n) <= -1e+252) {
		tmp = t_1;
	} else if ((1.0 / n) <= -1e+208) {
		tmp = t_0;
	} else if ((1.0 / n) <= -4e+161) {
		tmp = 0.0;
	} else if ((1.0 / n) <= -10000.0) {
		tmp = t_0;
	} else if ((1.0 / n) <= 5e-13) {
		tmp = t_1;
	} else if ((1.0 / n) <= 2e+130) {
		tmp = t_0;
	} else {
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	}
	return tmp;
}
def code(x, n):
	t_0 = 1.0 - math.pow(x, (1.0 / n))
	t_1 = math.log(((x + 1.0) / x)) / n
	tmp = 0
	if (1.0 / n) <= -1e+252:
		tmp = t_1
	elif (1.0 / n) <= -1e+208:
		tmp = t_0
	elif (1.0 / n) <= -4e+161:
		tmp = 0.0
	elif (1.0 / n) <= -10000.0:
		tmp = t_0
	elif (1.0 / n) <= 5e-13:
		tmp = t_1
	elif (1.0 / n) <= 2e+130:
		tmp = t_0
	else:
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x
	return tmp
function code(x, n)
	t_0 = Float64(1.0 - (x ^ Float64(1.0 / n)))
	t_1 = Float64(log(Float64(Float64(x + 1.0) / x)) / n)
	tmp = 0.0
	if (Float64(1.0 / n) <= -1e+252)
		tmp = t_1;
	elseif (Float64(1.0 / n) <= -1e+208)
		tmp = t_0;
	elseif (Float64(1.0 / n) <= -4e+161)
		tmp = 0.0;
	elseif (Float64(1.0 / n) <= -10000.0)
		tmp = t_0;
	elseif (Float64(1.0 / n) <= 5e-13)
		tmp = t_1;
	elseif (Float64(1.0 / n) <= 2e+130)
		tmp = t_0;
	else
		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(n * 0.3333333333333333) - Float64(0.5 * Float64(x * n))) / Float64(n * Float64(x * n))) / x)) / x);
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = 1.0 - (x ^ (1.0 / n));
	t_1 = log(((x + 1.0) / x)) / n;
	tmp = 0.0;
	if ((1.0 / n) <= -1e+252)
		tmp = t_1;
	elseif ((1.0 / n) <= -1e+208)
		tmp = t_0;
	elseif ((1.0 / n) <= -4e+161)
		tmp = 0.0;
	elseif ((1.0 / n) <= -10000.0)
		tmp = t_0;
	elseif ((1.0 / n) <= 5e-13)
		tmp = t_1;
	elseif ((1.0 / n) <= 2e+130)
		tmp = t_0;
	else
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+252], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+208], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e+161], 0.0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -10000.0], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-13], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+130], t$95$0, N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(n * 0.3333333333333333), $MachinePrecision] - N[(0.5 * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(n * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+252}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{+208}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;\frac{1}{n} \leq -4 \cdot 10^{+161}:\\
\;\;\;\;0\\

\mathbf{elif}\;\frac{1}{n} \leq -10000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+130}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 1 n) < -1.0000000000000001e252 or -1e4 < (/.f64 1 n) < 4.9999999999999999e-13

    1. Initial program 40.1%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 74.3%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Step-by-step derivation
      1. diff-log74.6%

        \[\leadsto \frac{\color{blue}{\log \left(\frac{1 + x}{x}\right)}}{n} \]
      2. +-commutative74.6%

        \[\leadsto \frac{\log \left(\frac{\color{blue}{x + 1}}{x}\right)}{n} \]
    5. Applied egg-rr74.6%

      \[\leadsto \frac{\color{blue}{\log \left(\frac{x + 1}{x}\right)}}{n} \]

    if -1.0000000000000001e252 < (/.f64 1 n) < -9.9999999999999998e207 or -4.0000000000000002e161 < (/.f64 1 n) < -1e4 or 4.9999999999999999e-13 < (/.f64 1 n) < 2.0000000000000001e130

    1. Initial program 94.4%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 68.5%

      \[\leadsto \color{blue}{1} - {x}^{\left(\frac{1}{n}\right)} \]

    if -9.9999999999999998e207 < (/.f64 1 n) < -4.0000000000000002e161

    1. Initial program 100.0%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + \left(-{x}^{\left(\frac{1}{n}\right)}\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(-{x}^{\left(\frac{1}{n}\right)}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \]
      3. add-cube-cbrt100.0%

        \[\leadsto \color{blue}{\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}} + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
      4. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
      5. pow-to-exp100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
      6. un-div-inv100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
      7. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
      8. log1p-define100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right) \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)} \]
    5. Taylor expanded in x around inf 84.6%

      \[\leadsto \color{blue}{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + {\left(\sqrt[3]{-1}\right)}^{3} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
    6. Step-by-step derivation
      1. rem-cube-cbrt84.6%

        \[\leadsto e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + \color{blue}{-1} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      2. distribute-rgt1-in84.6%

        \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
      3. metadata-eval84.6%

        \[\leadsto \color{blue}{0} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      4. mul0-lft84.9%

        \[\leadsto \color{blue}{0} \]
    7. Simplified84.9%

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

    if 2.0000000000000001e130 < (/.f64 1 n)

    1. Initial program 22.5%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 6.1%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around -inf 80.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
    5. Step-by-step derivation
      1. associate-*r/80.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}{x}} \]
      2. mul-1-neg80.8%

        \[\leadsto \frac{\color{blue}{-\left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}}{x} \]
      3. associate-*r/80.8%

        \[\leadsto \frac{-\left(\color{blue}{\frac{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x}} - \frac{1}{n}\right)}{x} \]
      4. mul-1-neg80.8%

        \[\leadsto \frac{-\left(\frac{\color{blue}{-\left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}}{x} - \frac{1}{n}\right)}{x} \]
      5. associate-*r/80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\color{blue}{\frac{0.3333333333333333 \cdot 1}{n \cdot x}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      6. metadata-eval80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{\color{blue}{0.3333333333333333}}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      7. *-commutative80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{\color{blue}{x \cdot n}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      8. associate-*r/80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)}{x} - \frac{1}{n}\right)}{x} \]
      9. metadata-eval80.8%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{\color{blue}{0.5}}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
    6. Simplified80.8%

      \[\leadsto \color{blue}{\frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}\right)}{x} - \frac{1}{n}\right)}{x}} \]
    7. Step-by-step derivation
      1. frac-sub87.1%

        \[\leadsto \frac{-\left(\frac{-\color{blue}{\frac{0.3333333333333333 \cdot n - \left(x \cdot n\right) \cdot 0.5}{\left(x \cdot n\right) \cdot n}}}{x} - \frac{1}{n}\right)}{x} \]
    8. Applied egg-rr87.1%

      \[\leadsto \frac{-\left(\frac{-\color{blue}{\frac{0.3333333333333333 \cdot n - \left(x \cdot n\right) \cdot 0.5}{\left(x \cdot n\right) \cdot n}}}{x} - \frac{1}{n}\right)}{x} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification74.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+252}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{+208}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;\frac{1}{n} \leq -4 \cdot 10^{+161}:\\ \;\;\;\;0\\ \mathbf{elif}\;\frac{1}{n} \leq -10000:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-13}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+130}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 57.4% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{\log x}{-n}\\ \mathbf{if}\;x \leq 1.75 \cdot 10^{-302}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{-211}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{-163}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{-108}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 4 \cdot 10^{-70}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.9:\\ \;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\ \mathbf{elif}\;x \leq 4.3 \cdot 10^{+40}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (log x) (- n))))
   (if (<= x 1.75e-302)
     t_0
     (if (<= x 3.8e-211)
       t_1
       (if (<= x 6.4e-163)
         t_0
         (if (<= x 1.1e-108)
           t_1
           (if (<= x 4e-70)
             (/
              (+
               (/ 1.0 n)
               (/
                (/ (- (* n 0.3333333333333333) (* 0.5 (* x n))) (* n (* x n)))
                x))
              x)
             (if (<= x 0.9)
               (- (/ x n) (/ (log x) n))
               (if (<= x 4.3e+40)
                 (/
                  (/
                   (+
                    1.0
                    (/
                     (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5)
                     x))
                   x)
                  n)
                 0.0)))))))))
double code(double x, double n) {
	double t_0 = 1.0 - pow(x, (1.0 / n));
	double t_1 = log(x) / -n;
	double tmp;
	if (x <= 1.75e-302) {
		tmp = t_0;
	} else if (x <= 3.8e-211) {
		tmp = t_1;
	} else if (x <= 6.4e-163) {
		tmp = t_0;
	} else if (x <= 1.1e-108) {
		tmp = t_1;
	} else if (x <= 4e-70) {
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	} else if (x <= 0.9) {
		tmp = (x / n) - (log(x) / n);
	} else if (x <= 4.3e+40) {
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 1.0d0 - (x ** (1.0d0 / n))
    t_1 = log(x) / -n
    if (x <= 1.75d-302) then
        tmp = t_0
    else if (x <= 3.8d-211) then
        tmp = t_1
    else if (x <= 6.4d-163) then
        tmp = t_0
    else if (x <= 1.1d-108) then
        tmp = t_1
    else if (x <= 4d-70) then
        tmp = ((1.0d0 / n) + ((((n * 0.3333333333333333d0) - (0.5d0 * (x * n))) / (n * (x * n))) / x)) / x
    else if (x <= 0.9d0) then
        tmp = (x / n) - (log(x) / n)
    else if (x <= 4.3d+40) then
        tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double t_0 = 1.0 - Math.pow(x, (1.0 / n));
	double t_1 = Math.log(x) / -n;
	double tmp;
	if (x <= 1.75e-302) {
		tmp = t_0;
	} else if (x <= 3.8e-211) {
		tmp = t_1;
	} else if (x <= 6.4e-163) {
		tmp = t_0;
	} else if (x <= 1.1e-108) {
		tmp = t_1;
	} else if (x <= 4e-70) {
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	} else if (x <= 0.9) {
		tmp = (x / n) - (Math.log(x) / n);
	} else if (x <= 4.3e+40) {
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	t_0 = 1.0 - math.pow(x, (1.0 / n))
	t_1 = math.log(x) / -n
	tmp = 0
	if x <= 1.75e-302:
		tmp = t_0
	elif x <= 3.8e-211:
		tmp = t_1
	elif x <= 6.4e-163:
		tmp = t_0
	elif x <= 1.1e-108:
		tmp = t_1
	elif x <= 4e-70:
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x
	elif x <= 0.9:
		tmp = (x / n) - (math.log(x) / n)
	elif x <= 4.3e+40:
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	t_0 = Float64(1.0 - (x ^ Float64(1.0 / n)))
	t_1 = Float64(log(x) / Float64(-n))
	tmp = 0.0
	if (x <= 1.75e-302)
		tmp = t_0;
	elseif (x <= 3.8e-211)
		tmp = t_1;
	elseif (x <= 6.4e-163)
		tmp = t_0;
	elseif (x <= 1.1e-108)
		tmp = t_1;
	elseif (x <= 4e-70)
		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(n * 0.3333333333333333) - Float64(0.5 * Float64(x * n))) / Float64(n * Float64(x * n))) / x)) / x);
	elseif (x <= 0.9)
		tmp = Float64(Float64(x / n) - Float64(log(x) / n));
	elseif (x <= 4.3e+40)
		tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n);
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = 1.0 - (x ^ (1.0 / n));
	t_1 = log(x) / -n;
	tmp = 0.0;
	if (x <= 1.75e-302)
		tmp = t_0;
	elseif (x <= 3.8e-211)
		tmp = t_1;
	elseif (x <= 6.4e-163)
		tmp = t_0;
	elseif (x <= 1.1e-108)
		tmp = t_1;
	elseif (x <= 4e-70)
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	elseif (x <= 0.9)
		tmp = (x / n) - (log(x) / n);
	elseif (x <= 4.3e+40)
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 1.75e-302], t$95$0, If[LessEqual[x, 3.8e-211], t$95$1, If[LessEqual[x, 6.4e-163], t$95$0, If[LessEqual[x, 1.1e-108], t$95$1, If[LessEqual[x, 4e-70], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(n * 0.3333333333333333), $MachinePrecision] - N[(0.5 * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(n * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.9], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.3e+40], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq 1.75 \cdot 10^{-302}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 3.8 \cdot 10^{-211}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 6.4 \cdot 10^{-163}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1.1 \cdot 10^{-108}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 4 \cdot 10^{-70}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\

\mathbf{elif}\;x \leq 0.9:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\

\mathbf{elif}\;x \leq 4.3 \cdot 10^{+40}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if x < 1.7500000000000001e-302 or 3.80000000000000012e-211 < x < 6.39999999999999976e-163

    1. Initial program 76.2%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 76.2%

      \[\leadsto \color{blue}{1} - {x}^{\left(\frac{1}{n}\right)} \]

    if 1.7500000000000001e-302 < x < 3.80000000000000012e-211 or 6.39999999999999976e-163 < x < 1.1000000000000001e-108

    1. Initial program 38.9%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 64.0%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around 0 64.0%

      \[\leadsto \frac{\color{blue}{-1 \cdot \log x}}{n} \]
    5. Step-by-step derivation
      1. neg-mul-164.0%

        \[\leadsto \frac{\color{blue}{-\log x}}{n} \]
    6. Simplified64.0%

      \[\leadsto \frac{\color{blue}{-\log x}}{n} \]

    if 1.1000000000000001e-108 < x < 3.99999999999999998e-70

    1. Initial program 38.4%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 33.2%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around -inf 60.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
    5. Step-by-step derivation
      1. associate-*r/60.7%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}{x}} \]
      2. mul-1-neg60.7%

        \[\leadsto \frac{\color{blue}{-\left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}}{x} \]
      3. associate-*r/60.7%

        \[\leadsto \frac{-\left(\color{blue}{\frac{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x}} - \frac{1}{n}\right)}{x} \]
      4. mul-1-neg60.7%

        \[\leadsto \frac{-\left(\frac{\color{blue}{-\left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}}{x} - \frac{1}{n}\right)}{x} \]
      5. associate-*r/60.7%

        \[\leadsto \frac{-\left(\frac{-\left(\color{blue}{\frac{0.3333333333333333 \cdot 1}{n \cdot x}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      6. metadata-eval60.7%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{\color{blue}{0.3333333333333333}}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      7. *-commutative60.7%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{\color{blue}{x \cdot n}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      8. associate-*r/60.7%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)}{x} - \frac{1}{n}\right)}{x} \]
      9. metadata-eval60.7%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{\color{blue}{0.5}}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
    6. Simplified60.7%

      \[\leadsto \color{blue}{\frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}\right)}{x} - \frac{1}{n}\right)}{x}} \]
    7. Step-by-step derivation
      1. frac-sub61.0%

        \[\leadsto \frac{-\left(\frac{-\color{blue}{\frac{0.3333333333333333 \cdot n - \left(x \cdot n\right) \cdot 0.5}{\left(x \cdot n\right) \cdot n}}}{x} - \frac{1}{n}\right)}{x} \]
    8. Applied egg-rr61.0%

      \[\leadsto \frac{-\left(\frac{-\color{blue}{\frac{0.3333333333333333 \cdot n - \left(x \cdot n\right) \cdot 0.5}{\left(x \cdot n\right) \cdot n}}}{x} - \frac{1}{n}\right)}{x} \]

    if 3.99999999999999998e-70 < x < 0.900000000000000022

    1. Initial program 40.7%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 44.0%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around 0 42.3%

      \[\leadsto \color{blue}{-1 \cdot \frac{\log x}{n} + \frac{x}{n}} \]
    5. Step-by-step derivation
      1. neg-mul-142.3%

        \[\leadsto \color{blue}{\left(-\frac{\log x}{n}\right)} + \frac{x}{n} \]
      2. distribute-neg-frac42.3%

        \[\leadsto \color{blue}{\frac{-\log x}{n}} + \frac{x}{n} \]
      3. log-rec42.3%

        \[\leadsto \frac{\color{blue}{\log \left(\frac{1}{x}\right)}}{n} + \frac{x}{n} \]
      4. +-commutative42.3%

        \[\leadsto \color{blue}{\frac{x}{n} + \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      5. log-rec42.3%

        \[\leadsto \frac{x}{n} + \frac{\color{blue}{-\log x}}{n} \]
      6. distribute-neg-frac42.3%

        \[\leadsto \frac{x}{n} + \color{blue}{\left(-\frac{\log x}{n}\right)} \]
      7. unsub-neg42.3%

        \[\leadsto \color{blue}{\frac{x}{n} - \frac{\log x}{n}} \]
    6. Simplified42.3%

      \[\leadsto \color{blue}{\frac{x}{n} - \frac{\log x}{n}} \]

    if 0.900000000000000022 < x < 4.3000000000000002e40

    1. Initial program 29.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 29.1%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around -inf 75.8%

      \[\leadsto \frac{\color{blue}{-1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{0.25 \cdot \frac{1}{x} - 0.3333333333333333}{x} - 0.5}{x} - 1}{x}}}{n} \]

    if 4.3000000000000002e40 < x

    1. Initial program 77.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg77.6%

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + \left(-{x}^{\left(\frac{1}{n}\right)}\right)} \]
      2. +-commutative77.6%

        \[\leadsto \color{blue}{\left(-{x}^{\left(\frac{1}{n}\right)}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \]
      3. add-cube-cbrt77.6%

        \[\leadsto \color{blue}{\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}} + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
      4. fma-define77.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
      5. pow-to-exp77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
      6. un-div-inv77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
      7. +-commutative77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
      8. log1p-define77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right) \]
    4. Applied egg-rr77.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)} \]
    5. Taylor expanded in x around inf 77.6%

      \[\leadsto \color{blue}{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + {\left(\sqrt[3]{-1}\right)}^{3} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
    6. Step-by-step derivation
      1. rem-cube-cbrt77.6%

        \[\leadsto e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + \color{blue}{-1} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      2. distribute-rgt1-in77.6%

        \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
      3. metadata-eval77.6%

        \[\leadsto \color{blue}{0} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      4. mul0-lft77.6%

        \[\leadsto \color{blue}{0} \]
    7. Simplified77.6%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification68.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.75 \cdot 10^{-302}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{-211}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{-163}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{-108}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 4 \cdot 10^{-70}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.9:\\ \;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\ \mathbf{elif}\;x \leq 4.3 \cdot 10^{+40}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 57.5% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{\log x}{-n}\\ \mathbf{if}\;x \leq 4.4 \cdot 10^{-302}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{-207}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-162}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{-107}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-70}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.9:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 2.15 \cdot 10^{+40}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (log x) (- n))))
   (if (<= x 4.4e-302)
     t_0
     (if (<= x 6.4e-207)
       t_1
       (if (<= x 2.8e-162)
         t_0
         (if (<= x 1.65e-107)
           t_1
           (if (<= x 3.2e-70)
             (/
              (+
               (/ 1.0 n)
               (/
                (/ (- (* n 0.3333333333333333) (* 0.5 (* x n))) (* n (* x n)))
                x))
              x)
             (if (<= x 0.9)
               (/ (- x (log x)) n)
               (if (<= x 2.15e+40)
                 (/
                  (/
                   (+
                    1.0
                    (/
                     (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5)
                     x))
                   x)
                  n)
                 0.0)))))))))
double code(double x, double n) {
	double t_0 = 1.0 - pow(x, (1.0 / n));
	double t_1 = log(x) / -n;
	double tmp;
	if (x <= 4.4e-302) {
		tmp = t_0;
	} else if (x <= 6.4e-207) {
		tmp = t_1;
	} else if (x <= 2.8e-162) {
		tmp = t_0;
	} else if (x <= 1.65e-107) {
		tmp = t_1;
	} else if (x <= 3.2e-70) {
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	} else if (x <= 0.9) {
		tmp = (x - log(x)) / n;
	} else if (x <= 2.15e+40) {
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 1.0d0 - (x ** (1.0d0 / n))
    t_1 = log(x) / -n
    if (x <= 4.4d-302) then
        tmp = t_0
    else if (x <= 6.4d-207) then
        tmp = t_1
    else if (x <= 2.8d-162) then
        tmp = t_0
    else if (x <= 1.65d-107) then
        tmp = t_1
    else if (x <= 3.2d-70) then
        tmp = ((1.0d0 / n) + ((((n * 0.3333333333333333d0) - (0.5d0 * (x * n))) / (n * (x * n))) / x)) / x
    else if (x <= 0.9d0) then
        tmp = (x - log(x)) / n
    else if (x <= 2.15d+40) then
        tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double t_0 = 1.0 - Math.pow(x, (1.0 / n));
	double t_1 = Math.log(x) / -n;
	double tmp;
	if (x <= 4.4e-302) {
		tmp = t_0;
	} else if (x <= 6.4e-207) {
		tmp = t_1;
	} else if (x <= 2.8e-162) {
		tmp = t_0;
	} else if (x <= 1.65e-107) {
		tmp = t_1;
	} else if (x <= 3.2e-70) {
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	} else if (x <= 0.9) {
		tmp = (x - Math.log(x)) / n;
	} else if (x <= 2.15e+40) {
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	t_0 = 1.0 - math.pow(x, (1.0 / n))
	t_1 = math.log(x) / -n
	tmp = 0
	if x <= 4.4e-302:
		tmp = t_0
	elif x <= 6.4e-207:
		tmp = t_1
	elif x <= 2.8e-162:
		tmp = t_0
	elif x <= 1.65e-107:
		tmp = t_1
	elif x <= 3.2e-70:
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x
	elif x <= 0.9:
		tmp = (x - math.log(x)) / n
	elif x <= 2.15e+40:
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	t_0 = Float64(1.0 - (x ^ Float64(1.0 / n)))
	t_1 = Float64(log(x) / Float64(-n))
	tmp = 0.0
	if (x <= 4.4e-302)
		tmp = t_0;
	elseif (x <= 6.4e-207)
		tmp = t_1;
	elseif (x <= 2.8e-162)
		tmp = t_0;
	elseif (x <= 1.65e-107)
		tmp = t_1;
	elseif (x <= 3.2e-70)
		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(n * 0.3333333333333333) - Float64(0.5 * Float64(x * n))) / Float64(n * Float64(x * n))) / x)) / x);
	elseif (x <= 0.9)
		tmp = Float64(Float64(x - log(x)) / n);
	elseif (x <= 2.15e+40)
		tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n);
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = 1.0 - (x ^ (1.0 / n));
	t_1 = log(x) / -n;
	tmp = 0.0;
	if (x <= 4.4e-302)
		tmp = t_0;
	elseif (x <= 6.4e-207)
		tmp = t_1;
	elseif (x <= 2.8e-162)
		tmp = t_0;
	elseif (x <= 1.65e-107)
		tmp = t_1;
	elseif (x <= 3.2e-70)
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	elseif (x <= 0.9)
		tmp = (x - log(x)) / n;
	elseif (x <= 2.15e+40)
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 4.4e-302], t$95$0, If[LessEqual[x, 6.4e-207], t$95$1, If[LessEqual[x, 2.8e-162], t$95$0, If[LessEqual[x, 1.65e-107], t$95$1, If[LessEqual[x, 3.2e-70], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(n * 0.3333333333333333), $MachinePrecision] - N[(0.5 * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(n * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.9], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 2.15e+40], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq 4.4 \cdot 10^{-302}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 6.4 \cdot 10^{-207}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 2.8 \cdot 10^{-162}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1.65 \cdot 10^{-107}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 3.2 \cdot 10^{-70}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\

\mathbf{elif}\;x \leq 0.9:\\
\;\;\;\;\frac{x - \log x}{n}\\

\mathbf{elif}\;x \leq 2.15 \cdot 10^{+40}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if x < 4.40000000000000015e-302 or 6.4000000000000006e-207 < x < 2.80000000000000022e-162

    1. Initial program 76.2%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 76.2%

      \[\leadsto \color{blue}{1} - {x}^{\left(\frac{1}{n}\right)} \]

    if 4.40000000000000015e-302 < x < 6.4000000000000006e-207 or 2.80000000000000022e-162 < x < 1.65000000000000002e-107

    1. Initial program 38.9%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 64.0%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around 0 64.0%

      \[\leadsto \frac{\color{blue}{-1 \cdot \log x}}{n} \]
    5. Step-by-step derivation
      1. neg-mul-164.0%

        \[\leadsto \frac{\color{blue}{-\log x}}{n} \]
    6. Simplified64.0%

      \[\leadsto \frac{\color{blue}{-\log x}}{n} \]

    if 1.65000000000000002e-107 < x < 3.1999999999999997e-70

    1. Initial program 38.4%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 33.2%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around -inf 60.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
    5. Step-by-step derivation
      1. associate-*r/60.7%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}{x}} \]
      2. mul-1-neg60.7%

        \[\leadsto \frac{\color{blue}{-\left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}}{x} \]
      3. associate-*r/60.7%

        \[\leadsto \frac{-\left(\color{blue}{\frac{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x}} - \frac{1}{n}\right)}{x} \]
      4. mul-1-neg60.7%

        \[\leadsto \frac{-\left(\frac{\color{blue}{-\left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}}{x} - \frac{1}{n}\right)}{x} \]
      5. associate-*r/60.7%

        \[\leadsto \frac{-\left(\frac{-\left(\color{blue}{\frac{0.3333333333333333 \cdot 1}{n \cdot x}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      6. metadata-eval60.7%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{\color{blue}{0.3333333333333333}}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      7. *-commutative60.7%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{\color{blue}{x \cdot n}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      8. associate-*r/60.7%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)}{x} - \frac{1}{n}\right)}{x} \]
      9. metadata-eval60.7%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{\color{blue}{0.5}}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
    6. Simplified60.7%

      \[\leadsto \color{blue}{\frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}\right)}{x} - \frac{1}{n}\right)}{x}} \]
    7. Step-by-step derivation
      1. frac-sub61.0%

        \[\leadsto \frac{-\left(\frac{-\color{blue}{\frac{0.3333333333333333 \cdot n - \left(x \cdot n\right) \cdot 0.5}{\left(x \cdot n\right) \cdot n}}}{x} - \frac{1}{n}\right)}{x} \]
    8. Applied egg-rr61.0%

      \[\leadsto \frac{-\left(\frac{-\color{blue}{\frac{0.3333333333333333 \cdot n - \left(x \cdot n\right) \cdot 0.5}{\left(x \cdot n\right) \cdot n}}}{x} - \frac{1}{n}\right)}{x} \]

    if 3.1999999999999997e-70 < x < 0.900000000000000022

    1. Initial program 40.7%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 44.0%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around 0 42.2%

      \[\leadsto \frac{\color{blue}{x} - \log x}{n} \]

    if 0.900000000000000022 < x < 2.1500000000000001e40

    1. Initial program 29.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 29.1%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around -inf 75.8%

      \[\leadsto \frac{\color{blue}{-1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{0.25 \cdot \frac{1}{x} - 0.3333333333333333}{x} - 0.5}{x} - 1}{x}}}{n} \]

    if 2.1500000000000001e40 < x

    1. Initial program 77.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg77.6%

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + \left(-{x}^{\left(\frac{1}{n}\right)}\right)} \]
      2. +-commutative77.6%

        \[\leadsto \color{blue}{\left(-{x}^{\left(\frac{1}{n}\right)}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \]
      3. add-cube-cbrt77.6%

        \[\leadsto \color{blue}{\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}} + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
      4. fma-define77.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
      5. pow-to-exp77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
      6. un-div-inv77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
      7. +-commutative77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
      8. log1p-define77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right) \]
    4. Applied egg-rr77.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)} \]
    5. Taylor expanded in x around inf 77.6%

      \[\leadsto \color{blue}{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + {\left(\sqrt[3]{-1}\right)}^{3} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
    6. Step-by-step derivation
      1. rem-cube-cbrt77.6%

        \[\leadsto e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + \color{blue}{-1} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      2. distribute-rgt1-in77.6%

        \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
      3. metadata-eval77.6%

        \[\leadsto \color{blue}{0} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      4. mul0-lft77.6%

        \[\leadsto \color{blue}{0} \]
    7. Simplified77.6%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification68.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4.4 \cdot 10^{-302}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{-207}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-162}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{-107}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-70}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.9:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 2.15 \cdot 10^{+40}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 57.7% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ \mathbf{if}\;x \leq 1.35 \cdot 10^{-179}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-162}:\\ \;\;\;\;\frac{-1}{\frac{n}{\frac{-1 + \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}}}\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{-107}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-70}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.86:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 2.95 \cdot 10^{+40}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (/ (log x) (- n))))
   (if (<= x 1.35e-179)
     t_0
     (if (<= x 1.05e-162)
       (/ -1.0 (/ n (/ (+ -1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) x)))
       (if (<= x 1.2e-107)
         t_0
         (if (<= x 3.2e-70)
           (/
            (+
             (/ 1.0 n)
             (/
              (/ (- (* n 0.3333333333333333) (* 0.5 (* x n))) (* n (* x n)))
              x))
            x)
           (if (<= x 0.86)
             (/ (- x (log x)) n)
             (if (<= x 2.95e+40)
               (/
                (/
                 (+
                  1.0
                  (/
                   (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5)
                   x))
                 x)
                n)
               0.0))))))))
double code(double x, double n) {
	double t_0 = log(x) / -n;
	double tmp;
	if (x <= 1.35e-179) {
		tmp = t_0;
	} else if (x <= 1.05e-162) {
		tmp = -1.0 / (n / ((-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / x));
	} else if (x <= 1.2e-107) {
		tmp = t_0;
	} else if (x <= 3.2e-70) {
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	} else if (x <= 0.86) {
		tmp = (x - log(x)) / n;
	} else if (x <= 2.95e+40) {
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: tmp
    t_0 = log(x) / -n
    if (x <= 1.35d-179) then
        tmp = t_0
    else if (x <= 1.05d-162) then
        tmp = (-1.0d0) / (n / (((-1.0d0) + ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / x))
    else if (x <= 1.2d-107) then
        tmp = t_0
    else if (x <= 3.2d-70) then
        tmp = ((1.0d0 / n) + ((((n * 0.3333333333333333d0) - (0.5d0 * (x * n))) / (n * (x * n))) / x)) / x
    else if (x <= 0.86d0) then
        tmp = (x - log(x)) / n
    else if (x <= 2.95d+40) then
        tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double t_0 = Math.log(x) / -n;
	double tmp;
	if (x <= 1.35e-179) {
		tmp = t_0;
	} else if (x <= 1.05e-162) {
		tmp = -1.0 / (n / ((-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / x));
	} else if (x <= 1.2e-107) {
		tmp = t_0;
	} else if (x <= 3.2e-70) {
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	} else if (x <= 0.86) {
		tmp = (x - Math.log(x)) / n;
	} else if (x <= 2.95e+40) {
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	t_0 = math.log(x) / -n
	tmp = 0
	if x <= 1.35e-179:
		tmp = t_0
	elif x <= 1.05e-162:
		tmp = -1.0 / (n / ((-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / x))
	elif x <= 1.2e-107:
		tmp = t_0
	elif x <= 3.2e-70:
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x
	elif x <= 0.86:
		tmp = (x - math.log(x)) / n
	elif x <= 2.95e+40:
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	t_0 = Float64(log(x) / Float64(-n))
	tmp = 0.0
	if (x <= 1.35e-179)
		tmp = t_0;
	elseif (x <= 1.05e-162)
		tmp = Float64(-1.0 / Float64(n / Float64(Float64(-1.0 + Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / x)));
	elseif (x <= 1.2e-107)
		tmp = t_0;
	elseif (x <= 3.2e-70)
		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(n * 0.3333333333333333) - Float64(0.5 * Float64(x * n))) / Float64(n * Float64(x * n))) / x)) / x);
	elseif (x <= 0.86)
		tmp = Float64(Float64(x - log(x)) / n);
	elseif (x <= 2.95e+40)
		tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n);
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = log(x) / -n;
	tmp = 0.0;
	if (x <= 1.35e-179)
		tmp = t_0;
	elseif (x <= 1.05e-162)
		tmp = -1.0 / (n / ((-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / x));
	elseif (x <= 1.2e-107)
		tmp = t_0;
	elseif (x <= 3.2e-70)
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	elseif (x <= 0.86)
		tmp = (x - log(x)) / n;
	elseif (x <= 2.95e+40)
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 1.35e-179], t$95$0, If[LessEqual[x, 1.05e-162], N[(-1.0 / N[(n / N[(N[(-1.0 + N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.2e-107], t$95$0, If[LessEqual[x, 3.2e-70], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(n * 0.3333333333333333), $MachinePrecision] - N[(0.5 * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(n * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.86], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 2.95e+40], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq 1.35 \cdot 10^{-179}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1.05 \cdot 10^{-162}:\\
\;\;\;\;\frac{-1}{\frac{n}{\frac{-1 + \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}}}\\

\mathbf{elif}\;x \leq 1.2 \cdot 10^{-107}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 3.2 \cdot 10^{-70}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\

\mathbf{elif}\;x \leq 0.86:\\
\;\;\;\;\frac{x - \log x}{n}\\

\mathbf{elif}\;x \leq 2.95 \cdot 10^{+40}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if x < 1.34999999999999994e-179 or 1.05e-162 < x < 1.19999999999999997e-107

    1. Initial program 47.0%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 56.7%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around 0 56.7%

      \[\leadsto \frac{\color{blue}{-1 \cdot \log x}}{n} \]
    5. Step-by-step derivation
      1. neg-mul-156.7%

        \[\leadsto \frac{\color{blue}{-\log x}}{n} \]
    6. Simplified56.7%

      \[\leadsto \frac{\color{blue}{-\log x}}{n} \]

    if 1.34999999999999994e-179 < x < 1.05e-162

    1. Initial program 67.8%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 16.0%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Step-by-step derivation
      1. clear-num15.9%

        \[\leadsto \color{blue}{\frac{1}{\frac{n}{\log \left(1 + x\right) - \log x}}} \]
      2. inv-pow15.9%

        \[\leadsto \color{blue}{{\left(\frac{n}{\log \left(1 + x\right) - \log x}\right)}^{-1}} \]
      3. log1p-define15.9%

        \[\leadsto {\left(\frac{n}{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}\right)}^{-1} \]
    5. Applied egg-rr15.9%

      \[\leadsto \color{blue}{{\left(\frac{n}{\mathsf{log1p}\left(x\right) - \log x}\right)}^{-1}} \]
    6. Step-by-step derivation
      1. unpow-115.9%

        \[\leadsto \color{blue}{\frac{1}{\frac{n}{\mathsf{log1p}\left(x\right) - \log x}}} \]
    7. Simplified15.9%

      \[\leadsto \color{blue}{\frac{1}{\frac{n}{\mathsf{log1p}\left(x\right) - \log x}}} \]
    8. Taylor expanded in x around -inf 78.4%

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

        \[\leadsto \frac{1}{\frac{n}{\color{blue}{-\frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x} - 1}{x}}}} \]
      2. distribute-neg-frac278.4%

        \[\leadsto \frac{1}{\frac{n}{\color{blue}{\frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x} - 1}{-x}}}} \]
      3. sub-neg78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\color{blue}{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x} + \left(-1\right)}}{-x}}} \]
      4. associate-*r/78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\color{blue}{\frac{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{x} - 0.5\right)}{x}} + \left(-1\right)}{-x}}} \]
      5. sub-neg78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{-1 \cdot \color{blue}{\left(0.3333333333333333 \cdot \frac{1}{x} + \left(-0.5\right)\right)}}{x} + \left(-1\right)}{-x}}} \]
      6. metadata-eval78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{x} + \color{blue}{-0.5}\right)}{x} + \left(-1\right)}{-x}}} \]
      7. distribute-lft-in78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\color{blue}{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{x}\right) + -1 \cdot -0.5}}{x} + \left(-1\right)}{-x}}} \]
      8. neg-mul-178.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\color{blue}{\left(-0.3333333333333333 \cdot \frac{1}{x}\right)} + -1 \cdot -0.5}{x} + \left(-1\right)}{-x}}} \]
      9. associate-*r/78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\left(-\color{blue}{\frac{0.3333333333333333 \cdot 1}{x}}\right) + -1 \cdot -0.5}{x} + \left(-1\right)}{-x}}} \]
      10. metadata-eval78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\left(-\frac{\color{blue}{0.3333333333333333}}{x}\right) + -1 \cdot -0.5}{x} + \left(-1\right)}{-x}}} \]
      11. distribute-neg-frac78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\color{blue}{\frac{-0.3333333333333333}{x}} + -1 \cdot -0.5}{x} + \left(-1\right)}{-x}}} \]
      12. metadata-eval78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\frac{\color{blue}{-0.3333333333333333}}{x} + -1 \cdot -0.5}{x} + \left(-1\right)}{-x}}} \]
      13. metadata-eval78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\frac{-0.3333333333333333}{x} + \color{blue}{0.5}}{x} + \left(-1\right)}{-x}}} \]
      14. metadata-eval78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\frac{-0.3333333333333333}{x} + 0.5}{x} + \color{blue}{-1}}{-x}}} \]
    10. Simplified78.4%

      \[\leadsto \frac{1}{\frac{n}{\color{blue}{\frac{\frac{\frac{-0.3333333333333333}{x} + 0.5}{x} + -1}{-x}}}} \]

    if 1.19999999999999997e-107 < x < 3.1999999999999997e-70

    1. Initial program 38.4%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 33.2%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around -inf 60.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
    5. Step-by-step derivation
      1. associate-*r/60.7%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}{x}} \]
      2. mul-1-neg60.7%

        \[\leadsto \frac{\color{blue}{-\left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}}{x} \]
      3. associate-*r/60.7%

        \[\leadsto \frac{-\left(\color{blue}{\frac{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x}} - \frac{1}{n}\right)}{x} \]
      4. mul-1-neg60.7%

        \[\leadsto \frac{-\left(\frac{\color{blue}{-\left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}}{x} - \frac{1}{n}\right)}{x} \]
      5. associate-*r/60.7%

        \[\leadsto \frac{-\left(\frac{-\left(\color{blue}{\frac{0.3333333333333333 \cdot 1}{n \cdot x}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      6. metadata-eval60.7%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{\color{blue}{0.3333333333333333}}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      7. *-commutative60.7%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{\color{blue}{x \cdot n}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      8. associate-*r/60.7%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)}{x} - \frac{1}{n}\right)}{x} \]
      9. metadata-eval60.7%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{\color{blue}{0.5}}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
    6. Simplified60.7%

      \[\leadsto \color{blue}{\frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}\right)}{x} - \frac{1}{n}\right)}{x}} \]
    7. Step-by-step derivation
      1. frac-sub61.0%

        \[\leadsto \frac{-\left(\frac{-\color{blue}{\frac{0.3333333333333333 \cdot n - \left(x \cdot n\right) \cdot 0.5}{\left(x \cdot n\right) \cdot n}}}{x} - \frac{1}{n}\right)}{x} \]
    8. Applied egg-rr61.0%

      \[\leadsto \frac{-\left(\frac{-\color{blue}{\frac{0.3333333333333333 \cdot n - \left(x \cdot n\right) \cdot 0.5}{\left(x \cdot n\right) \cdot n}}}{x} - \frac{1}{n}\right)}{x} \]

    if 3.1999999999999997e-70 < x < 0.859999999999999987

    1. Initial program 40.7%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 44.0%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around 0 42.2%

      \[\leadsto \frac{\color{blue}{x} - \log x}{n} \]

    if 0.859999999999999987 < x < 2.94999999999999995e40

    1. Initial program 29.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 29.1%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around -inf 75.8%

      \[\leadsto \frac{\color{blue}{-1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{0.25 \cdot \frac{1}{x} - 0.3333333333333333}{x} - 0.5}{x} - 1}{x}}}{n} \]

    if 2.94999999999999995e40 < x

    1. Initial program 77.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg77.6%

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + \left(-{x}^{\left(\frac{1}{n}\right)}\right)} \]
      2. +-commutative77.6%

        \[\leadsto \color{blue}{\left(-{x}^{\left(\frac{1}{n}\right)}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \]
      3. add-cube-cbrt77.6%

        \[\leadsto \color{blue}{\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}} + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
      4. fma-define77.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
      5. pow-to-exp77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
      6. un-div-inv77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
      7. +-commutative77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
      8. log1p-define77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right) \]
    4. Applied egg-rr77.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)} \]
    5. Taylor expanded in x around inf 77.6%

      \[\leadsto \color{blue}{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + {\left(\sqrt[3]{-1}\right)}^{3} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
    6. Step-by-step derivation
      1. rem-cube-cbrt77.6%

        \[\leadsto e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + \color{blue}{-1} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      2. distribute-rgt1-in77.6%

        \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
      3. metadata-eval77.6%

        \[\leadsto \color{blue}{0} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      4. mul0-lft77.6%

        \[\leadsto \color{blue}{0} \]
    7. Simplified77.6%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification65.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.35 \cdot 10^{-179}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-162}:\\ \;\;\;\;\frac{-1}{\frac{n}{\frac{-1 + \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}}}\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{-107}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-70}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.86:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 2.95 \cdot 10^{+40}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 55.2% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ \mathbf{if}\;x \leq 9 \cdot 10^{-180}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 6.9 \cdot 10^{-164}:\\ \;\;\;\;\frac{-1}{\frac{n}{\frac{-1 + \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}}}\\ \mathbf{elif}\;x \leq 1.95 \cdot 10^{-107}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 4 \cdot 10^{+40}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (/ (log x) (- n))))
   (if (<= x 9e-180)
     t_0
     (if (<= x 6.9e-164)
       (/ -1.0 (/ n (/ (+ -1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) x)))
       (if (<= x 1.95e-107)
         t_0
         (if (<= x 4e+40)
           (/
            (+
             (/ 1.0 n)
             (/
              (/ (- (* n 0.3333333333333333) (* 0.5 (* x n))) (* n (* x n)))
              x))
            x)
           0.0))))))
double code(double x, double n) {
	double t_0 = log(x) / -n;
	double tmp;
	if (x <= 9e-180) {
		tmp = t_0;
	} else if (x <= 6.9e-164) {
		tmp = -1.0 / (n / ((-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / x));
	} else if (x <= 1.95e-107) {
		tmp = t_0;
	} else if (x <= 4e+40) {
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: tmp
    t_0 = log(x) / -n
    if (x <= 9d-180) then
        tmp = t_0
    else if (x <= 6.9d-164) then
        tmp = (-1.0d0) / (n / (((-1.0d0) + ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / x))
    else if (x <= 1.95d-107) then
        tmp = t_0
    else if (x <= 4d+40) then
        tmp = ((1.0d0 / n) + ((((n * 0.3333333333333333d0) - (0.5d0 * (x * n))) / (n * (x * n))) / x)) / x
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double t_0 = Math.log(x) / -n;
	double tmp;
	if (x <= 9e-180) {
		tmp = t_0;
	} else if (x <= 6.9e-164) {
		tmp = -1.0 / (n / ((-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / x));
	} else if (x <= 1.95e-107) {
		tmp = t_0;
	} else if (x <= 4e+40) {
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	t_0 = math.log(x) / -n
	tmp = 0
	if x <= 9e-180:
		tmp = t_0
	elif x <= 6.9e-164:
		tmp = -1.0 / (n / ((-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / x))
	elif x <= 1.95e-107:
		tmp = t_0
	elif x <= 4e+40:
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	t_0 = Float64(log(x) / Float64(-n))
	tmp = 0.0
	if (x <= 9e-180)
		tmp = t_0;
	elseif (x <= 6.9e-164)
		tmp = Float64(-1.0 / Float64(n / Float64(Float64(-1.0 + Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / x)));
	elseif (x <= 1.95e-107)
		tmp = t_0;
	elseif (x <= 4e+40)
		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(n * 0.3333333333333333) - Float64(0.5 * Float64(x * n))) / Float64(n * Float64(x * n))) / x)) / x);
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = log(x) / -n;
	tmp = 0.0;
	if (x <= 9e-180)
		tmp = t_0;
	elseif (x <= 6.9e-164)
		tmp = -1.0 / (n / ((-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / x));
	elseif (x <= 1.95e-107)
		tmp = t_0;
	elseif (x <= 4e+40)
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 9e-180], t$95$0, If[LessEqual[x, 6.9e-164], N[(-1.0 / N[(n / N[(N[(-1.0 + N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.95e-107], t$95$0, If[LessEqual[x, 4e+40], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(n * 0.3333333333333333), $MachinePrecision] - N[(0.5 * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(n * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq 9 \cdot 10^{-180}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 6.9 \cdot 10^{-164}:\\
\;\;\;\;\frac{-1}{\frac{n}{\frac{-1 + \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}}}\\

\mathbf{elif}\;x \leq 1.95 \cdot 10^{-107}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 4 \cdot 10^{+40}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < 9.00000000000000019e-180 or 6.89999999999999995e-164 < x < 1.95e-107

    1. Initial program 47.0%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 56.7%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around 0 56.7%

      \[\leadsto \frac{\color{blue}{-1 \cdot \log x}}{n} \]
    5. Step-by-step derivation
      1. neg-mul-156.7%

        \[\leadsto \frac{\color{blue}{-\log x}}{n} \]
    6. Simplified56.7%

      \[\leadsto \frac{\color{blue}{-\log x}}{n} \]

    if 9.00000000000000019e-180 < x < 6.89999999999999995e-164

    1. Initial program 67.8%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 16.0%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Step-by-step derivation
      1. clear-num15.9%

        \[\leadsto \color{blue}{\frac{1}{\frac{n}{\log \left(1 + x\right) - \log x}}} \]
      2. inv-pow15.9%

        \[\leadsto \color{blue}{{\left(\frac{n}{\log \left(1 + x\right) - \log x}\right)}^{-1}} \]
      3. log1p-define15.9%

        \[\leadsto {\left(\frac{n}{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}\right)}^{-1} \]
    5. Applied egg-rr15.9%

      \[\leadsto \color{blue}{{\left(\frac{n}{\mathsf{log1p}\left(x\right) - \log x}\right)}^{-1}} \]
    6. Step-by-step derivation
      1. unpow-115.9%

        \[\leadsto \color{blue}{\frac{1}{\frac{n}{\mathsf{log1p}\left(x\right) - \log x}}} \]
    7. Simplified15.9%

      \[\leadsto \color{blue}{\frac{1}{\frac{n}{\mathsf{log1p}\left(x\right) - \log x}}} \]
    8. Taylor expanded in x around -inf 78.4%

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

        \[\leadsto \frac{1}{\frac{n}{\color{blue}{-\frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x} - 1}{x}}}} \]
      2. distribute-neg-frac278.4%

        \[\leadsto \frac{1}{\frac{n}{\color{blue}{\frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x} - 1}{-x}}}} \]
      3. sub-neg78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\color{blue}{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x} + \left(-1\right)}}{-x}}} \]
      4. associate-*r/78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\color{blue}{\frac{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{x} - 0.5\right)}{x}} + \left(-1\right)}{-x}}} \]
      5. sub-neg78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{-1 \cdot \color{blue}{\left(0.3333333333333333 \cdot \frac{1}{x} + \left(-0.5\right)\right)}}{x} + \left(-1\right)}{-x}}} \]
      6. metadata-eval78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{x} + \color{blue}{-0.5}\right)}{x} + \left(-1\right)}{-x}}} \]
      7. distribute-lft-in78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\color{blue}{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{x}\right) + -1 \cdot -0.5}}{x} + \left(-1\right)}{-x}}} \]
      8. neg-mul-178.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\color{blue}{\left(-0.3333333333333333 \cdot \frac{1}{x}\right)} + -1 \cdot -0.5}{x} + \left(-1\right)}{-x}}} \]
      9. associate-*r/78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\left(-\color{blue}{\frac{0.3333333333333333 \cdot 1}{x}}\right) + -1 \cdot -0.5}{x} + \left(-1\right)}{-x}}} \]
      10. metadata-eval78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\left(-\frac{\color{blue}{0.3333333333333333}}{x}\right) + -1 \cdot -0.5}{x} + \left(-1\right)}{-x}}} \]
      11. distribute-neg-frac78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\color{blue}{\frac{-0.3333333333333333}{x}} + -1 \cdot -0.5}{x} + \left(-1\right)}{-x}}} \]
      12. metadata-eval78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\frac{\color{blue}{-0.3333333333333333}}{x} + -1 \cdot -0.5}{x} + \left(-1\right)}{-x}}} \]
      13. metadata-eval78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\frac{-0.3333333333333333}{x} + \color{blue}{0.5}}{x} + \left(-1\right)}{-x}}} \]
      14. metadata-eval78.4%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\frac{-0.3333333333333333}{x} + 0.5}{x} + \color{blue}{-1}}{-x}}} \]
    10. Simplified78.4%

      \[\leadsto \frac{1}{\frac{n}{\color{blue}{\frac{\frac{\frac{-0.3333333333333333}{x} + 0.5}{x} + -1}{-x}}}} \]

    if 1.95e-107 < x < 4.00000000000000012e40

    1. Initial program 36.8%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 36.7%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around -inf 47.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
    5. Step-by-step derivation
      1. associate-*r/47.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}{x}} \]
      2. mul-1-neg47.0%

        \[\leadsto \frac{\color{blue}{-\left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}}{x} \]
      3. associate-*r/47.0%

        \[\leadsto \frac{-\left(\color{blue}{\frac{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x}} - \frac{1}{n}\right)}{x} \]
      4. mul-1-neg47.0%

        \[\leadsto \frac{-\left(\frac{\color{blue}{-\left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}}{x} - \frac{1}{n}\right)}{x} \]
      5. associate-*r/47.0%

        \[\leadsto \frac{-\left(\frac{-\left(\color{blue}{\frac{0.3333333333333333 \cdot 1}{n \cdot x}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      6. metadata-eval47.0%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{\color{blue}{0.3333333333333333}}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      7. *-commutative47.0%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{\color{blue}{x \cdot n}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      8. associate-*r/47.0%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)}{x} - \frac{1}{n}\right)}{x} \]
      9. metadata-eval47.0%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{\color{blue}{0.5}}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
    6. Simplified47.0%

      \[\leadsto \color{blue}{\frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}\right)}{x} - \frac{1}{n}\right)}{x}} \]
    7. Step-by-step derivation
      1. frac-sub49.9%

        \[\leadsto \frac{-\left(\frac{-\color{blue}{\frac{0.3333333333333333 \cdot n - \left(x \cdot n\right) \cdot 0.5}{\left(x \cdot n\right) \cdot n}}}{x} - \frac{1}{n}\right)}{x} \]
    8. Applied egg-rr49.9%

      \[\leadsto \frac{-\left(\frac{-\color{blue}{\frac{0.3333333333333333 \cdot n - \left(x \cdot n\right) \cdot 0.5}{\left(x \cdot n\right) \cdot n}}}{x} - \frac{1}{n}\right)}{x} \]

    if 4.00000000000000012e40 < x

    1. Initial program 77.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg77.6%

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + \left(-{x}^{\left(\frac{1}{n}\right)}\right)} \]
      2. +-commutative77.6%

        \[\leadsto \color{blue}{\left(-{x}^{\left(\frac{1}{n}\right)}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \]
      3. add-cube-cbrt77.6%

        \[\leadsto \color{blue}{\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}} + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
      4. fma-define77.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
      5. pow-to-exp77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
      6. un-div-inv77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
      7. +-commutative77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
      8. log1p-define77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right) \]
    4. Applied egg-rr77.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)} \]
    5. Taylor expanded in x around inf 77.6%

      \[\leadsto \color{blue}{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + {\left(\sqrt[3]{-1}\right)}^{3} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
    6. Step-by-step derivation
      1. rem-cube-cbrt77.6%

        \[\leadsto e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + \color{blue}{-1} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      2. distribute-rgt1-in77.6%

        \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
      3. metadata-eval77.6%

        \[\leadsto \color{blue}{0} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      4. mul0-lft77.6%

        \[\leadsto \color{blue}{0} \]
    7. Simplified77.6%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification63.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 9 \cdot 10^{-180}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 6.9 \cdot 10^{-164}:\\ \;\;\;\;\frac{-1}{\frac{n}{\frac{-1 + \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}}}\\ \mathbf{elif}\;x \leq 1.95 \cdot 10^{-107}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 4 \cdot 10^{+40}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 49.6% accurate, 7.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 4.3 \cdot 10^{+40}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= x 4.3e+40)
   (/
    (+
     (/ 1.0 n)
     (/ (/ (- (* n 0.3333333333333333) (* 0.5 (* x n))) (* n (* x n))) x))
    x)
   0.0))
double code(double x, double n) {
	double tmp;
	if (x <= 4.3e+40) {
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: tmp
    if (x <= 4.3d+40) then
        tmp = ((1.0d0 / n) + ((((n * 0.3333333333333333d0) - (0.5d0 * (x * n))) / (n * (x * n))) / x)) / x
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double tmp;
	if (x <= 4.3e+40) {
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if x <= 4.3e+40:
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	tmp = 0.0
	if (x <= 4.3e+40)
		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(n * 0.3333333333333333) - Float64(0.5 * Float64(x * n))) / Float64(n * Float64(x * n))) / x)) / x);
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(x, n)
	tmp = 0.0;
	if (x <= 4.3e+40)
		tmp = ((1.0 / n) + ((((n * 0.3333333333333333) - (0.5 * (x * n))) / (n * (x * n))) / x)) / x;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[x_, n_] := If[LessEqual[x, 4.3e+40], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(n * 0.3333333333333333), $MachinePrecision] - N[(0.5 * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(n * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.3 \cdot 10^{+40}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 4.3000000000000002e40

    1. Initial program 44.0%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 46.2%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around -inf 40.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
    5. Step-by-step derivation
      1. associate-*r/40.2%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}{x}} \]
      2. mul-1-neg40.2%

        \[\leadsto \frac{\color{blue}{-\left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}}{x} \]
      3. associate-*r/40.2%

        \[\leadsto \frac{-\left(\color{blue}{\frac{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x}} - \frac{1}{n}\right)}{x} \]
      4. mul-1-neg40.2%

        \[\leadsto \frac{-\left(\frac{\color{blue}{-\left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}}{x} - \frac{1}{n}\right)}{x} \]
      5. associate-*r/40.2%

        \[\leadsto \frac{-\left(\frac{-\left(\color{blue}{\frac{0.3333333333333333 \cdot 1}{n \cdot x}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      6. metadata-eval40.2%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{\color{blue}{0.3333333333333333}}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      7. *-commutative40.2%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{\color{blue}{x \cdot n}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      8. associate-*r/40.2%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)}{x} - \frac{1}{n}\right)}{x} \]
      9. metadata-eval40.2%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{\color{blue}{0.5}}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
    6. Simplified40.2%

      \[\leadsto \color{blue}{\frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}\right)}{x} - \frac{1}{n}\right)}{x}} \]
    7. Step-by-step derivation
      1. frac-sub41.4%

        \[\leadsto \frac{-\left(\frac{-\color{blue}{\frac{0.3333333333333333 \cdot n - \left(x \cdot n\right) \cdot 0.5}{\left(x \cdot n\right) \cdot n}}}{x} - \frac{1}{n}\right)}{x} \]
    8. Applied egg-rr41.4%

      \[\leadsto \frac{-\left(\frac{-\color{blue}{\frac{0.3333333333333333 \cdot n - \left(x \cdot n\right) \cdot 0.5}{\left(x \cdot n\right) \cdot n}}}{x} - \frac{1}{n}\right)}{x} \]

    if 4.3000000000000002e40 < x

    1. Initial program 77.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg77.6%

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + \left(-{x}^{\left(\frac{1}{n}\right)}\right)} \]
      2. +-commutative77.6%

        \[\leadsto \color{blue}{\left(-{x}^{\left(\frac{1}{n}\right)}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \]
      3. add-cube-cbrt77.6%

        \[\leadsto \color{blue}{\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}} + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
      4. fma-define77.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
      5. pow-to-exp77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
      6. un-div-inv77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
      7. +-commutative77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
      8. log1p-define77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right) \]
    4. Applied egg-rr77.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)} \]
    5. Taylor expanded in x around inf 77.6%

      \[\leadsto \color{blue}{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + {\left(\sqrt[3]{-1}\right)}^{3} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
    6. Step-by-step derivation
      1. rem-cube-cbrt77.6%

        \[\leadsto e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + \color{blue}{-1} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      2. distribute-rgt1-in77.6%

        \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
      3. metadata-eval77.6%

        \[\leadsto \color{blue}{0} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      4. mul0-lft77.6%

        \[\leadsto \color{blue}{0} \]
    7. Simplified77.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4.3 \cdot 10^{+40}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{n \cdot 0.3333333333333333 - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 46.8% accurate, 8.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+252}:\\ \;\;\;\;0\\ \mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{+224}:\\ \;\;\;\;\frac{1}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq -5:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n}}{x}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= (/ 1.0 n) -1e+252)
   0.0
   (if (<= (/ 1.0 n) -1e+224)
     (/ 1.0 (* x n))
     (if (<= (/ 1.0 n) -5.0) 0.0 (/ (/ 1.0 n) x)))))
double code(double x, double n) {
	double tmp;
	if ((1.0 / n) <= -1e+252) {
		tmp = 0.0;
	} else if ((1.0 / n) <= -1e+224) {
		tmp = 1.0 / (x * n);
	} else if ((1.0 / n) <= -5.0) {
		tmp = 0.0;
	} else {
		tmp = (1.0 / n) / x;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: tmp
    if ((1.0d0 / n) <= (-1d+252)) then
        tmp = 0.0d0
    else if ((1.0d0 / n) <= (-1d+224)) then
        tmp = 1.0d0 / (x * n)
    else if ((1.0d0 / n) <= (-5.0d0)) then
        tmp = 0.0d0
    else
        tmp = (1.0d0 / n) / x
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double tmp;
	if ((1.0 / n) <= -1e+252) {
		tmp = 0.0;
	} else if ((1.0 / n) <= -1e+224) {
		tmp = 1.0 / (x * n);
	} else if ((1.0 / n) <= -5.0) {
		tmp = 0.0;
	} else {
		tmp = (1.0 / n) / x;
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if (1.0 / n) <= -1e+252:
		tmp = 0.0
	elif (1.0 / n) <= -1e+224:
		tmp = 1.0 / (x * n)
	elif (1.0 / n) <= -5.0:
		tmp = 0.0
	else:
		tmp = (1.0 / n) / x
	return tmp
function code(x, n)
	tmp = 0.0
	if (Float64(1.0 / n) <= -1e+252)
		tmp = 0.0;
	elseif (Float64(1.0 / n) <= -1e+224)
		tmp = Float64(1.0 / Float64(x * n));
	elseif (Float64(1.0 / n) <= -5.0)
		tmp = 0.0;
	else
		tmp = Float64(Float64(1.0 / n) / x);
	end
	return tmp
end
function tmp_2 = code(x, n)
	tmp = 0.0;
	if ((1.0 / n) <= -1e+252)
		tmp = 0.0;
	elseif ((1.0 / n) <= -1e+224)
		tmp = 1.0 / (x * n);
	elseif ((1.0 / n) <= -5.0)
		tmp = 0.0;
	else
		tmp = (1.0 / n) / x;
	end
	tmp_2 = tmp;
end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+252], 0.0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+224], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5.0], 0.0, N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+252}:\\
\;\;\;\;0\\

\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{+224}:\\
\;\;\;\;\frac{1}{x \cdot n}\\

\mathbf{elif}\;\frac{1}{n} \leq -5:\\
\;\;\;\;0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 1 n) < -1.0000000000000001e252 or -9.9999999999999997e223 < (/.f64 1 n) < -5

    1. Initial program 100.0%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + \left(-{x}^{\left(\frac{1}{n}\right)}\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(-{x}^{\left(\frac{1}{n}\right)}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \]
      3. add-cube-cbrt100.0%

        \[\leadsto \color{blue}{\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}} + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
      4. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
      5. pow-to-exp100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
      6. un-div-inv100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
      7. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
      8. log1p-define100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right) \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)} \]
    5. Taylor expanded in x around inf 52.6%

      \[\leadsto \color{blue}{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + {\left(\sqrt[3]{-1}\right)}^{3} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
    6. Step-by-step derivation
      1. rem-cube-cbrt52.6%

        \[\leadsto e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + \color{blue}{-1} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      2. distribute-rgt1-in52.6%

        \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
      3. metadata-eval52.6%

        \[\leadsto \color{blue}{0} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      4. mul0-lft53.4%

        \[\leadsto \color{blue}{0} \]
    7. Simplified53.4%

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

    if -1.0000000000000001e252 < (/.f64 1 n) < -9.9999999999999997e223

    1. Initial program 100.0%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 19.9%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around inf 86.1%

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

    if -5 < (/.f64 1 n)

    1. Initial program 36.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 62.2%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around inf 48.4%

      \[\leadsto \color{blue}{\frac{1}{n \cdot x}} \]
    5. Step-by-step derivation
      1. associate-/r*49.7%

        \[\leadsto \color{blue}{\frac{\frac{1}{n}}{x}} \]
    6. Simplified49.7%

      \[\leadsto \color{blue}{\frac{\frac{1}{n}}{x}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification51.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+252}:\\ \;\;\;\;0\\ \mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{+224}:\\ \;\;\;\;\frac{1}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq -5:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n}}{x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 46.8% accurate, 8.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+252}:\\ \;\;\;\;0\\ \mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{+224}:\\ \;\;\;\;\frac{1}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq -5:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{n}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= (/ 1.0 n) -1e+252)
   0.0
   (if (<= (/ 1.0 n) -1e+224)
     (/ 1.0 (* x n))
     (if (<= (/ 1.0 n) -5.0) 0.0 (/ (/ 1.0 x) n)))))
double code(double x, double n) {
	double tmp;
	if ((1.0 / n) <= -1e+252) {
		tmp = 0.0;
	} else if ((1.0 / n) <= -1e+224) {
		tmp = 1.0 / (x * n);
	} else if ((1.0 / n) <= -5.0) {
		tmp = 0.0;
	} else {
		tmp = (1.0 / x) / n;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: tmp
    if ((1.0d0 / n) <= (-1d+252)) then
        tmp = 0.0d0
    else if ((1.0d0 / n) <= (-1d+224)) then
        tmp = 1.0d0 / (x * n)
    else if ((1.0d0 / n) <= (-5.0d0)) then
        tmp = 0.0d0
    else
        tmp = (1.0d0 / x) / n
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double tmp;
	if ((1.0 / n) <= -1e+252) {
		tmp = 0.0;
	} else if ((1.0 / n) <= -1e+224) {
		tmp = 1.0 / (x * n);
	} else if ((1.0 / n) <= -5.0) {
		tmp = 0.0;
	} else {
		tmp = (1.0 / x) / n;
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if (1.0 / n) <= -1e+252:
		tmp = 0.0
	elif (1.0 / n) <= -1e+224:
		tmp = 1.0 / (x * n)
	elif (1.0 / n) <= -5.0:
		tmp = 0.0
	else:
		tmp = (1.0 / x) / n
	return tmp
function code(x, n)
	tmp = 0.0
	if (Float64(1.0 / n) <= -1e+252)
		tmp = 0.0;
	elseif (Float64(1.0 / n) <= -1e+224)
		tmp = Float64(1.0 / Float64(x * n));
	elseif (Float64(1.0 / n) <= -5.0)
		tmp = 0.0;
	else
		tmp = Float64(Float64(1.0 / x) / n);
	end
	return tmp
end
function tmp_2 = code(x, n)
	tmp = 0.0;
	if ((1.0 / n) <= -1e+252)
		tmp = 0.0;
	elseif ((1.0 / n) <= -1e+224)
		tmp = 1.0 / (x * n);
	elseif ((1.0 / n) <= -5.0)
		tmp = 0.0;
	else
		tmp = (1.0 / x) / n;
	end
	tmp_2 = tmp;
end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+252], 0.0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+224], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5.0], 0.0, N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+252}:\\
\;\;\;\;0\\

\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{+224}:\\
\;\;\;\;\frac{1}{x \cdot n}\\

\mathbf{elif}\;\frac{1}{n} \leq -5:\\
\;\;\;\;0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 1 n) < -1.0000000000000001e252 or -9.9999999999999997e223 < (/.f64 1 n) < -5

    1. Initial program 100.0%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + \left(-{x}^{\left(\frac{1}{n}\right)}\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(-{x}^{\left(\frac{1}{n}\right)}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \]
      3. add-cube-cbrt100.0%

        \[\leadsto \color{blue}{\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}} + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
      4. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
      5. pow-to-exp100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
      6. un-div-inv100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
      7. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
      8. log1p-define100.0%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right) \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)} \]
    5. Taylor expanded in x around inf 52.6%

      \[\leadsto \color{blue}{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + {\left(\sqrt[3]{-1}\right)}^{3} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
    6. Step-by-step derivation
      1. rem-cube-cbrt52.6%

        \[\leadsto e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + \color{blue}{-1} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      2. distribute-rgt1-in52.6%

        \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
      3. metadata-eval52.6%

        \[\leadsto \color{blue}{0} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      4. mul0-lft53.4%

        \[\leadsto \color{blue}{0} \]
    7. Simplified53.4%

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

    if -1.0000000000000001e252 < (/.f64 1 n) < -9.9999999999999997e223

    1. Initial program 100.0%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 19.9%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around inf 86.1%

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

    if -5 < (/.f64 1 n)

    1. Initial program 36.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 62.2%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around inf 49.8%

      \[\leadsto \frac{\color{blue}{\frac{1}{x}}}{n} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification51.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+252}:\\ \;\;\;\;0\\ \mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{+224}:\\ \;\;\;\;\frac{1}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq -5:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{n}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 48.6% accurate, 8.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 3.8 \cdot 10^{+40}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{1}{x \cdot \frac{n}{0.3333333333333333}} - \frac{0.5}{n}}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= x 3.8e+40)
   (/
    (+ (/ 1.0 n) (/ (- (/ 1.0 (* x (/ n 0.3333333333333333))) (/ 0.5 n)) x))
    x)
   0.0))
double code(double x, double n) {
	double tmp;
	if (x <= 3.8e+40) {
		tmp = ((1.0 / n) + (((1.0 / (x * (n / 0.3333333333333333))) - (0.5 / n)) / x)) / x;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: tmp
    if (x <= 3.8d+40) then
        tmp = ((1.0d0 / n) + (((1.0d0 / (x * (n / 0.3333333333333333d0))) - (0.5d0 / n)) / x)) / x
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double tmp;
	if (x <= 3.8e+40) {
		tmp = ((1.0 / n) + (((1.0 / (x * (n / 0.3333333333333333))) - (0.5 / n)) / x)) / x;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if x <= 3.8e+40:
		tmp = ((1.0 / n) + (((1.0 / (x * (n / 0.3333333333333333))) - (0.5 / n)) / x)) / x
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	tmp = 0.0
	if (x <= 3.8e+40)
		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(1.0 / Float64(x * Float64(n / 0.3333333333333333))) - Float64(0.5 / n)) / x)) / x);
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(x, n)
	tmp = 0.0;
	if (x <= 3.8e+40)
		tmp = ((1.0 / n) + (((1.0 / (x * (n / 0.3333333333333333))) - (0.5 / n)) / x)) / x;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[x_, n_] := If[LessEqual[x, 3.8e+40], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(1.0 / N[(x * N[(n / 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.8 \cdot 10^{+40}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{1}{x \cdot \frac{n}{0.3333333333333333}} - \frac{0.5}{n}}{x}}{x}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 3.80000000000000004e40

    1. Initial program 44.0%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 46.2%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around -inf 40.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
    5. Step-by-step derivation
      1. associate-*r/40.2%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}{x}} \]
      2. mul-1-neg40.2%

        \[\leadsto \frac{\color{blue}{-\left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}}{x} \]
      3. associate-*r/40.2%

        \[\leadsto \frac{-\left(\color{blue}{\frac{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x}} - \frac{1}{n}\right)}{x} \]
      4. mul-1-neg40.2%

        \[\leadsto \frac{-\left(\frac{\color{blue}{-\left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}}{x} - \frac{1}{n}\right)}{x} \]
      5. associate-*r/40.2%

        \[\leadsto \frac{-\left(\frac{-\left(\color{blue}{\frac{0.3333333333333333 \cdot 1}{n \cdot x}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      6. metadata-eval40.2%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{\color{blue}{0.3333333333333333}}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      7. *-commutative40.2%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{\color{blue}{x \cdot n}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      8. associate-*r/40.2%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)}{x} - \frac{1}{n}\right)}{x} \]
      9. metadata-eval40.2%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{\color{blue}{0.5}}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
    6. Simplified40.2%

      \[\leadsto \color{blue}{\frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}\right)}{x} - \frac{1}{n}\right)}{x}} \]
    7. Step-by-step derivation
      1. clear-num40.2%

        \[\leadsto \frac{-\left(\frac{-\left(\color{blue}{\frac{1}{\frac{x \cdot n}{0.3333333333333333}}} - \frac{0.5}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      2. inv-pow40.2%

        \[\leadsto \frac{-\left(\frac{-\left(\color{blue}{{\left(\frac{x \cdot n}{0.3333333333333333}\right)}^{-1}} - \frac{0.5}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
    8. Applied egg-rr40.2%

      \[\leadsto \frac{-\left(\frac{-\left(\color{blue}{{\left(\frac{x \cdot n}{0.3333333333333333}\right)}^{-1}} - \frac{0.5}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
    9. Step-by-step derivation
      1. unpow-140.2%

        \[\leadsto \frac{-\left(\frac{-\left(\color{blue}{\frac{1}{\frac{x \cdot n}{0.3333333333333333}}} - \frac{0.5}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      2. associate-/l*40.2%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{1}{\color{blue}{x \cdot \frac{n}{0.3333333333333333}}} - \frac{0.5}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
    10. Simplified40.2%

      \[\leadsto \frac{-\left(\frac{-\left(\color{blue}{\frac{1}{x \cdot \frac{n}{0.3333333333333333}}} - \frac{0.5}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]

    if 3.80000000000000004e40 < x

    1. Initial program 77.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg77.6%

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + \left(-{x}^{\left(\frac{1}{n}\right)}\right)} \]
      2. +-commutative77.6%

        \[\leadsto \color{blue}{\left(-{x}^{\left(\frac{1}{n}\right)}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \]
      3. add-cube-cbrt77.6%

        \[\leadsto \color{blue}{\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}} + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
      4. fma-define77.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
      5. pow-to-exp77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
      6. un-div-inv77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
      7. +-commutative77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
      8. log1p-define77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right) \]
    4. Applied egg-rr77.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)} \]
    5. Taylor expanded in x around inf 77.6%

      \[\leadsto \color{blue}{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + {\left(\sqrt[3]{-1}\right)}^{3} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
    6. Step-by-step derivation
      1. rem-cube-cbrt77.6%

        \[\leadsto e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + \color{blue}{-1} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      2. distribute-rgt1-in77.6%

        \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
      3. metadata-eval77.6%

        \[\leadsto \color{blue}{0} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      4. mul0-lft77.6%

        \[\leadsto \color{blue}{0} \]
    7. Simplified77.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 3.8 \cdot 10^{+40}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{1}{x \cdot \frac{n}{0.3333333333333333}} - \frac{0.5}{n}}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 21: 48.5% accurate, 10.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 4 \cdot 10^{+40}:\\ \;\;\;\;\frac{-1}{\frac{n}{\frac{-1 + \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= x 4e+40)
   (/ -1.0 (/ n (/ (+ -1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) x)))
   0.0))
double code(double x, double n) {
	double tmp;
	if (x <= 4e+40) {
		tmp = -1.0 / (n / ((-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / x));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: tmp
    if (x <= 4d+40) then
        tmp = (-1.0d0) / (n / (((-1.0d0) + ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / x))
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double tmp;
	if (x <= 4e+40) {
		tmp = -1.0 / (n / ((-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / x));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if x <= 4e+40:
		tmp = -1.0 / (n / ((-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / x))
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	tmp = 0.0
	if (x <= 4e+40)
		tmp = Float64(-1.0 / Float64(n / Float64(Float64(-1.0 + Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / x)));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(x, n)
	tmp = 0.0;
	if (x <= 4e+40)
		tmp = -1.0 / (n / ((-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / x));
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[x_, n_] := If[LessEqual[x, 4e+40], N[(-1.0 / N[(n / N[(N[(-1.0 + N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4 \cdot 10^{+40}:\\
\;\;\;\;\frac{-1}{\frac{n}{\frac{-1 + \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}}}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 4.00000000000000012e40

    1. Initial program 44.0%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 46.2%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Step-by-step derivation
      1. clear-num46.1%

        \[\leadsto \color{blue}{\frac{1}{\frac{n}{\log \left(1 + x\right) - \log x}}} \]
      2. inv-pow46.1%

        \[\leadsto \color{blue}{{\left(\frac{n}{\log \left(1 + x\right) - \log x}\right)}^{-1}} \]
      3. log1p-define46.1%

        \[\leadsto {\left(\frac{n}{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}\right)}^{-1} \]
    5. Applied egg-rr46.1%

      \[\leadsto \color{blue}{{\left(\frac{n}{\mathsf{log1p}\left(x\right) - \log x}\right)}^{-1}} \]
    6. Step-by-step derivation
      1. unpow-146.1%

        \[\leadsto \color{blue}{\frac{1}{\frac{n}{\mathsf{log1p}\left(x\right) - \log x}}} \]
    7. Simplified46.1%

      \[\leadsto \color{blue}{\frac{1}{\frac{n}{\mathsf{log1p}\left(x\right) - \log x}}} \]
    8. Taylor expanded in x around -inf 39.7%

      \[\leadsto \frac{1}{\frac{n}{\color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x} - 1}{x}}}} \]
    9. Step-by-step derivation
      1. mul-1-neg39.7%

        \[\leadsto \frac{1}{\frac{n}{\color{blue}{-\frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x} - 1}{x}}}} \]
      2. distribute-neg-frac239.7%

        \[\leadsto \frac{1}{\frac{n}{\color{blue}{\frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x} - 1}{-x}}}} \]
      3. sub-neg39.7%

        \[\leadsto \frac{1}{\frac{n}{\frac{\color{blue}{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x} + \left(-1\right)}}{-x}}} \]
      4. associate-*r/39.7%

        \[\leadsto \frac{1}{\frac{n}{\frac{\color{blue}{\frac{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{x} - 0.5\right)}{x}} + \left(-1\right)}{-x}}} \]
      5. sub-neg39.7%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{-1 \cdot \color{blue}{\left(0.3333333333333333 \cdot \frac{1}{x} + \left(-0.5\right)\right)}}{x} + \left(-1\right)}{-x}}} \]
      6. metadata-eval39.7%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{x} + \color{blue}{-0.5}\right)}{x} + \left(-1\right)}{-x}}} \]
      7. distribute-lft-in39.7%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\color{blue}{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{x}\right) + -1 \cdot -0.5}}{x} + \left(-1\right)}{-x}}} \]
      8. neg-mul-139.7%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\color{blue}{\left(-0.3333333333333333 \cdot \frac{1}{x}\right)} + -1 \cdot -0.5}{x} + \left(-1\right)}{-x}}} \]
      9. associate-*r/39.7%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\left(-\color{blue}{\frac{0.3333333333333333 \cdot 1}{x}}\right) + -1 \cdot -0.5}{x} + \left(-1\right)}{-x}}} \]
      10. metadata-eval39.7%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\left(-\frac{\color{blue}{0.3333333333333333}}{x}\right) + -1 \cdot -0.5}{x} + \left(-1\right)}{-x}}} \]
      11. distribute-neg-frac39.7%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\color{blue}{\frac{-0.3333333333333333}{x}} + -1 \cdot -0.5}{x} + \left(-1\right)}{-x}}} \]
      12. metadata-eval39.7%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\frac{\color{blue}{-0.3333333333333333}}{x} + -1 \cdot -0.5}{x} + \left(-1\right)}{-x}}} \]
      13. metadata-eval39.7%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\frac{-0.3333333333333333}{x} + \color{blue}{0.5}}{x} + \left(-1\right)}{-x}}} \]
      14. metadata-eval39.7%

        \[\leadsto \frac{1}{\frac{n}{\frac{\frac{\frac{-0.3333333333333333}{x} + 0.5}{x} + \color{blue}{-1}}{-x}}} \]
    10. Simplified39.7%

      \[\leadsto \frac{1}{\frac{n}{\color{blue}{\frac{\frac{\frac{-0.3333333333333333}{x} + 0.5}{x} + -1}{-x}}}} \]

    if 4.00000000000000012e40 < x

    1. Initial program 77.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg77.6%

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + \left(-{x}^{\left(\frac{1}{n}\right)}\right)} \]
      2. +-commutative77.6%

        \[\leadsto \color{blue}{\left(-{x}^{\left(\frac{1}{n}\right)}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \]
      3. add-cube-cbrt77.6%

        \[\leadsto \color{blue}{\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}} + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
      4. fma-define77.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
      5. pow-to-exp77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
      6. un-div-inv77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
      7. +-commutative77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
      8. log1p-define77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right) \]
    4. Applied egg-rr77.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)} \]
    5. Taylor expanded in x around inf 77.6%

      \[\leadsto \color{blue}{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + {\left(\sqrt[3]{-1}\right)}^{3} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
    6. Step-by-step derivation
      1. rem-cube-cbrt77.6%

        \[\leadsto e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + \color{blue}{-1} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      2. distribute-rgt1-in77.6%

        \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
      3. metadata-eval77.6%

        \[\leadsto \color{blue}{0} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      4. mul0-lft77.6%

        \[\leadsto \color{blue}{0} \]
    7. Simplified77.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4 \cdot 10^{+40}:\\ \;\;\;\;\frac{-1}{\frac{n}{\frac{-1 + \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 22: 48.6% accurate, 10.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 2.12 \cdot 10^{+40}:\\ \;\;\;\;\frac{\frac{1}{n} - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x \cdot n}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= x 2.12e+40)
   (/ (- (/ 1.0 n) (/ (+ 0.5 (/ -0.3333333333333333 x)) (* x n))) x)
   0.0))
double code(double x, double n) {
	double tmp;
	if (x <= 2.12e+40) {
		tmp = ((1.0 / n) - ((0.5 + (-0.3333333333333333 / x)) / (x * n))) / x;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: tmp
    if (x <= 2.12d+40) then
        tmp = ((1.0d0 / n) - ((0.5d0 + ((-0.3333333333333333d0) / x)) / (x * n))) / x
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double tmp;
	if (x <= 2.12e+40) {
		tmp = ((1.0 / n) - ((0.5 + (-0.3333333333333333 / x)) / (x * n))) / x;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if x <= 2.12e+40:
		tmp = ((1.0 / n) - ((0.5 + (-0.3333333333333333 / x)) / (x * n))) / x
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	tmp = 0.0
	if (x <= 2.12e+40)
		tmp = Float64(Float64(Float64(1.0 / n) - Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / Float64(x * n))) / x);
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(x, n)
	tmp = 0.0;
	if (x <= 2.12e+40)
		tmp = ((1.0 / n) - ((0.5 + (-0.3333333333333333 / x)) / (x * n))) / x;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[x_, n_] := If[LessEqual[x, 2.12e+40], N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.12 \cdot 10^{+40}:\\
\;\;\;\;\frac{\frac{1}{n} - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x \cdot n}}{x}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 2.11999999999999991e40

    1. Initial program 44.0%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 46.2%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around -inf 40.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
    5. Step-by-step derivation
      1. associate-*r/40.2%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}{x}} \]
      2. mul-1-neg40.2%

        \[\leadsto \frac{\color{blue}{-\left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}}{x} \]
      3. associate-*r/40.2%

        \[\leadsto \frac{-\left(\color{blue}{\frac{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x}} - \frac{1}{n}\right)}{x} \]
      4. mul-1-neg40.2%

        \[\leadsto \frac{-\left(\frac{\color{blue}{-\left(0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}}{x} - \frac{1}{n}\right)}{x} \]
      5. associate-*r/40.2%

        \[\leadsto \frac{-\left(\frac{-\left(\color{blue}{\frac{0.3333333333333333 \cdot 1}{n \cdot x}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      6. metadata-eval40.2%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{\color{blue}{0.3333333333333333}}{n \cdot x} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      7. *-commutative40.2%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{\color{blue}{x \cdot n}} - 0.5 \cdot \frac{1}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
      8. associate-*r/40.2%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)}{x} - \frac{1}{n}\right)}{x} \]
      9. metadata-eval40.2%

        \[\leadsto \frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{\color{blue}{0.5}}{n}\right)}{x} - \frac{1}{n}\right)}{x} \]
    6. Simplified40.2%

      \[\leadsto \color{blue}{\frac{-\left(\frac{-\left(\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}\right)}{x} - \frac{1}{n}\right)}{x}} \]
    7. Taylor expanded in x around -inf 40.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
    8. Simplified40.2%

      \[\leadsto \color{blue}{\frac{\frac{\frac{-0.3333333333333333}{x} + 0.5}{x \cdot n} + \frac{-1}{n}}{-x}} \]

    if 2.11999999999999991e40 < x

    1. Initial program 77.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg77.6%

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + \left(-{x}^{\left(\frac{1}{n}\right)}\right)} \]
      2. +-commutative77.6%

        \[\leadsto \color{blue}{\left(-{x}^{\left(\frac{1}{n}\right)}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \]
      3. add-cube-cbrt77.6%

        \[\leadsto \color{blue}{\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}} + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
      4. fma-define77.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
      5. pow-to-exp77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
      6. un-div-inv77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
      7. +-commutative77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
      8. log1p-define77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right) \]
    4. Applied egg-rr77.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)} \]
    5. Taylor expanded in x around inf 77.6%

      \[\leadsto \color{blue}{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + {\left(\sqrt[3]{-1}\right)}^{3} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
    6. Step-by-step derivation
      1. rem-cube-cbrt77.6%

        \[\leadsto e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + \color{blue}{-1} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      2. distribute-rgt1-in77.6%

        \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
      3. metadata-eval77.6%

        \[\leadsto \color{blue}{0} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      4. mul0-lft77.6%

        \[\leadsto \color{blue}{0} \]
    7. Simplified77.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.12 \cdot 10^{+40}:\\ \;\;\;\;\frac{\frac{1}{n} - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x \cdot n}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 23: 42.6% accurate, 21.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 2.9 \cdot 10^{+40}:\\ \;\;\;\;\frac{1}{x \cdot n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n) :precision binary64 (if (<= x 2.9e+40) (/ 1.0 (* x n)) 0.0))
double code(double x, double n) {
	double tmp;
	if (x <= 2.9e+40) {
		tmp = 1.0 / (x * n);
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: tmp
    if (x <= 2.9d+40) then
        tmp = 1.0d0 / (x * n)
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double tmp;
	if (x <= 2.9e+40) {
		tmp = 1.0 / (x * n);
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if x <= 2.9e+40:
		tmp = 1.0 / (x * n)
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	tmp = 0.0
	if (x <= 2.9e+40)
		tmp = Float64(1.0 / Float64(x * n));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(x, n)
	tmp = 0.0;
	if (x <= 2.9e+40)
		tmp = 1.0 / (x * n);
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[x_, n_] := If[LessEqual[x, 2.9e+40], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.9 \cdot 10^{+40}:\\
\;\;\;\;\frac{1}{x \cdot n}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 2.90000000000000017e40

    1. Initial program 44.0%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 46.2%

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
    4. Taylor expanded in x around inf 28.6%

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

    if 2.90000000000000017e40 < x

    1. Initial program 77.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg77.6%

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + \left(-{x}^{\left(\frac{1}{n}\right)}\right)} \]
      2. +-commutative77.6%

        \[\leadsto \color{blue}{\left(-{x}^{\left(\frac{1}{n}\right)}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \]
      3. add-cube-cbrt77.6%

        \[\leadsto \color{blue}{\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}} + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
      4. fma-define77.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
      5. pow-to-exp77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
      6. un-div-inv77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
      7. +-commutative77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
      8. log1p-define77.6%

        \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right) \]
    4. Applied egg-rr77.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)} \]
    5. Taylor expanded in x around inf 77.6%

      \[\leadsto \color{blue}{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + {\left(\sqrt[3]{-1}\right)}^{3} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
    6. Step-by-step derivation
      1. rem-cube-cbrt77.6%

        \[\leadsto e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + \color{blue}{-1} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      2. distribute-rgt1-in77.6%

        \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
      3. metadata-eval77.6%

        \[\leadsto \color{blue}{0} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
      4. mul0-lft77.6%

        \[\leadsto \color{blue}{0} \]
    7. Simplified77.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.9 \cdot 10^{+40}:\\ \;\;\;\;\frac{1}{x \cdot n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 24: 31.2% accurate, 211.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (x n) :precision binary64 0.0)
double code(double x, double n) {
	return 0.0;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    code = 0.0d0
end function
public static double code(double x, double n) {
	return 0.0;
}
def code(x, n):
	return 0.0
function code(x, n)
	return 0.0
end
function tmp = code(x, n)
	tmp = 0.0;
end
code[x_, n_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 57.1%

    \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. sub-neg57.1%

      \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + \left(-{x}^{\left(\frac{1}{n}\right)}\right)} \]
    2. +-commutative57.1%

      \[\leadsto \color{blue}{\left(-{x}^{\left(\frac{1}{n}\right)}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \]
    3. add-cube-cbrt57.1%

      \[\leadsto \color{blue}{\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}} + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
    4. fma-define57.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
    5. pow-to-exp57.1%

      \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
    6. un-div-inv57.1%

      \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
    7. +-commutative57.1%

      \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
    8. log1p-define63.1%

      \[\leadsto \mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right) \]
  4. Applied egg-rr63.1%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{-{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)} \]
  5. Taylor expanded in x around inf 33.8%

    \[\leadsto \color{blue}{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + {\left(\sqrt[3]{-1}\right)}^{3} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
  6. Step-by-step derivation
    1. rem-cube-cbrt33.8%

      \[\leadsto e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} + \color{blue}{-1} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
    2. distribute-rgt1-in33.8%

      \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}} \]
    3. metadata-eval33.8%

      \[\leadsto \color{blue}{0} \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \]
    4. mul0-lft34.1%

      \[\leadsto \color{blue}{0} \]
  7. Simplified34.1%

    \[\leadsto \color{blue}{0} \]
  8. Final simplification34.1%

    \[\leadsto 0 \]
  9. Add Preprocessing

Reproduce

?
herbie shell --seed 2024055 
(FPCore (x n)
  :name "2nthrt (problem 3.4.6)"
  :precision binary64
  (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))