2nthrt (problem 3.4.6)

Percentage Accurate: 52.8% → 84.9%
Time: 36.0s
Alternatives: 23
Speedup: 2.0×

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 23 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: 52.8% 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.9% accurate, 0.1× speedup?

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

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\mathsf{log1p}\left(x\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\

\mathbf{elif}\;\frac{1}{n} \leq 10^{-7}:\\
\;\;\;\;\left(\mathsf{fma}\left(0.5, {n}^{-2} \cdot {\left(\mathsf{log1p}\left(x\right)\right)}^{2}, 0.16666666666666666 \cdot {t_1}^{3}\right) + \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\right) - \mathsf{fma}\left(0.5, {n}^{-2} \cdot {\log x}^{2}, 0.16666666666666666 \cdot {\left(\frac{\log x}{n}\right)}^{3}\right)\\

\mathbf{else}:\\
\;\;\;\;\sqrt[3]{e^{t_1 \cdot 3}} - t_0\\


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

    1. Initial program 78.9%

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

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    3. Step-by-step derivation
      1. log-rec90.0%

        \[\leadsto \frac{e^{-1 \cdot \frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      2. mul-1-neg90.0%

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

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

        \[\leadsto \frac{e^{-1 \cdot \color{blue}{\left(-\frac{\log x}{n}\right)}}}{n \cdot x} \]
      5. neg-mul-190.0%

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

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

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n \cdot x} \]
      8. associate-*r/90.0%

        \[\leadsto \frac{e^{\color{blue}{\log x \cdot \frac{1}{n}}}}{n \cdot x} \]
      9. unpow-190.0%

        \[\leadsto \frac{e^{\log x \cdot \color{blue}{{n}^{-1}}}}{n \cdot x} \]
      10. exp-to-pow90.0%

        \[\leadsto \frac{\color{blue}{{x}^{\left({n}^{-1}\right)}}}{n \cdot x} \]
      11. unpow-190.0%

        \[\leadsto \frac{{x}^{\color{blue}{\left(\frac{1}{n}\right)}}}{n \cdot x} \]
      12. *-commutative90.0%

        \[\leadsto \frac{{x}^{\left(\frac{1}{n}\right)}}{\color{blue}{x \cdot n}} \]
    4. Simplified90.0%

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

    if -2.0000000000000001e-115 < (/.f64 1 n) < 9.9999999999999995e-8

    1. Initial program 34.1%

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

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

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

    if 9.9999999999999995e-8 < (/.f64 1 n)

    1. Initial program 59.1%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Step-by-step derivation
      1. add-cbrt-cube59.1%

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

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

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

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

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

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

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

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

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

Alternative 2: 84.9% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\

\mathbf{elif}\;\frac{1}{n} \leq 10^{-7}:\\
\;\;\;\;\left(\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\right) + \frac{0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right)}{{n}^{3}}\right) + \frac{{\log x}^{2}}{n \cdot n} \cdot -0.5\\

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


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

    1. Initial program 78.9%

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

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    3. Step-by-step derivation
      1. log-rec90.0%

        \[\leadsto \frac{e^{-1 \cdot \frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      2. mul-1-neg90.0%

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

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

        \[\leadsto \frac{e^{-1 \cdot \color{blue}{\left(-\frac{\log x}{n}\right)}}}{n \cdot x} \]
      5. neg-mul-190.0%

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

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

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n \cdot x} \]
      8. associate-*r/90.0%

        \[\leadsto \frac{e^{\color{blue}{\log x \cdot \frac{1}{n}}}}{n \cdot x} \]
      9. unpow-190.0%

        \[\leadsto \frac{e^{\log x \cdot \color{blue}{{n}^{-1}}}}{n \cdot x} \]
      10. exp-to-pow90.0%

        \[\leadsto \frac{\color{blue}{{x}^{\left({n}^{-1}\right)}}}{n \cdot x} \]
      11. unpow-190.0%

        \[\leadsto \frac{{x}^{\color{blue}{\left(\frac{1}{n}\right)}}}{n \cdot x} \]
      12. *-commutative90.0%

        \[\leadsto \frac{{x}^{\left(\frac{1}{n}\right)}}{\color{blue}{x \cdot n}} \]
    4. Simplified90.0%

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

    if -2.0000000000000001e-115 < (/.f64 1 n) < 9.9999999999999995e-8

    1. Initial program 34.1%

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

      \[\leadsto \color{blue}{\left(0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{{n}^{2}} + \left(-1 \cdot \frac{-0.16666666666666666 \cdot {\log \left(1 + x\right)}^{3} - -0.16666666666666666 \cdot {\log x}^{3}}{{n}^{3}} + -1 \cdot \frac{-1 \cdot \log \left(1 + x\right) - -1 \cdot \log x}{n}\right)\right) - 0.5 \cdot \frac{{\log x}^{2}}{{n}^{2}}} \]
    3. Step-by-step derivation
      1. sub-neg85.1%

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

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

    if 9.9999999999999995e-8 < (/.f64 1 n)

    1. Initial program 59.1%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Step-by-step derivation
      1. add-cbrt-cube59.1%

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

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

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

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

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

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

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

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

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

Alternative 3: 84.7% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\mathsf{log1p}\left(x\right)}{n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\

\mathbf{elif}\;\frac{1}{n} \leq 10^{-14}:\\
\;\;\;\;\frac{2 \cdot \left(t_0 + \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}\right) - 2 \cdot \left(\frac{\log x}{n} + \frac{{\log x}^{2}}{n \cdot n}\right)}{t_1 + e^{t_0}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt[3]{e^{t_0 \cdot 3}} - t_1\\


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

    1. Initial program 78.9%

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

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    3. Step-by-step derivation
      1. log-rec90.0%

        \[\leadsto \frac{e^{-1 \cdot \frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      2. mul-1-neg90.0%

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

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

        \[\leadsto \frac{e^{-1 \cdot \color{blue}{\left(-\frac{\log x}{n}\right)}}}{n \cdot x} \]
      5. neg-mul-190.0%

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

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

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n \cdot x} \]
      8. associate-*r/90.0%

        \[\leadsto \frac{e^{\color{blue}{\log x \cdot \frac{1}{n}}}}{n \cdot x} \]
      9. unpow-190.0%

        \[\leadsto \frac{e^{\log x \cdot \color{blue}{{n}^{-1}}}}{n \cdot x} \]
      10. exp-to-pow90.0%

        \[\leadsto \frac{\color{blue}{{x}^{\left({n}^{-1}\right)}}}{n \cdot x} \]
      11. unpow-190.0%

        \[\leadsto \frac{{x}^{\color{blue}{\left(\frac{1}{n}\right)}}}{n \cdot x} \]
      12. *-commutative90.0%

        \[\leadsto \frac{{x}^{\left(\frac{1}{n}\right)}}{\color{blue}{x \cdot n}} \]
    4. Simplified90.0%

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

    if -2.0000000000000001e-115 < (/.f64 1 n) < 9.99999999999999999e-15

    1. Initial program 33.4%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Step-by-step derivation
      1. flip--33.4%

        \[\leadsto \color{blue}{\frac{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \cdot {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \cdot {x}^{\left(\frac{1}{n}\right)}}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + {x}^{\left(\frac{1}{n}\right)}}} \]
      2. div-inv33.4%

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

        \[\leadsto \left(\color{blue}{{\left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)}^{2}} - {x}^{\left(\frac{1}{n}\right)} \cdot {x}^{\left(\frac{1}{n}\right)}\right) \cdot \frac{1}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + {x}^{\left(\frac{1}{n}\right)}} \]
      4. pow-to-exp33.4%

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

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

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

        \[\leadsto \left({\left(e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right)}^{2} - {x}^{\left(\frac{1}{n}\right)} \cdot {x}^{\left(\frac{1}{n}\right)}\right) \cdot \frac{1}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + {x}^{\left(\frac{1}{n}\right)}} \]
      8. pow-sqr33.4%

        \[\leadsto \left({\left(e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)}^{2} - \color{blue}{{x}^{\left(2 \cdot \frac{1}{n}\right)}}\right) \cdot \frac{1}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + {x}^{\left(\frac{1}{n}\right)}} \]
      9. inv-pow33.4%

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

      \[\leadsto \color{blue}{\left({\left(e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right)}^{2} - {x}^{\left(2 \cdot {n}^{-1}\right)}\right) \cdot \frac{1}{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} + {x}^{\left({n}^{-1}\right)}}} \]
    4. Step-by-step derivation
      1. associate-*r/33.4%

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

      \[\leadsto \color{blue}{\frac{{\left(1 + x\right)}^{\left(\frac{2}{n}\right)} - {x}^{\left(\frac{2}{n}\right)}}{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} + {x}^{\left(\frac{1}{n}\right)}}} \]
    6. Taylor expanded in n around inf 84.9%

      \[\leadsto \frac{\color{blue}{\left(2 \cdot \frac{\log \left(1 + x\right)}{n} + 2 \cdot \frac{{\log \left(1 + x\right)}^{2}}{{n}^{2}}\right) - \left(2 \cdot \frac{{\log x}^{2}}{{n}^{2}} + 2 \cdot \frac{\log x}{n}\right)}}{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} + {x}^{\left(\frac{1}{n}\right)}} \]
    7. Step-by-step derivation
      1. distribute-lft-out84.9%

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

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

        \[\leadsto \frac{2 \cdot \left(\frac{\mathsf{log1p}\left(x\right)}{n} + \frac{{\color{blue}{\left(\mathsf{log1p}\left(x\right)\right)}}^{2}}{{n}^{2}}\right) - \left(2 \cdot \frac{{\log x}^{2}}{{n}^{2}} + 2 \cdot \frac{\log x}{n}\right)}{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} + {x}^{\left(\frac{1}{n}\right)}} \]
      4. unpow284.9%

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

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

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

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

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

    1. Initial program 59.8%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Step-by-step derivation
      1. add-cbrt-cube59.8%

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

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

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

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

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

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

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

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

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

Alternative 4: 84.9% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\mathsf{log1p}\left(x\right)}{n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\

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

\mathbf{else}:\\
\;\;\;\;\sqrt[3]{e^{t_0 \cdot 3}} - t_1\\


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

    1. Initial program 78.9%

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

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    3. Step-by-step derivation
      1. log-rec90.0%

        \[\leadsto \frac{e^{-1 \cdot \frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      2. mul-1-neg90.0%

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

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

        \[\leadsto \frac{e^{-1 \cdot \color{blue}{\left(-\frac{\log x}{n}\right)}}}{n \cdot x} \]
      5. neg-mul-190.0%

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

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

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n \cdot x} \]
      8. associate-*r/90.0%

        \[\leadsto \frac{e^{\color{blue}{\log x \cdot \frac{1}{n}}}}{n \cdot x} \]
      9. unpow-190.0%

        \[\leadsto \frac{e^{\log x \cdot \color{blue}{{n}^{-1}}}}{n \cdot x} \]
      10. exp-to-pow90.0%

        \[\leadsto \frac{\color{blue}{{x}^{\left({n}^{-1}\right)}}}{n \cdot x} \]
      11. unpow-190.0%

        \[\leadsto \frac{{x}^{\color{blue}{\left(\frac{1}{n}\right)}}}{n \cdot x} \]
      12. *-commutative90.0%

        \[\leadsto \frac{{x}^{\left(\frac{1}{n}\right)}}{\color{blue}{x \cdot n}} \]
    4. Simplified90.0%

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

    if -2.0000000000000001e-115 < (/.f64 1 n) < 1e-8

    1. Initial program 33.8%

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

      \[\leadsto \color{blue}{\left(0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{{n}^{2}} + \frac{\log \left(1 + x\right)}{n}\right) - \left(\frac{\log x}{n} + 0.5 \cdot \frac{{\log x}^{2}}{{n}^{2}}\right)} \]
    3. Step-by-step derivation
      1. fma-def84.8%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right)}{n}\right) - \left(\frac{\log x}{n} + 0.5 \cdot \frac{{\log x}^{2}}{\color{blue}{n \cdot n}}\right) \]
    4. Simplified84.8%

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

    if 1e-8 < (/.f64 1 n)

    1. Initial program 59.5%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Step-by-step derivation
      1. add-cbrt-cube59.5%

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

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

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

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

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

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

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

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

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

Alternative 5: 84.9% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\

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

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


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

    1. Initial program 78.9%

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

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    3. Step-by-step derivation
      1. log-rec90.0%

        \[\leadsto \frac{e^{-1 \cdot \frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      2. mul-1-neg90.0%

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

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

        \[\leadsto \frac{e^{-1 \cdot \color{blue}{\left(-\frac{\log x}{n}\right)}}}{n \cdot x} \]
      5. neg-mul-190.0%

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

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

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n \cdot x} \]
      8. associate-*r/90.0%

        \[\leadsto \frac{e^{\color{blue}{\log x \cdot \frac{1}{n}}}}{n \cdot x} \]
      9. unpow-190.0%

        \[\leadsto \frac{e^{\log x \cdot \color{blue}{{n}^{-1}}}}{n \cdot x} \]
      10. exp-to-pow90.0%

        \[\leadsto \frac{\color{blue}{{x}^{\left({n}^{-1}\right)}}}{n \cdot x} \]
      11. unpow-190.0%

        \[\leadsto \frac{{x}^{\color{blue}{\left(\frac{1}{n}\right)}}}{n \cdot x} \]
      12. *-commutative90.0%

        \[\leadsto \frac{{x}^{\left(\frac{1}{n}\right)}}{\color{blue}{x \cdot n}} \]
    4. Simplified90.0%

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

    if -2.0000000000000001e-115 < (/.f64 1 n) < 1e-8

    1. Initial program 33.8%

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

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

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

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

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

    if 1e-8 < (/.f64 1 n)

    1. Initial program 59.5%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Step-by-step derivation
      1. add-cbrt-cube59.5%

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

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

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

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

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

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

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

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

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

Alternative 6: 84.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\

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

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


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

    1. Initial program 78.9%

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

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    3. Step-by-step derivation
      1. log-rec90.0%

        \[\leadsto \frac{e^{-1 \cdot \frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      2. mul-1-neg90.0%

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

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

        \[\leadsto \frac{e^{-1 \cdot \color{blue}{\left(-\frac{\log x}{n}\right)}}}{n \cdot x} \]
      5. neg-mul-190.0%

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

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

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n \cdot x} \]
      8. associate-*r/90.0%

        \[\leadsto \frac{e^{\color{blue}{\log x \cdot \frac{1}{n}}}}{n \cdot x} \]
      9. unpow-190.0%

        \[\leadsto \frac{e^{\log x \cdot \color{blue}{{n}^{-1}}}}{n \cdot x} \]
      10. exp-to-pow90.0%

        \[\leadsto \frac{\color{blue}{{x}^{\left({n}^{-1}\right)}}}{n \cdot x} \]
      11. unpow-190.0%

        \[\leadsto \frac{{x}^{\color{blue}{\left(\frac{1}{n}\right)}}}{n \cdot x} \]
      12. *-commutative90.0%

        \[\leadsto \frac{{x}^{\left(\frac{1}{n}\right)}}{\color{blue}{x \cdot n}} \]
    4. Simplified90.0%

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

    if -2.0000000000000001e-115 < (/.f64 1 n) < 9.99999999999999999e-15

    1. Initial program 33.4%

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

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

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

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

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

    1. Initial program 59.8%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Step-by-step derivation
      1. add-cbrt-cube59.8%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{-14}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n} \cdot 3}} - {x}^{\left(\frac{1}{n}\right)}\\ \end{array} \]

Alternative 7: 84.7% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\

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

\mathbf{else}:\\
\;\;\;\;\sqrt[3]{e^{3 \cdot \frac{x}{n}}} - t_0\\


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

    1. Initial program 78.9%

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

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    3. Step-by-step derivation
      1. log-rec90.0%

        \[\leadsto \frac{e^{-1 \cdot \frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      2. mul-1-neg90.0%

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

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

        \[\leadsto \frac{e^{-1 \cdot \color{blue}{\left(-\frac{\log x}{n}\right)}}}{n \cdot x} \]
      5. neg-mul-190.0%

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

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

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n \cdot x} \]
      8. associate-*r/90.0%

        \[\leadsto \frac{e^{\color{blue}{\log x \cdot \frac{1}{n}}}}{n \cdot x} \]
      9. unpow-190.0%

        \[\leadsto \frac{e^{\log x \cdot \color{blue}{{n}^{-1}}}}{n \cdot x} \]
      10. exp-to-pow90.0%

        \[\leadsto \frac{\color{blue}{{x}^{\left({n}^{-1}\right)}}}{n \cdot x} \]
      11. unpow-190.0%

        \[\leadsto \frac{{x}^{\color{blue}{\left(\frac{1}{n}\right)}}}{n \cdot x} \]
      12. *-commutative90.0%

        \[\leadsto \frac{{x}^{\left(\frac{1}{n}\right)}}{\color{blue}{x \cdot n}} \]
    4. Simplified90.0%

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

    if -2.0000000000000001e-115 < (/.f64 1 n) < 9.99999999999999999e-15

    1. Initial program 33.4%

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

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

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

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

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

    1. Initial program 59.8%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Step-by-step derivation
      1. add-cbrt-cube59.8%

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt[3]{e^{\color{blue}{3 \cdot \frac{x}{n}}}} - {x}^{\left(\frac{1}{n}\right)} \]
    5. Step-by-step derivation
      1. *-commutative96.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{-14}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{e^{3 \cdot \frac{x}{n}}} - {x}^{\left(\frac{1}{n}\right)}\\ \end{array} \]

Alternative 8: 84.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\

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

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


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

    1. Initial program 78.9%

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

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    3. Step-by-step derivation
      1. log-rec90.0%

        \[\leadsto \frac{e^{-1 \cdot \frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      2. mul-1-neg90.0%

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

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

        \[\leadsto \frac{e^{-1 \cdot \color{blue}{\left(-\frac{\log x}{n}\right)}}}{n \cdot x} \]
      5. neg-mul-190.0%

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

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

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n \cdot x} \]
      8. associate-*r/90.0%

        \[\leadsto \frac{e^{\color{blue}{\log x \cdot \frac{1}{n}}}}{n \cdot x} \]
      9. unpow-190.0%

        \[\leadsto \frac{e^{\log x \cdot \color{blue}{{n}^{-1}}}}{n \cdot x} \]
      10. exp-to-pow90.0%

        \[\leadsto \frac{\color{blue}{{x}^{\left({n}^{-1}\right)}}}{n \cdot x} \]
      11. unpow-190.0%

        \[\leadsto \frac{{x}^{\color{blue}{\left(\frac{1}{n}\right)}}}{n \cdot x} \]
      12. *-commutative90.0%

        \[\leadsto \frac{{x}^{\left(\frac{1}{n}\right)}}{\color{blue}{x \cdot n}} \]
    4. Simplified90.0%

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

    if -2.0000000000000001e-115 < (/.f64 1 n) < 9.99999999999999999e-15

    1. Initial program 33.4%

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

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

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

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

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

    1. Initial program 59.8%

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

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

        \[\leadsto e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}} - e^{\frac{\log x}{n}} \]
      2. *-rgt-identity96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - e^{\frac{\color{blue}{\log x \cdot 1}}{n}} \]
      3. associate-*r/96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - e^{\color{blue}{\log x \cdot \frac{1}{n}}} \]
      4. unpow-196.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - e^{\log x \cdot \color{blue}{{n}^{-1}}} \]
      5. exp-to-pow96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - \color{blue}{{x}^{\left({n}^{-1}\right)}} \]
      6. /-rgt-identity96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1}}{1}\right)}} \]
      7. metadata-eval96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{\frac{2}{2}}}\right)} \]
      8. associate-/l*96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1} \cdot 2}{2}\right)}} \]
      9. *-commutative96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{\color{blue}{2 \cdot {n}^{-1}}}{2}\right)} \]
      10. *-commutative96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{\color{blue}{{n}^{-1} \cdot 2}}{2}\right)} \]
      11. associate-/l*96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1}}{\frac{2}{2}}\right)}} \]
      12. metadata-eval96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{1}}\right)} \]
      13. /-rgt-identity96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left({n}^{-1}\right)}} \]
      14. unpow-196.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{-14}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \end{array} \]

Alternative 9: 84.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\

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

\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t_0\\


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

    1. Initial program 78.9%

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

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    3. Step-by-step derivation
      1. log-rec90.0%

        \[\leadsto \frac{e^{-1 \cdot \frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      2. mul-1-neg90.0%

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

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

        \[\leadsto \frac{e^{-1 \cdot \color{blue}{\left(-\frac{\log x}{n}\right)}}}{n \cdot x} \]
      5. neg-mul-190.0%

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

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

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n \cdot x} \]
      8. associate-*r/90.0%

        \[\leadsto \frac{e^{\color{blue}{\log x \cdot \frac{1}{n}}}}{n \cdot x} \]
      9. unpow-190.0%

        \[\leadsto \frac{e^{\log x \cdot \color{blue}{{n}^{-1}}}}{n \cdot x} \]
      10. exp-to-pow90.0%

        \[\leadsto \frac{\color{blue}{{x}^{\left({n}^{-1}\right)}}}{n \cdot x} \]
      11. unpow-190.0%

        \[\leadsto \frac{{x}^{\color{blue}{\left(\frac{1}{n}\right)}}}{n \cdot x} \]
      12. *-commutative90.0%

        \[\leadsto \frac{{x}^{\left(\frac{1}{n}\right)}}{\color{blue}{x \cdot n}} \]
    4. Simplified90.0%

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

    if -2.0000000000000001e-115 < (/.f64 1 n) < 9.99999999999999999e-15

    1. Initial program 33.4%

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

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

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

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

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

    1. Initial program 59.8%

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

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

        \[\leadsto e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}} - e^{\frac{\log x}{n}} \]
      2. *-rgt-identity96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - e^{\frac{\color{blue}{\log x \cdot 1}}{n}} \]
      3. associate-*r/96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - e^{\color{blue}{\log x \cdot \frac{1}{n}}} \]
      4. unpow-196.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - e^{\log x \cdot \color{blue}{{n}^{-1}}} \]
      5. exp-to-pow96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - \color{blue}{{x}^{\left({n}^{-1}\right)}} \]
      6. /-rgt-identity96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1}}{1}\right)}} \]
      7. metadata-eval96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{\frac{2}{2}}}\right)} \]
      8. associate-/l*96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1} \cdot 2}{2}\right)}} \]
      9. *-commutative96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{\color{blue}{2 \cdot {n}^{-1}}}{2}\right)} \]
      10. *-commutative96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{\color{blue}{{n}^{-1} \cdot 2}}{2}\right)} \]
      11. associate-/l*96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1}}{\frac{2}{2}}\right)}} \]
      12. metadata-eval96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{1}}\right)} \]
      13. /-rgt-identity96.6%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left({n}^{-1}\right)}} \]
      14. unpow-196.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{-14}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \end{array} \]

Alternative 10: 80.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{1}{n \cdot x}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\

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

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

\mathbf{else}:\\
\;\;\;\;\sqrt[3]{t_0 \cdot \frac{t_0}{n \cdot x}}\\


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

    1. Initial program 78.9%

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

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    3. Step-by-step derivation
      1. log-rec90.0%

        \[\leadsto \frac{e^{-1 \cdot \frac{\color{blue}{-\log x}}{n}}}{n \cdot x} \]
      2. mul-1-neg90.0%

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

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

        \[\leadsto \frac{e^{-1 \cdot \color{blue}{\left(-\frac{\log x}{n}\right)}}}{n \cdot x} \]
      5. neg-mul-190.0%

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

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

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n \cdot x} \]
      8. associate-*r/90.0%

        \[\leadsto \frac{e^{\color{blue}{\log x \cdot \frac{1}{n}}}}{n \cdot x} \]
      9. unpow-190.0%

        \[\leadsto \frac{e^{\log x \cdot \color{blue}{{n}^{-1}}}}{n \cdot x} \]
      10. exp-to-pow90.0%

        \[\leadsto \frac{\color{blue}{{x}^{\left({n}^{-1}\right)}}}{n \cdot x} \]
      11. unpow-190.0%

        \[\leadsto \frac{{x}^{\color{blue}{\left(\frac{1}{n}\right)}}}{n \cdot x} \]
      12. *-commutative90.0%

        \[\leadsto \frac{{x}^{\left(\frac{1}{n}\right)}}{\color{blue}{x \cdot n}} \]
    4. Simplified90.0%

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

    if -2.0000000000000001e-115 < (/.f64 1 n) < 9.99999999999999999e-15

    1. Initial program 33.4%

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

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

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

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

    if 9.99999999999999999e-15 < (/.f64 1 n) < 9.9999999999999994e104

    1. Initial program 82.6%

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

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

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

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

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

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

        \[\leadsto \left(\left(1 + \frac{x}{n}\right) + \left(\frac{0.5}{\color{blue}{n \cdot n}} - 0.5 \cdot \frac{1}{n}\right) \cdot {x}^{2}\right) - {x}^{\left(\frac{1}{n}\right)} \]
      6. associate-*r/84.7%

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

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

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

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

    if 9.9999999999999994e104 < (/.f64 1 n)

    1. Initial program 46.5%

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}{n} \]
    4. Simplified5.6%

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

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

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

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

        \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{1}{x \cdot n} \cdot \frac{1}{x \cdot n}\right) \cdot \frac{1}{x \cdot n}}} \]
    9. Applied egg-rr66.6%

      \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{1}{x \cdot n} \cdot \frac{1}{x \cdot n}\right) \cdot \frac{1}{x \cdot n}}} \]
    10. Step-by-step derivation
      1. associate-*l*66.6%

        \[\leadsto \sqrt[3]{\color{blue}{\frac{1}{x \cdot n} \cdot \left(\frac{1}{x \cdot n} \cdot \frac{1}{x \cdot n}\right)}} \]
      2. associate-*l/66.6%

        \[\leadsto \sqrt[3]{\frac{1}{x \cdot n} \cdot \color{blue}{\frac{1 \cdot \frac{1}{x \cdot n}}{x \cdot n}}} \]
      3. *-lft-identity66.6%

        \[\leadsto \sqrt[3]{\frac{1}{x \cdot n} \cdot \frac{\color{blue}{\frac{1}{x \cdot n}}}{x \cdot n}} \]
    11. Simplified66.6%

      \[\leadsto \color{blue}{\sqrt[3]{\frac{1}{x \cdot n} \cdot \frac{\frac{1}{x \cdot n}}{x \cdot n}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification84.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{-14}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{+105}:\\ \;\;\;\;\left(\left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}\right) \cdot \left(x \cdot x\right) + \left(1 + \frac{x}{n}\right)\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{1}{n \cdot x} \cdot \frac{\frac{1}{n \cdot x}}{n \cdot x}}\\ \end{array} \]

Alternative 11: 70.4% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + \frac{x}{n}\\ t_1 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;x \leq 5.6 \cdot 10^{-209}:\\ \;\;\;\;t_0 - t_1\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-130}:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{elif}\;x \leq 1.22 \cdot 10^{-122}:\\ \;\;\;\;\left(\left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}\right) \cdot \left(x \cdot x\right) + t_0\right) - t_1\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\left(\frac{x}{n} - \frac{\log x}{n}\right) + -0.5 \cdot \frac{x \cdot x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_1}{n \cdot x}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (+ 1.0 (/ x n))) (t_1 (pow x (/ 1.0 n))))
   (if (<= x 5.6e-209)
     (- t_0 t_1)
     (if (<= x 3.6e-130)
       (/ (- (log x)) n)
       (if (<= x 1.22e-122)
         (- (+ (* (- (/ 0.5 (* n n)) (/ 0.5 n)) (* x x)) t_0) t_1)
         (if (<= x 0.88)
           (+ (- (/ x n) (/ (log x) n)) (* -0.5 (/ (* x x) n)))
           (/ t_1 (* n x))))))))
double code(double x, double n) {
	double t_0 = 1.0 + (x / n);
	double t_1 = pow(x, (1.0 / n));
	double tmp;
	if (x <= 5.6e-209) {
		tmp = t_0 - t_1;
	} else if (x <= 3.6e-130) {
		tmp = -log(x) / n;
	} else if (x <= 1.22e-122) {
		tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + t_0) - t_1;
	} else if (x <= 0.88) {
		tmp = ((x / n) - (log(x) / n)) + (-0.5 * ((x * x) / n));
	} else {
		tmp = t_1 / (n * 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 / n)
    t_1 = x ** (1.0d0 / n)
    if (x <= 5.6d-209) then
        tmp = t_0 - t_1
    else if (x <= 3.6d-130) then
        tmp = -log(x) / n
    else if (x <= 1.22d-122) then
        tmp = ((((0.5d0 / (n * n)) - (0.5d0 / n)) * (x * x)) + t_0) - t_1
    else if (x <= 0.88d0) then
        tmp = ((x / n) - (log(x) / n)) + ((-0.5d0) * ((x * x) / n))
    else
        tmp = t_1 / (n * x)
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double t_0 = 1.0 + (x / n);
	double t_1 = Math.pow(x, (1.0 / n));
	double tmp;
	if (x <= 5.6e-209) {
		tmp = t_0 - t_1;
	} else if (x <= 3.6e-130) {
		tmp = -Math.log(x) / n;
	} else if (x <= 1.22e-122) {
		tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + t_0) - t_1;
	} else if (x <= 0.88) {
		tmp = ((x / n) - (Math.log(x) / n)) + (-0.5 * ((x * x) / n));
	} else {
		tmp = t_1 / (n * x);
	}
	return tmp;
}
def code(x, n):
	t_0 = 1.0 + (x / n)
	t_1 = math.pow(x, (1.0 / n))
	tmp = 0
	if x <= 5.6e-209:
		tmp = t_0 - t_1
	elif x <= 3.6e-130:
		tmp = -math.log(x) / n
	elif x <= 1.22e-122:
		tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + t_0) - t_1
	elif x <= 0.88:
		tmp = ((x / n) - (math.log(x) / n)) + (-0.5 * ((x * x) / n))
	else:
		tmp = t_1 / (n * x)
	return tmp
function code(x, n)
	t_0 = Float64(1.0 + Float64(x / n))
	t_1 = x ^ Float64(1.0 / n)
	tmp = 0.0
	if (x <= 5.6e-209)
		tmp = Float64(t_0 - t_1);
	elseif (x <= 3.6e-130)
		tmp = Float64(Float64(-log(x)) / n);
	elseif (x <= 1.22e-122)
		tmp = Float64(Float64(Float64(Float64(Float64(0.5 / Float64(n * n)) - Float64(0.5 / n)) * Float64(x * x)) + t_0) - t_1);
	elseif (x <= 0.88)
		tmp = Float64(Float64(Float64(x / n) - Float64(log(x) / n)) + Float64(-0.5 * Float64(Float64(x * x) / n)));
	else
		tmp = Float64(t_1 / Float64(n * x));
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = 1.0 + (x / n);
	t_1 = x ^ (1.0 / n);
	tmp = 0.0;
	if (x <= 5.6e-209)
		tmp = t_0 - t_1;
	elseif (x <= 3.6e-130)
		tmp = -log(x) / n;
	elseif (x <= 1.22e-122)
		tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + t_0) - t_1;
	elseif (x <= 0.88)
		tmp = ((x / n) - (log(x) / n)) + (-0.5 * ((x * x) / n));
	else
		tmp = t_1 / (n * x);
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 5.6e-209], N[(t$95$0 - t$95$1), $MachinePrecision], If[LessEqual[x, 3.6e-130], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 1.22e-122], N[(N[(N[(N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[x, 0.88], N[(N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(N[(x * x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 3.6 \cdot 10^{-130}:\\
\;\;\;\;\frac{-\log x}{n}\\

\mathbf{elif}\;x \leq 1.22 \cdot 10^{-122}:\\
\;\;\;\;\left(\left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}\right) \cdot \left(x \cdot x\right) + t_0\right) - t_1\\

\mathbf{elif}\;x \leq 0.88:\\
\;\;\;\;\left(\frac{x}{n} - \frac{\log x}{n}\right) + -0.5 \cdot \frac{x \cdot x}{n}\\

\mathbf{else}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < 5.60000000000000025e-209

    1. Initial program 63.4%

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

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

    if 5.60000000000000025e-209 < x < 3.6000000000000001e-130

    1. Initial program 23.4%

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(x\right) - \log x}{n}} \]
    5. Taylor expanded in x around 0 62.7%

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

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

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

    if 3.6000000000000001e-130 < x < 1.22000000000000003e-122

    1. Initial program 73.8%

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

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

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

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

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

        \[\leadsto \left(\left(1 + \frac{x}{n}\right) + \left(\frac{\color{blue}{0.5}}{{n}^{2}} - 0.5 \cdot \frac{1}{n}\right) \cdot {x}^{2}\right) - {x}^{\left(\frac{1}{n}\right)} \]
      5. unpow289.9%

        \[\leadsto \left(\left(1 + \frac{x}{n}\right) + \left(\frac{0.5}{\color{blue}{n \cdot n}} - 0.5 \cdot \frac{1}{n}\right) \cdot {x}^{2}\right) - {x}^{\left(\frac{1}{n}\right)} \]
      6. associate-*r/89.9%

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

        \[\leadsto \left(\left(1 + \frac{x}{n}\right) + \left(\frac{0.5}{n \cdot n} - \frac{\color{blue}{0.5}}{n}\right) \cdot {x}^{2}\right) - {x}^{\left(\frac{1}{n}\right)} \]
      8. unpow289.9%

        \[\leadsto \left(\left(1 + \frac{x}{n}\right) + \left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}\right) \cdot \color{blue}{\left(x \cdot x\right)}\right) - {x}^{\left(\frac{1}{n}\right)} \]
    4. Simplified89.9%

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

    if 1.22000000000000003e-122 < x < 0.880000000000000004

    1. Initial program 41.2%

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}{n} \]
    4. Simplified54.3%

      \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(x\right) - \log x}{n}} \]
    5. Taylor expanded in x around 0 52.0%

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

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

        \[\leadsto \left(\frac{x}{n} + \color{blue}{\left(-\frac{\log x}{n}\right)}\right) + -0.5 \cdot \frac{{x}^{2}}{n} \]
      3. unsub-neg52.0%

        \[\leadsto \color{blue}{\left(\frac{x}{n} - \frac{\log x}{n}\right)} + -0.5 \cdot \frac{{x}^{2}}{n} \]
      4. *-commutative52.0%

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

        \[\leadsto \left(\frac{x}{n} - \frac{\log x}{n}\right) + \frac{\color{blue}{x \cdot x}}{n} \cdot -0.5 \]
    7. Simplified52.0%

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

    if 0.880000000000000004 < x

    1. Initial program 67.3%

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

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

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

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

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

        \[\leadsto \frac{e^{-1 \cdot \color{blue}{\left(-\frac{\log x}{n}\right)}}}{n \cdot x} \]
      5. neg-mul-197.3%

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

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

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n \cdot x} \]
      8. associate-*r/97.3%

        \[\leadsto \frac{e^{\color{blue}{\log x \cdot \frac{1}{n}}}}{n \cdot x} \]
      9. unpow-197.3%

        \[\leadsto \frac{e^{\log x \cdot \color{blue}{{n}^{-1}}}}{n \cdot x} \]
      10. exp-to-pow97.3%

        \[\leadsto \frac{\color{blue}{{x}^{\left({n}^{-1}\right)}}}{n \cdot x} \]
      11. unpow-197.3%

        \[\leadsto \frac{{x}^{\color{blue}{\left(\frac{1}{n}\right)}}}{n \cdot x} \]
      12. *-commutative97.3%

        \[\leadsto \frac{{x}^{\left(\frac{1}{n}\right)}}{\color{blue}{x \cdot n}} \]
    4. Simplified97.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5.6 \cdot 10^{-209}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-130}:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{elif}\;x \leq 1.22 \cdot 10^{-122}:\\ \;\;\;\;\left(\left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}\right) \cdot \left(x \cdot x\right) + \left(1 + \frac{x}{n}\right)\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\left(\frac{x}{n} - \frac{\log x}{n}\right) + -0.5 \cdot \frac{x \cdot x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\ \end{array} \]

Alternative 12: 70.7% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;x \leq 2.1 \cdot 10^{-208}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\left(\frac{x}{n} - \frac{\log x}{n}\right) + -0.5 \cdot \frac{x \cdot x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{n \cdot x}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (pow x (/ 1.0 n))))
   (if (<= x 2.1e-208)
     (- (+ 1.0 (/ x n)) t_0)
     (if (<= x 0.88)
       (+ (- (/ x n) (/ (log x) n)) (* -0.5 (/ (* x x) n)))
       (/ t_0 (* n x))))))
double code(double x, double n) {
	double t_0 = pow(x, (1.0 / n));
	double tmp;
	if (x <= 2.1e-208) {
		tmp = (1.0 + (x / n)) - t_0;
	} else if (x <= 0.88) {
		tmp = ((x / n) - (log(x) / n)) + (-0.5 * ((x * x) / n));
	} else {
		tmp = t_0 / (n * 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) :: tmp
    t_0 = x ** (1.0d0 / n)
    if (x <= 2.1d-208) then
        tmp = (1.0d0 + (x / n)) - t_0
    else if (x <= 0.88d0) then
        tmp = ((x / n) - (log(x) / n)) + ((-0.5d0) * ((x * x) / n))
    else
        tmp = t_0 / (n * 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 tmp;
	if (x <= 2.1e-208) {
		tmp = (1.0 + (x / n)) - t_0;
	} else if (x <= 0.88) {
		tmp = ((x / n) - (Math.log(x) / n)) + (-0.5 * ((x * x) / n));
	} else {
		tmp = t_0 / (n * x);
	}
	return tmp;
}
def code(x, n):
	t_0 = math.pow(x, (1.0 / n))
	tmp = 0
	if x <= 2.1e-208:
		tmp = (1.0 + (x / n)) - t_0
	elif x <= 0.88:
		tmp = ((x / n) - (math.log(x) / n)) + (-0.5 * ((x * x) / n))
	else:
		tmp = t_0 / (n * x)
	return tmp
function code(x, n)
	t_0 = x ^ Float64(1.0 / n)
	tmp = 0.0
	if (x <= 2.1e-208)
		tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0);
	elseif (x <= 0.88)
		tmp = Float64(Float64(Float64(x / n) - Float64(log(x) / n)) + Float64(-0.5 * Float64(Float64(x * x) / n)));
	else
		tmp = Float64(t_0 / Float64(n * x));
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = x ^ (1.0 / n);
	tmp = 0.0;
	if (x <= 2.1e-208)
		tmp = (1.0 + (x / n)) - t_0;
	elseif (x <= 0.88)
		tmp = ((x / n) - (log(x) / n)) + (-0.5 * ((x * x) / n));
	else
		tmp = t_0 / (n * x);
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 2.1e-208], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 0.88], N[(N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(N[(x * x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 2.1 \cdot 10^{-208}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\

\mathbf{elif}\;x \leq 0.88:\\
\;\;\;\;\left(\frac{x}{n} - \frac{\log x}{n}\right) + -0.5 \cdot \frac{x \cdot x}{n}\\

\mathbf{else}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\


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

    1. Initial program 63.4%

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

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

    if 2.10000000000000012e-208 < x < 0.880000000000000004

    1. Initial program 36.7%

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}{n} \]
    4. Simplified55.3%

      \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(x\right) - \log x}{n}} \]
    5. Taylor expanded in x around 0 54.0%

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

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

        \[\leadsto \left(\frac{x}{n} + \color{blue}{\left(-\frac{\log x}{n}\right)}\right) + -0.5 \cdot \frac{{x}^{2}}{n} \]
      3. unsub-neg54.0%

        \[\leadsto \color{blue}{\left(\frac{x}{n} - \frac{\log x}{n}\right)} + -0.5 \cdot \frac{{x}^{2}}{n} \]
      4. *-commutative54.0%

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

        \[\leadsto \left(\frac{x}{n} - \frac{\log x}{n}\right) + \frac{\color{blue}{x \cdot x}}{n} \cdot -0.5 \]
    7. Simplified54.0%

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

    if 0.880000000000000004 < x

    1. Initial program 67.3%

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

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

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

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

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

        \[\leadsto \frac{e^{-1 \cdot \color{blue}{\left(-\frac{\log x}{n}\right)}}}{n \cdot x} \]
      5. neg-mul-197.3%

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

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

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n \cdot x} \]
      8. associate-*r/97.3%

        \[\leadsto \frac{e^{\color{blue}{\log x \cdot \frac{1}{n}}}}{n \cdot x} \]
      9. unpow-197.3%

        \[\leadsto \frac{e^{\log x \cdot \color{blue}{{n}^{-1}}}}{n \cdot x} \]
      10. exp-to-pow97.3%

        \[\leadsto \frac{\color{blue}{{x}^{\left({n}^{-1}\right)}}}{n \cdot x} \]
      11. unpow-197.3%

        \[\leadsto \frac{{x}^{\color{blue}{\left(\frac{1}{n}\right)}}}{n \cdot x} \]
      12. *-commutative97.3%

        \[\leadsto \frac{{x}^{\left(\frac{1}{n}\right)}}{\color{blue}{x \cdot n}} \]
    4. Simplified97.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.1 \cdot 10^{-208}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\left(\frac{x}{n} - \frac{\log x}{n}\right) + -0.5 \cdot \frac{x \cdot x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\ \end{array} \]

Alternative 13: 59.9% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 7 \cdot 10^{-208}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\

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

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

\mathbf{else}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < 6.99999999999999982e-208

    1. Initial program 63.4%

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

      \[\leadsto \color{blue}{1 - e^{\frac{\log x}{n}}} \]
    3. Step-by-step derivation
      1. *-rgt-identity63.4%

        \[\leadsto 1 - e^{\frac{\color{blue}{\log x \cdot 1}}{n}} \]
      2. associate-*r/63.4%

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

        \[\leadsto 1 - e^{\log x \cdot \color{blue}{{n}^{-1}}} \]
      4. exp-to-pow63.4%

        \[\leadsto 1 - \color{blue}{{x}^{\left({n}^{-1}\right)}} \]
      5. unpow-163.4%

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

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

    if 6.99999999999999982e-208 < x < 1

    1. Initial program 36.7%

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}{n} \]
    4. Simplified55.3%

      \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(x\right) - \log x}{n}} \]
    5. Taylor expanded in x around 0 53.6%

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

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

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

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

    if 1 < x < 6.6000000000000002e213

    1. Initial program 52.3%

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{x} - 0.5 \cdot \frac{1}{{x}^{2}}}}{n} \]
    6. Step-by-step derivation
      1. associate-*r/71.0%

        \[\leadsto \frac{\frac{1}{x} - \color{blue}{\frac{0.5 \cdot 1}{{x}^{2}}}}{n} \]
      2. metadata-eval71.0%

        \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{0.5}}{{x}^{2}}}{n} \]
      3. unpow271.0%

        \[\leadsto \frac{\frac{1}{x} - \frac{0.5}{\color{blue}{x \cdot x}}}{n} \]
    7. Simplified71.0%

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

    if 6.6000000000000002e213 < x

    1. Initial program 95.5%

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}{n} \]
    4. Simplified95.5%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{0.3333333333333333 \cdot 1}{{x}^{3}}} + \left(\frac{1}{x} - 0.5 \cdot \frac{1}{{x}^{2}}\right)}{n} \]
      3. metadata-eval71.8%

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

        \[\leadsto \frac{\frac{0.3333333333333333}{{x}^{3}} + \left(\frac{1}{x} - \color{blue}{\frac{0.5 \cdot 1}{{x}^{2}}}\right)}{n} \]
      5. metadata-eval71.8%

        \[\leadsto \frac{\frac{0.3333333333333333}{{x}^{3}} + \left(\frac{1}{x} - \frac{\color{blue}{0.5}}{{x}^{2}}\right)}{n} \]
      6. unpow271.8%

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

      \[\leadsto \frac{\color{blue}{\frac{0.3333333333333333}{{x}^{3}} + \left(\frac{1}{x} - \frac{0.5}{x \cdot x}\right)}}{n} \]
    8. Taylor expanded in x around 0 95.5%

      \[\leadsto \color{blue}{\frac{0.3333333333333333}{n \cdot {x}^{3}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification65.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 7 \cdot 10^{-208}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 6.6 \cdot 10^{+213}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\ \end{array} \]

Alternative 14: 59.9% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.6 \cdot 10^{-209}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\

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

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

\mathbf{else}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < 5.60000000000000025e-209

    1. Initial program 63.4%

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

      \[\leadsto \color{blue}{1 - e^{\frac{\log x}{n}}} \]
    3. Step-by-step derivation
      1. *-rgt-identity63.4%

        \[\leadsto 1 - e^{\frac{\color{blue}{\log x \cdot 1}}{n}} \]
      2. associate-*r/63.4%

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

        \[\leadsto 1 - e^{\log x \cdot \color{blue}{{n}^{-1}}} \]
      4. exp-to-pow63.4%

        \[\leadsto 1 - \color{blue}{{x}^{\left({n}^{-1}\right)}} \]
      5. unpow-163.4%

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

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

    if 5.60000000000000025e-209 < x < 0.95999999999999996

    1. Initial program 36.7%

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}{n} \]
    4. Simplified55.3%

      \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(x\right) - \log x}{n}} \]
    5. Taylor expanded in x around 0 53.6%

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

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

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

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

    if 0.95999999999999996 < x < 9.99999999999999907e214

    1. Initial program 52.3%

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{x} - 0.5 \cdot \frac{1}{{x}^{2}}}}{n} \]
    6. Step-by-step derivation
      1. associate-*r/71.0%

        \[\leadsto \frac{\frac{1}{x} - \color{blue}{\frac{0.5 \cdot 1}{{x}^{2}}}}{n} \]
      2. metadata-eval71.0%

        \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{0.5}}{{x}^{2}}}{n} \]
      3. unpow271.0%

        \[\leadsto \frac{\frac{1}{x} - \frac{0.5}{\color{blue}{x \cdot x}}}{n} \]
    7. Simplified71.0%

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

    if 9.99999999999999907e214 < x

    1. Initial program 95.5%

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}{n} \]
    4. Simplified95.5%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{0.3333333333333333 \cdot 1}{{x}^{3}}} + \left(\frac{1}{x} - 0.5 \cdot \frac{1}{{x}^{2}}\right)}{n} \]
      3. metadata-eval71.8%

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

        \[\leadsto \frac{\frac{0.3333333333333333}{{x}^{3}} + \left(\frac{1}{x} - \color{blue}{\frac{0.5 \cdot 1}{{x}^{2}}}\right)}{n} \]
      5. metadata-eval71.8%

        \[\leadsto \frac{\frac{0.3333333333333333}{{x}^{3}} + \left(\frac{1}{x} - \frac{\color{blue}{0.5}}{{x}^{2}}\right)}{n} \]
      6. unpow271.8%

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

      \[\leadsto \frac{\color{blue}{\frac{0.3333333333333333}{{x}^{3}} + \left(\frac{1}{x} - \frac{0.5}{x \cdot x}\right)}}{n} \]
    8. Taylor expanded in x around 0 95.5%

      \[\leadsto \color{blue}{\frac{0.3333333333333333}{n \cdot {x}^{3}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification65.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5.6 \cdot 10^{-209}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.96:\\ \;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\ \mathbf{elif}\;x \leq 10^{+215}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\ \end{array} \]

Alternative 15: 70.6% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;x \leq 2.8 \cdot 10^{-208}:\\ \;\;\;\;1 - t_0\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{n \cdot x}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (pow x (/ 1.0 n))))
   (if (<= x 2.8e-208)
     (- 1.0 t_0)
     (if (<= x 0.88) (- (/ x n) (/ (log x) n)) (/ t_0 (* n x))))))
double code(double x, double n) {
	double t_0 = pow(x, (1.0 / n));
	double tmp;
	if (x <= 2.8e-208) {
		tmp = 1.0 - t_0;
	} else if (x <= 0.88) {
		tmp = (x / n) - (log(x) / n);
	} else {
		tmp = t_0 / (n * 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) :: tmp
    t_0 = x ** (1.0d0 / n)
    if (x <= 2.8d-208) then
        tmp = 1.0d0 - t_0
    else if (x <= 0.88d0) then
        tmp = (x / n) - (log(x) / n)
    else
        tmp = t_0 / (n * 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 tmp;
	if (x <= 2.8e-208) {
		tmp = 1.0 - t_0;
	} else if (x <= 0.88) {
		tmp = (x / n) - (Math.log(x) / n);
	} else {
		tmp = t_0 / (n * x);
	}
	return tmp;
}
def code(x, n):
	t_0 = math.pow(x, (1.0 / n))
	tmp = 0
	if x <= 2.8e-208:
		tmp = 1.0 - t_0
	elif x <= 0.88:
		tmp = (x / n) - (math.log(x) / n)
	else:
		tmp = t_0 / (n * x)
	return tmp
function code(x, n)
	t_0 = x ^ Float64(1.0 / n)
	tmp = 0.0
	if (x <= 2.8e-208)
		tmp = Float64(1.0 - t_0);
	elseif (x <= 0.88)
		tmp = Float64(Float64(x / n) - Float64(log(x) / n));
	else
		tmp = Float64(t_0 / Float64(n * x));
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = x ^ (1.0 / n);
	tmp = 0.0;
	if (x <= 2.8e-208)
		tmp = 1.0 - t_0;
	elseif (x <= 0.88)
		tmp = (x / n) - (log(x) / n);
	else
		tmp = t_0 / (n * x);
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 2.8e-208], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[x, 0.88], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 2.8 \cdot 10^{-208}:\\
\;\;\;\;1 - t_0\\

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

\mathbf{else}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\


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

    1. Initial program 63.4%

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

      \[\leadsto \color{blue}{1 - e^{\frac{\log x}{n}}} \]
    3. Step-by-step derivation
      1. *-rgt-identity63.4%

        \[\leadsto 1 - e^{\frac{\color{blue}{\log x \cdot 1}}{n}} \]
      2. associate-*r/63.4%

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

        \[\leadsto 1 - e^{\log x \cdot \color{blue}{{n}^{-1}}} \]
      4. exp-to-pow63.4%

        \[\leadsto 1 - \color{blue}{{x}^{\left({n}^{-1}\right)}} \]
      5. unpow-163.4%

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

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

    if 2.80000000000000001e-208 < x < 0.880000000000000004

    1. Initial program 36.7%

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}{n} \]
    4. Simplified55.3%

      \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(x\right) - \log x}{n}} \]
    5. Taylor expanded in x around 0 53.6%

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

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

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

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

    if 0.880000000000000004 < x

    1. Initial program 67.3%

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

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

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

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

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

        \[\leadsto \frac{e^{-1 \cdot \color{blue}{\left(-\frac{\log x}{n}\right)}}}{n \cdot x} \]
      5. neg-mul-197.3%

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

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

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n \cdot x} \]
      8. associate-*r/97.3%

        \[\leadsto \frac{e^{\color{blue}{\log x \cdot \frac{1}{n}}}}{n \cdot x} \]
      9. unpow-197.3%

        \[\leadsto \frac{e^{\log x \cdot \color{blue}{{n}^{-1}}}}{n \cdot x} \]
      10. exp-to-pow97.3%

        \[\leadsto \frac{\color{blue}{{x}^{\left({n}^{-1}\right)}}}{n \cdot x} \]
      11. unpow-197.3%

        \[\leadsto \frac{{x}^{\color{blue}{\left(\frac{1}{n}\right)}}}{n \cdot x} \]
      12. *-commutative97.3%

        \[\leadsto \frac{{x}^{\left(\frac{1}{n}\right)}}{\color{blue}{x \cdot n}} \]
    4. Simplified97.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.8 \cdot 10^{-208}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\ \end{array} \]

Alternative 16: 70.6% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;x \leq 1.15 \cdot 10^{-208}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{n \cdot x}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (pow x (/ 1.0 n))))
   (if (<= x 1.15e-208)
     (- (+ 1.0 (/ x n)) t_0)
     (if (<= x 0.88) (- (/ x n) (/ (log x) n)) (/ t_0 (* n x))))))
double code(double x, double n) {
	double t_0 = pow(x, (1.0 / n));
	double tmp;
	if (x <= 1.15e-208) {
		tmp = (1.0 + (x / n)) - t_0;
	} else if (x <= 0.88) {
		tmp = (x / n) - (log(x) / n);
	} else {
		tmp = t_0 / (n * 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) :: tmp
    t_0 = x ** (1.0d0 / n)
    if (x <= 1.15d-208) then
        tmp = (1.0d0 + (x / n)) - t_0
    else if (x <= 0.88d0) then
        tmp = (x / n) - (log(x) / n)
    else
        tmp = t_0 / (n * 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 tmp;
	if (x <= 1.15e-208) {
		tmp = (1.0 + (x / n)) - t_0;
	} else if (x <= 0.88) {
		tmp = (x / n) - (Math.log(x) / n);
	} else {
		tmp = t_0 / (n * x);
	}
	return tmp;
}
def code(x, n):
	t_0 = math.pow(x, (1.0 / n))
	tmp = 0
	if x <= 1.15e-208:
		tmp = (1.0 + (x / n)) - t_0
	elif x <= 0.88:
		tmp = (x / n) - (math.log(x) / n)
	else:
		tmp = t_0 / (n * x)
	return tmp
function code(x, n)
	t_0 = x ^ Float64(1.0 / n)
	tmp = 0.0
	if (x <= 1.15e-208)
		tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0);
	elseif (x <= 0.88)
		tmp = Float64(Float64(x / n) - Float64(log(x) / n));
	else
		tmp = Float64(t_0 / Float64(n * x));
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = x ^ (1.0 / n);
	tmp = 0.0;
	if (x <= 1.15e-208)
		tmp = (1.0 + (x / n)) - t_0;
	elseif (x <= 0.88)
		tmp = (x / n) - (log(x) / n);
	else
		tmp = t_0 / (n * x);
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1.15e-208], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 0.88], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 1.15 \cdot 10^{-208}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\

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

\mathbf{else}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\


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

    1. Initial program 63.4%

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

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

    if 1.14999999999999998e-208 < x < 0.880000000000000004

    1. Initial program 36.7%

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}{n} \]
    4. Simplified55.3%

      \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(x\right) - \log x}{n}} \]
    5. Taylor expanded in x around 0 53.6%

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

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

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

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

    if 0.880000000000000004 < x

    1. Initial program 67.3%

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

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

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

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

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

        \[\leadsto \frac{e^{-1 \cdot \color{blue}{\left(-\frac{\log x}{n}\right)}}}{n \cdot x} \]
      5. neg-mul-197.3%

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

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

        \[\leadsto \frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n \cdot x} \]
      8. associate-*r/97.3%

        \[\leadsto \frac{e^{\color{blue}{\log x \cdot \frac{1}{n}}}}{n \cdot x} \]
      9. unpow-197.3%

        \[\leadsto \frac{e^{\log x \cdot \color{blue}{{n}^{-1}}}}{n \cdot x} \]
      10. exp-to-pow97.3%

        \[\leadsto \frac{\color{blue}{{x}^{\left({n}^{-1}\right)}}}{n \cdot x} \]
      11. unpow-197.3%

        \[\leadsto \frac{{x}^{\color{blue}{\left(\frac{1}{n}\right)}}}{n \cdot x} \]
      12. *-commutative97.3%

        \[\leadsto \frac{{x}^{\left(\frac{1}{n}\right)}}{\color{blue}{x \cdot n}} \]
    4. Simplified97.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.15 \cdot 10^{-208}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\ \end{array} \]

Alternative 17: 57.0% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{-208}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\


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

    1. Initial program 63.4%

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

      \[\leadsto \color{blue}{1 - e^{\frac{\log x}{n}}} \]
    3. Step-by-step derivation
      1. *-rgt-identity63.4%

        \[\leadsto 1 - e^{\frac{\color{blue}{\log x \cdot 1}}{n}} \]
      2. associate-*r/63.4%

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

        \[\leadsto 1 - e^{\log x \cdot \color{blue}{{n}^{-1}}} \]
      4. exp-to-pow63.4%

        \[\leadsto 1 - \color{blue}{{x}^{\left({n}^{-1}\right)}} \]
      5. unpow-163.4%

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

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

    if 2.0000000000000002e-208 < x < 0.95999999999999996

    1. Initial program 36.7%

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}{n} \]
    4. Simplified55.3%

      \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(x\right) - \log x}{n}} \]
    5. Taylor expanded in x around 0 53.6%

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

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

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

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

    if 0.95999999999999996 < x

    1. Initial program 67.3%

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{x} - 0.5 \cdot \frac{1}{{x}^{2}}}}{n} \]
    6. Step-by-step derivation
      1. associate-*r/71.3%

        \[\leadsto \frac{\frac{1}{x} - \color{blue}{\frac{0.5 \cdot 1}{{x}^{2}}}}{n} \]
      2. metadata-eval71.3%

        \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{0.5}}{{x}^{2}}}{n} \]
      3. unpow271.3%

        \[\leadsto \frac{\frac{1}{x} - \frac{0.5}{\color{blue}{x \cdot x}}}{n} \]
    7. Simplified71.3%

      \[\leadsto \frac{\color{blue}{\frac{1}{x} - \frac{0.5}{x \cdot x}}}{n} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification62.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2 \cdot 10^{-208}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.96:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\ \end{array} \]

Alternative 18: 58.2% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= x 1.0) (/ (- x (log x)) n) (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n)))
double code(double x, double n) {
	double tmp;
	if (x <= 1.0) {
		tmp = (x - log(x)) / n;
	} else {
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: tmp
    if (x <= 1.0d0) then
        tmp = (x - log(x)) / n
    else
        tmp = ((1.0d0 / x) - (0.5d0 / (x * x))) / n
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double tmp;
	if (x <= 1.0) {
		tmp = (x - Math.log(x)) / n;
	} else {
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if x <= 1.0:
		tmp = (x - math.log(x)) / n
	else:
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n
	return tmp
function code(x, n)
	tmp = 0.0
	if (x <= 1.0)
		tmp = Float64(Float64(x - log(x)) / n);
	else
		tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n);
	end
	return tmp
end
function tmp_2 = code(x, n)
	tmp = 0.0;
	if (x <= 1.0)
		tmp = (x - log(x)) / n;
	else
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
	end
	tmp_2 = tmp;
end
code[x_, n_] := If[LessEqual[x, 1.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{x - \log x}{n}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\


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

    1. Initial program 45.5%

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}{n} \]
    4. Simplified50.0%

      \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(x\right) - \log x}{n}} \]
    5. Taylor expanded in x around 0 48.9%

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

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

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

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

    if 1 < x

    1. Initial program 67.3%

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{x} - 0.5 \cdot \frac{1}{{x}^{2}}}}{n} \]
    6. Step-by-step derivation
      1. associate-*r/71.3%

        \[\leadsto \frac{\frac{1}{x} - \color{blue}{\frac{0.5 \cdot 1}{{x}^{2}}}}{n} \]
      2. metadata-eval71.3%

        \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{0.5}}{{x}^{2}}}{n} \]
      3. unpow271.3%

        \[\leadsto \frac{\frac{1}{x} - \frac{0.5}{\color{blue}{x \cdot x}}}{n} \]
    7. Simplified71.3%

      \[\leadsto \frac{\color{blue}{\frac{1}{x} - \frac{0.5}{x \cdot x}}}{n} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification57.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\ \end{array} \]

Alternative 19: 58.0% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.68:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= x 0.68) (/ (- (log x)) n) (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n)))
double code(double x, double n) {
	double tmp;
	if (x <= 0.68) {
		tmp = -log(x) / n;
	} else {
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: tmp
    if (x <= 0.68d0) then
        tmp = -log(x) / n
    else
        tmp = ((1.0d0 / x) - (0.5d0 / (x * x))) / n
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double tmp;
	if (x <= 0.68) {
		tmp = -Math.log(x) / n;
	} else {
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if x <= 0.68:
		tmp = -math.log(x) / n
	else:
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n
	return tmp
function code(x, n)
	tmp = 0.0
	if (x <= 0.68)
		tmp = Float64(Float64(-log(x)) / n);
	else
		tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n);
	end
	return tmp
end
function tmp_2 = code(x, n)
	tmp = 0.0;
	if (x <= 0.68)
		tmp = -log(x) / n;
	else
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
	end
	tmp_2 = tmp;
end
code[x_, n_] := If[LessEqual[x, 0.68], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.68:\\
\;\;\;\;\frac{-\log x}{n}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\


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

    1. Initial program 45.1%

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}{n} \]
    4. Simplified50.3%

      \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(x\right) - \log x}{n}} \]
    5. Taylor expanded in x around 0 48.3%

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

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

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

    if 0.680000000000000049 < x

    1. Initial program 67.6%

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}{n} \]
    4. Simplified65.3%

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

      \[\leadsto \frac{\color{blue}{\frac{1}{x} - 0.5 \cdot \frac{1}{{x}^{2}}}}{n} \]
    6. Step-by-step derivation
      1. associate-*r/70.6%

        \[\leadsto \frac{\frac{1}{x} - \color{blue}{\frac{0.5 \cdot 1}{{x}^{2}}}}{n} \]
      2. metadata-eval70.6%

        \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{0.5}}{{x}^{2}}}{n} \]
      3. unpow270.6%

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

      \[\leadsto \frac{\color{blue}{\frac{1}{x} - \frac{0.5}{x \cdot x}}}{n} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification57.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.68:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\ \end{array} \]

Alternative 20: 41.0% accurate, 42.2× speedup?

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

\\
\frac{1}{n \cdot x}
\end{array}
Derivation
  1. Initial program 53.8%

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{x \cdot n}} \]
  8. Final simplification39.3%

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

Alternative 21: 41.5% accurate, 42.2× speedup?

\[\begin{array}{l} \\ \frac{\frac{1}{n}}{x} \end{array} \]
(FPCore (x n) :precision binary64 (/ (/ 1.0 n) x))
double code(double x, double n) {
	return (1.0 / n) / x;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    code = (1.0d0 / n) / x
end function
public static double code(double x, double n) {
	return (1.0 / n) / x;
}
def code(x, n):
	return (1.0 / n) / x
function code(x, n)
	return Float64(Float64(1.0 / n) / x)
end
function tmp = code(x, n)
	tmp = (1.0 / n) / x;
end
code[x_, n_] := N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{1}{n}}{x}
\end{array}
Derivation
  1. Initial program 53.8%

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{x \cdot n}} \]
  8. Step-by-step derivation
    1. add-cbrt-cube41.9%

      \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{1}{x \cdot n} \cdot \frac{1}{x \cdot n}\right) \cdot \frac{1}{x \cdot n}}} \]
  9. Applied egg-rr41.9%

    \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{1}{x \cdot n} \cdot \frac{1}{x \cdot n}\right) \cdot \frac{1}{x \cdot n}}} \]
  10. Step-by-step derivation
    1. associate-*l*41.9%

      \[\leadsto \sqrt[3]{\color{blue}{\frac{1}{x \cdot n} \cdot \left(\frac{1}{x \cdot n} \cdot \frac{1}{x \cdot n}\right)}} \]
    2. associate-*l/41.9%

      \[\leadsto \sqrt[3]{\frac{1}{x \cdot n} \cdot \color{blue}{\frac{1 \cdot \frac{1}{x \cdot n}}{x \cdot n}}} \]
    3. *-lft-identity41.9%

      \[\leadsto \sqrt[3]{\frac{1}{x \cdot n} \cdot \frac{\color{blue}{\frac{1}{x \cdot n}}}{x \cdot n}} \]
  11. Simplified41.9%

    \[\leadsto \color{blue}{\sqrt[3]{\frac{1}{x \cdot n} \cdot \frac{\frac{1}{x \cdot n}}{x \cdot n}}} \]
  12. Step-by-step derivation
    1. cbrt-prod40.0%

      \[\leadsto \color{blue}{\sqrt[3]{\frac{1}{x \cdot n}} \cdot \sqrt[3]{\frac{\frac{1}{x \cdot n}}{x \cdot n}}} \]
    2. div-inv40.0%

      \[\leadsto \sqrt[3]{\frac{1}{x \cdot n}} \cdot \sqrt[3]{\color{blue}{\frac{1}{x \cdot n} \cdot \frac{1}{x \cdot n}}} \]
    3. cbrt-prod39.1%

      \[\leadsto \sqrt[3]{\frac{1}{x \cdot n}} \cdot \color{blue}{\left(\sqrt[3]{\frac{1}{x \cdot n}} \cdot \sqrt[3]{\frac{1}{x \cdot n}}\right)} \]
    4. associate-*l*39.1%

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{1}{x \cdot n}} \cdot \sqrt[3]{\frac{1}{x \cdot n}}\right) \cdot \sqrt[3]{\frac{1}{x \cdot n}}} \]
    5. add-cube-cbrt39.3%

      \[\leadsto \color{blue}{\frac{1}{x \cdot n}} \]
    6. *-commutative39.3%

      \[\leadsto \frac{1}{\color{blue}{n \cdot x}} \]
    7. associate-/r*39.8%

      \[\leadsto \color{blue}{\frac{\frac{1}{n}}{x}} \]
  13. Applied egg-rr39.8%

    \[\leadsto \color{blue}{\frac{\frac{1}{n}}{x}} \]
  14. Final simplification39.8%

    \[\leadsto \frac{\frac{1}{n}}{x} \]

Alternative 22: 41.5% accurate, 42.2× speedup?

\[\begin{array}{l} \\ \frac{\frac{1}{x}}{n} \end{array} \]
(FPCore (x n) :precision binary64 (/ (/ 1.0 x) n))
double code(double x, double n) {
	return (1.0 / x) / n;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    code = (1.0d0 / x) / n
end function
public static double code(double x, double n) {
	return (1.0 / x) / n;
}
def code(x, n):
	return (1.0 / x) / n
function code(x, n)
	return Float64(Float64(1.0 / x) / n)
end
function tmp = code(x, n)
	tmp = (1.0 / x) / n;
end
code[x_, n_] := N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{1}{x}}{n}
\end{array}
Derivation
  1. Initial program 53.8%

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{1}{x}}}{n} \]
  6. Final simplification39.8%

    \[\leadsto \frac{\frac{1}{x}}{n} \]

Alternative 23: 4.6% accurate, 70.3× speedup?

\[\begin{array}{l} \\ \frac{x}{n} \end{array} \]
(FPCore (x n) :precision binary64 (/ x n))
double code(double x, double n) {
	return x / n;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    code = x / n
end function
public static double code(double x, double n) {
	return x / n;
}
def code(x, n):
	return x / n
function code(x, n)
	return Float64(x / n)
end
function tmp = code(x, n)
	tmp = x / n;
end
code[x_, n_] := N[(x / n), $MachinePrecision]
\begin{array}{l}

\\
\frac{x}{n}
\end{array}
Derivation
  1. Initial program 53.8%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{x \cdot n}} \]
    2. expm1-log1p-u31.7%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{x \cdot n}\right)\right)} \]
    3. expm1-udef24.7%

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

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

      \[\leadsto e^{\mathsf{log1p}\left(\frac{\frac{1}{\color{blue}{e^{\log x}}}}{n}\right)} - 1 \]
    6. rec-exp24.7%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{e^{-\log x}}}{n}\right)} - 1 \]
    7. add-exp-log5.2%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{e^{\color{blue}{e^{\log \left(-\log x\right)}}}}{n}\right)} - 1 \]
    8. add-sqr-sqrt5.2%

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

      \[\leadsto e^{\mathsf{log1p}\left(\frac{e^{\color{blue}{\sqrt{e^{\log \left(-\log x\right)} \cdot e^{\log \left(-\log x\right)}}}}}{n}\right)} - 1 \]
    10. add-exp-log5.2%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{e^{\sqrt{\color{blue}{\left(-\log x\right)} \cdot e^{\log \left(-\log x\right)}}}}{n}\right)} - 1 \]
    11. add-exp-log11.4%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{e^{\sqrt{\left(-\log x\right) \cdot \color{blue}{\left(-\log x\right)}}}}{n}\right)} - 1 \]
    12. sqr-neg11.4%

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

      \[\leadsto e^{\mathsf{log1p}\left(\frac{e^{\color{blue}{\sqrt{\log x} \cdot \sqrt{\log x}}}}{n}\right)} - 1 \]
    14. add-sqr-sqrt8.9%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{e^{\color{blue}{\log x}}}{n}\right)} - 1 \]
    15. add-exp-log8.9%

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

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{n}\right)} - 1} \]
  8. Step-by-step derivation
    1. expm1-def4.3%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{n}\right)\right)} \]
    2. expm1-log1p5.0%

      \[\leadsto \color{blue}{\frac{x}{n}} \]
  9. Simplified5.0%

    \[\leadsto \color{blue}{\frac{x}{n}} \]
  10. Final simplification5.0%

    \[\leadsto \frac{x}{n} \]

Reproduce

?
herbie shell --seed 2023274 
(FPCore (x n)
  :name "2nthrt (problem 3.4.6)"
  :precision binary64
  (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))