2nthrt (problem 3.4.6)

Percentage Accurate: 53.0% → 88.2%
Time: 57.7s
Alternatives: 14
Speedup: 1.9×

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 14 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: 53.0% 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: 88.2% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\sqrt[3]{{\left(\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{\mathsf{fma}\left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}, 0.5, 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}\right)}{n}\right)}^{3}}}{-n}\\
\mathbf{if}\;x \leq 5.5 \cdot 10^{-216}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 8 \cdot 10^{-192}:\\
\;\;\;\;1 - t\_0\\

\mathbf{elif}\;x \leq 47000:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 5.49999999999999991e-216 or 8.0000000000000008e-192 < x < 47000

    1. Initial program 39.0%

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

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

      \[\leadsto \color{blue}{\frac{\log x - \left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}}{n}\right)}{-n}} \]
    5. Step-by-step derivation
      1. add-cbrt-cube85.4%

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

        \[\leadsto \frac{\sqrt[3]{\color{blue}{{\left(\log x - \left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}}{n}\right)\right)}^{3}}}}{-n} \]
    6. Applied egg-rr85.4%

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

    if 5.49999999999999991e-216 < x < 8.0000000000000008e-192

    1. Initial program 90.4%

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

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

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

        \[\leadsto 1 - e^{\color{blue}{\frac{\log x \cdot 1}{n}}} \]
      3. associate-/l*90.4%

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

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

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

    if 47000 < x

    1. Initial program 68.8%

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

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

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

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

        \[\leadsto \frac{\frac{e^{-\frac{\color{blue}{-\log x}}{n}}}{n}}{x} \]
      4. mul-1-neg99.1%

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

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

        \[\leadsto \frac{\frac{e^{\frac{-\color{blue}{\left(-\log x\right)}}{n}}}{n}}{x} \]
      7. remove-double-neg99.1%

        \[\leadsto \frac{\frac{e^{\frac{\color{blue}{\log x}}{n}}}{n}}{x} \]
      8. *-rgt-identity99.1%

        \[\leadsto \frac{\frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n}}{x} \]
      9. associate-/l*99.1%

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

        \[\leadsto \frac{\frac{\color{blue}{{x}^{\left(\frac{1}{n}\right)}}}{n}}{x} \]
    5. Simplified99.1%

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

Alternative 2: 84.8% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{0.5}{{n}^{2}}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
t_2 := \frac{t\_1}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-89}:\\
\;\;\;\;\frac{t\_2}{x}\\

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

\mathbf{elif}\;\frac{1}{n} \leq 10^{-5}:\\
\;\;\;\;\frac{t\_2 + t\_1 \cdot \left(\frac{t\_0 + \frac{-0.5}{n}}{x} + \frac{\frac{0.16666666666666666}{{n}^{3}} + \left(\frac{0.3333333333333333}{n} - t\_0\right)}{{x}^{2}}\right)}{x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000004e-89

    1. Initial program 79.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.00000000000000004e-89 < (/.f64 #s(literal 1 binary64) n) < 1.19999999999999992e-62

    1. Initial program 39.5%

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

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

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

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

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

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

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

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

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

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

    if 1.19999999999999992e-62 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000008e-5

    1. Initial program 9.3%

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

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

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

    if 1.00000000000000008e-5 < (/.f64 #s(literal 1 binary64) n)

    1. Initial program 53.9%

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

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

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

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

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

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

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

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

Alternative 3: 84.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{t\_0}{n}\\ \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-89}:\\ \;\;\;\;\frac{t\_1}{x}\\ \mathbf{elif}\;\frac{1}{n} \leq 1.2 \cdot 10^{-62}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n} - \log x\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{-5}:\\ \;\;\;\;\frac{\mathsf{fma}\left(t\_0, \frac{\frac{0.5}{{n}^{2}} + \frac{-0.5}{n}}{x}, t\_1\right)}{x}\\ \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))) (t_1 (/ t_0 n)))
   (if (<= (/ 1.0 n) -1e-89)
     (/ t_1 x)
     (if (<= (/ 1.0 n) 1.2e-62)
       (/
        (+
         (log1p x)
         (- (* 0.5 (/ (- (pow (log1p x) 2.0) (pow (log x) 2.0)) n)) (log x)))
        n)
       (if (<= (/ 1.0 n) 1e-5)
         (/ (fma t_0 (/ (+ (/ 0.5 (pow n 2.0)) (/ -0.5 n)) x) t_1) x)
         (- (exp (/ (log1p x) n)) t_0))))))
double code(double x, double n) {
	double t_0 = pow(x, (1.0 / n));
	double t_1 = t_0 / n;
	double tmp;
	if ((1.0 / n) <= -1e-89) {
		tmp = t_1 / x;
	} else if ((1.0 / n) <= 1.2e-62) {
		tmp = (log1p(x) + ((0.5 * ((pow(log1p(x), 2.0) - pow(log(x), 2.0)) / n)) - log(x))) / n;
	} else if ((1.0 / n) <= 1e-5) {
		tmp = fma(t_0, (((0.5 / pow(n, 2.0)) + (-0.5 / n)) / x), t_1) / x;
	} else {
		tmp = exp((log1p(x) / n)) - t_0;
	}
	return tmp;
}
function code(x, n)
	t_0 = x ^ Float64(1.0 / n)
	t_1 = Float64(t_0 / n)
	tmp = 0.0
	if (Float64(1.0 / n) <= -1e-89)
		tmp = Float64(t_1 / x);
	elseif (Float64(1.0 / n) <= 1.2e-62)
		tmp = Float64(Float64(log1p(x) + Float64(Float64(0.5 * Float64(Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)) / n)) - log(x))) / n);
	elseif (Float64(1.0 / n) <= 1e-5)
		tmp = Float64(fma(t_0, Float64(Float64(Float64(0.5 / (n ^ 2.0)) + Float64(-0.5 / n)) / x), t_1) / x);
	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]}, Block[{t$95$1 = N[(t$95$0 / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-89], N[(t$95$1 / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1.2e-62], N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(0.5 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-5], N[(N[(t$95$0 * N[(N[(N[(0.5 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + t$95$1), $MachinePrecision] / x), $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)}\\
t_1 := \frac{t\_0}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-89}:\\
\;\;\;\;\frac{t\_1}{x}\\

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

\mathbf{elif}\;\frac{1}{n} \leq 10^{-5}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_0, \frac{\frac{0.5}{{n}^{2}} + \frac{-0.5}{n}}{x}, t\_1\right)}{x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000004e-89

    1. Initial program 79.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.00000000000000004e-89 < (/.f64 #s(literal 1 binary64) n) < 1.19999999999999992e-62

    1. Initial program 39.5%

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

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

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

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

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

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

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

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

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

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

    if 1.19999999999999992e-62 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000008e-5

    1. Initial program 9.3%

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

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

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

      if 1.00000000000000008e-5 < (/.f64 #s(literal 1 binary64) n)

      1. Initial program 53.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}} \]
    5. Recombined 4 regimes into one program.
    6. Add Preprocessing

    Alternative 4: 84.7% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{t\_0}{n}\\ \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-89}:\\ \;\;\;\;\frac{t\_1}{x}\\ \mathbf{elif}\;\frac{1}{n} \leq 1.2 \cdot 10^{-62}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{-5}:\\ \;\;\;\;\frac{\mathsf{fma}\left(t\_0, \frac{\frac{0.5}{{n}^{2}} + \frac{-0.5}{n}}{x}, t\_1\right)}{x}\\ \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))) (t_1 (/ t_0 n)))
       (if (<= (/ 1.0 n) -1e-89)
         (/ t_1 x)
         (if (<= (/ 1.0 n) 1.2e-62)
           (/ (- (log1p x) (log x)) n)
           (if (<= (/ 1.0 n) 1e-5)
             (/ (fma t_0 (/ (+ (/ 0.5 (pow n 2.0)) (/ -0.5 n)) x) t_1) x)
             (- (exp (/ (log1p x) n)) t_0))))))
    double code(double x, double n) {
    	double t_0 = pow(x, (1.0 / n));
    	double t_1 = t_0 / n;
    	double tmp;
    	if ((1.0 / n) <= -1e-89) {
    		tmp = t_1 / x;
    	} else if ((1.0 / n) <= 1.2e-62) {
    		tmp = (log1p(x) - log(x)) / n;
    	} else if ((1.0 / n) <= 1e-5) {
    		tmp = fma(t_0, (((0.5 / pow(n, 2.0)) + (-0.5 / n)) / x), t_1) / x;
    	} else {
    		tmp = exp((log1p(x) / n)) - t_0;
    	}
    	return tmp;
    }
    
    function code(x, n)
    	t_0 = x ^ Float64(1.0 / n)
    	t_1 = Float64(t_0 / n)
    	tmp = 0.0
    	if (Float64(1.0 / n) <= -1e-89)
    		tmp = Float64(t_1 / x);
    	elseif (Float64(1.0 / n) <= 1.2e-62)
    		tmp = Float64(Float64(log1p(x) - log(x)) / n);
    	elseif (Float64(1.0 / n) <= 1e-5)
    		tmp = Float64(fma(t_0, Float64(Float64(Float64(0.5 / (n ^ 2.0)) + Float64(-0.5 / n)) / x), t_1) / x);
    	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]}, Block[{t$95$1 = N[(t$95$0 / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-89], N[(t$95$1 / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1.2e-62], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-5], N[(N[(t$95$0 * N[(N[(N[(0.5 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + t$95$1), $MachinePrecision] / x), $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)}\\
    t_1 := \frac{t\_0}{n}\\
    \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-89}:\\
    \;\;\;\;\frac{t\_1}{x}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 1.2 \cdot 10^{-62}:\\
    \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 10^{-5}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(t\_0, \frac{\frac{0.5}{{n}^{2}} + \frac{-0.5}{n}}{x}, t\_1\right)}{x}\\
    
    \mathbf{else}:\\
    \;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000004e-89

      1. Initial program 79.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -1.00000000000000004e-89 < (/.f64 #s(literal 1 binary64) n) < 1.19999999999999992e-62

      1. Initial program 39.5%

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

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

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

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

      if 1.19999999999999992e-62 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000008e-5

      1. Initial program 9.3%

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

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

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

        if 1.00000000000000008e-5 < (/.f64 #s(literal 1 binary64) n)

        1. Initial program 53.9%

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}} \]
      5. Recombined 4 regimes into one program.
      6. Add Preprocessing

      Alternative 5: 85.4% accurate, 0.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\ \mathbf{if}\;n \leq -35000000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;n \leq 11600:\\ \;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\ \mathbf{elif}\;n \leq 8 \cdot 10^{+61}:\\ \;\;\;\;\frac{\frac{t\_0}{n} + \frac{\frac{0.3333333333333333}{{x}^{2}} - \left(\frac{0.5}{x} + \frac{0.25}{{x}^{3}}\right)}{n}}{x}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
      (FPCore (x n)
       :precision binary64
       (let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (- (log1p x) (log x)) n)))
         (if (<= n -35000000000.0)
           t_1
           (if (<= n 11600.0)
             (- (exp (/ (log1p x) n)) t_0)
             (if (<= n 8e+61)
               (/
                (+
                 (/ t_0 n)
                 (/
                  (-
                   (/ 0.3333333333333333 (pow x 2.0))
                   (+ (/ 0.5 x) (/ 0.25 (pow x 3.0))))
                  n))
                x)
               t_1)))))
      double code(double x, double n) {
      	double t_0 = pow(x, (1.0 / n));
      	double t_1 = (log1p(x) - log(x)) / n;
      	double tmp;
      	if (n <= -35000000000.0) {
      		tmp = t_1;
      	} else if (n <= 11600.0) {
      		tmp = exp((log1p(x) / n)) - t_0;
      	} else if (n <= 8e+61) {
      		tmp = ((t_0 / n) + (((0.3333333333333333 / pow(x, 2.0)) - ((0.5 / x) + (0.25 / pow(x, 3.0)))) / n)) / x;
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      public static double code(double x, double n) {
      	double t_0 = Math.pow(x, (1.0 / n));
      	double t_1 = (Math.log1p(x) - Math.log(x)) / n;
      	double tmp;
      	if (n <= -35000000000.0) {
      		tmp = t_1;
      	} else if (n <= 11600.0) {
      		tmp = Math.exp((Math.log1p(x) / n)) - t_0;
      	} else if (n <= 8e+61) {
      		tmp = ((t_0 / n) + (((0.3333333333333333 / Math.pow(x, 2.0)) - ((0.5 / x) + (0.25 / Math.pow(x, 3.0)))) / n)) / x;
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      def code(x, n):
      	t_0 = math.pow(x, (1.0 / n))
      	t_1 = (math.log1p(x) - math.log(x)) / n
      	tmp = 0
      	if n <= -35000000000.0:
      		tmp = t_1
      	elif n <= 11600.0:
      		tmp = math.exp((math.log1p(x) / n)) - t_0
      	elif n <= 8e+61:
      		tmp = ((t_0 / n) + (((0.3333333333333333 / math.pow(x, 2.0)) - ((0.5 / x) + (0.25 / math.pow(x, 3.0)))) / n)) / x
      	else:
      		tmp = t_1
      	return tmp
      
      function code(x, n)
      	t_0 = x ^ Float64(1.0 / n)
      	t_1 = Float64(Float64(log1p(x) - log(x)) / n)
      	tmp = 0.0
      	if (n <= -35000000000.0)
      		tmp = t_1;
      	elseif (n <= 11600.0)
      		tmp = Float64(exp(Float64(log1p(x) / n)) - t_0);
      	elseif (n <= 8e+61)
      		tmp = Float64(Float64(Float64(t_0 / n) + Float64(Float64(Float64(0.3333333333333333 / (x ^ 2.0)) - Float64(Float64(0.5 / x) + Float64(0.25 / (x ^ 3.0)))) / n)) / x);
      	else
      		tmp = t_1;
      	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[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[n, -35000000000.0], t$95$1, If[LessEqual[n, 11600.0], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[n, 8e+61], N[(N[(N[(t$95$0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] - N[(N[(0.5 / x), $MachinePrecision] + N[(0.25 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], t$95$1]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := {x}^{\left(\frac{1}{n}\right)}\\
      t_1 := \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
      \mathbf{if}\;n \leq -35000000000:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;n \leq 11600:\\
      \;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
      
      \mathbf{elif}\;n \leq 8 \cdot 10^{+61}:\\
      \;\;\;\;\frac{\frac{t\_0}{n} + \frac{\frac{0.3333333333333333}{{x}^{2}} - \left(\frac{0.5}{x} + \frac{0.25}{{x}^{3}}\right)}{n}}{x}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if n < -3.5e10 or 7.9999999999999996e61 < n

        1. Initial program 36.9%

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

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

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

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

        if -3.5e10 < n < 11600

        1. Initial program 81.0%

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

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

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

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

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

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

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

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

        if 11600 < n < 7.9999999999999996e61

        1. Initial program 9.3%

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

          \[\leadsto \color{blue}{\frac{\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n} + \left(\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} - 0.5 \cdot \frac{1}{n}\right)}{x} + \left(\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \cdot \left(\left(0.041666666666666664 \cdot \frac{1}{{n}^{4}} + 0.4583333333333333 \cdot \frac{1}{{n}^{2}}\right) - \left(0.25 \cdot \frac{1}{n} + 0.25 \cdot \frac{1}{{n}^{3}}\right)\right)}{{x}^{3}} + \frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \cdot \left(\left(0.16666666666666666 \cdot \frac{1}{{n}^{3}} + 0.3333333333333333 \cdot \frac{1}{n}\right) - 0.5 \cdot \frac{1}{{n}^{2}}\right)}{{x}^{2}}\right)\right)}{x}} \]
        4. Simplified68.6%

          \[\leadsto \color{blue}{\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n} + {x}^{\left(\frac{1}{n}\right)} \cdot \left(\frac{\frac{0.5}{{n}^{2}} + \frac{-0.5}{n}}{x} + \left(\frac{\frac{0.16666666666666666}{{n}^{3}} + \left(\frac{0.3333333333333333}{n} - \frac{0.5}{{n}^{2}}\right)}{{x}^{2}} + \frac{\frac{0.041666666666666664}{{n}^{4}} + \left(\frac{0.4583333333333333}{{n}^{2}} + \left(\frac{-0.25}{n} - \frac{0.25}{{n}^{3}}\right)\right)}{{x}^{3}}\right)\right)}{x}} \]
        5. Taylor expanded in n around inf 68.6%

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n} + \color{blue}{\frac{\frac{0.3333333333333333}{{x}^{2}} - \left(\frac{0.5}{x} + \frac{0.25}{{x}^{3}}\right)}{n}}}{x} \]
      3. Recombined 3 regimes into one program.
      4. Add Preprocessing

      Alternative 6: 85.5% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\ \mathbf{if}\;n \leq -48000000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;n \leq 920:\\ \;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;n \leq 7 \cdot 10^{+61}:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (x n)
       :precision binary64
       (let* ((t_0 (/ (- (log1p x) (log x)) n)))
         (if (<= n -48000000000.0)
           t_0
           (if (<= n 920.0)
             (- (exp (/ (log1p x) n)) (pow x (/ 1.0 n)))
             (if (<= n 7e+61) (/ (exp (/ (log x) n)) (* x n)) t_0)))))
      double code(double x, double n) {
      	double t_0 = (log1p(x) - log(x)) / n;
      	double tmp;
      	if (n <= -48000000000.0) {
      		tmp = t_0;
      	} else if (n <= 920.0) {
      		tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
      	} else if (n <= 7e+61) {
      		tmp = exp((log(x) / n)) / (x * n);
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      public static double code(double x, double n) {
      	double t_0 = (Math.log1p(x) - Math.log(x)) / n;
      	double tmp;
      	if (n <= -48000000000.0) {
      		tmp = t_0;
      	} else if (n <= 920.0) {
      		tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
      	} else if (n <= 7e+61) {
      		tmp = Math.exp((Math.log(x) / n)) / (x * n);
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      def code(x, n):
      	t_0 = (math.log1p(x) - math.log(x)) / n
      	tmp = 0
      	if n <= -48000000000.0:
      		tmp = t_0
      	elif n <= 920.0:
      		tmp = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n))
      	elif n <= 7e+61:
      		tmp = math.exp((math.log(x) / n)) / (x * n)
      	else:
      		tmp = t_0
      	return tmp
      
      function code(x, n)
      	t_0 = Float64(Float64(log1p(x) - log(x)) / n)
      	tmp = 0.0
      	if (n <= -48000000000.0)
      		tmp = t_0;
      	elseif (n <= 920.0)
      		tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n)));
      	elseif (n <= 7e+61)
      		tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n));
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[x_, n_] := Block[{t$95$0 = N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[n, -48000000000.0], t$95$0, If[LessEqual[n, 920.0], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7e+61], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
      \mathbf{if}\;n \leq -48000000000:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;n \leq 920:\\
      \;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
      
      \mathbf{elif}\;n \leq 7 \cdot 10^{+61}:\\
      \;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if n < -4.8e10 or 7.00000000000000036e61 < n

        1. Initial program 36.9%

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

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

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

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

        if -4.8e10 < n < 920

        1. Initial program 81.0%

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

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

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

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

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

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

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

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

        if 920 < n < 7.00000000000000036e61

        1. Initial program 9.3%

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
      3. Recombined 3 regimes into one program.
      4. Add Preprocessing

      Alternative 7: 81.5% accurate, 0.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{\frac{t\_0}{n}}{x}\\ \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-89}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{1}{n} \leq 1.2 \cdot 10^{-62}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-51}:\\ \;\;\;\;\frac{1 - \frac{0.5}{x}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-31}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{-5}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + x \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right)\right) - t\_0\\ \end{array} \end{array} \]
      (FPCore (x n)
       :precision binary64
       (let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (/ t_0 n) x)))
         (if (<= (/ 1.0 n) -1e-89)
           t_1
           (if (<= (/ 1.0 n) 1.2e-62)
             (/ (- (log1p x) (log x)) n)
             (if (<= (/ 1.0 n) 4e-51)
               (/ (- 1.0 (/ 0.5 x)) (* x n))
               (if (<= (/ 1.0 n) 2e-31)
                 (/ (log x) (- n))
                 (if (<= (/ 1.0 n) 1e-5)
                   t_1
                   (-
                    (+
                     1.0
                     (*
                      x
                      (+
                       (/ 1.0 n)
                       (* x (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n)))))))
                    t_0))))))))
      double code(double x, double n) {
      	double t_0 = pow(x, (1.0 / n));
      	double t_1 = (t_0 / n) / x;
      	double tmp;
      	if ((1.0 / n) <= -1e-89) {
      		tmp = t_1;
      	} else if ((1.0 / n) <= 1.2e-62) {
      		tmp = (log1p(x) - log(x)) / n;
      	} else if ((1.0 / n) <= 4e-51) {
      		tmp = (1.0 - (0.5 / x)) / (x * n);
      	} else if ((1.0 / n) <= 2e-31) {
      		tmp = log(x) / -n;
      	} else if ((1.0 / n) <= 1e-5) {
      		tmp = t_1;
      	} else {
      		tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / n))))))) - t_0;
      	}
      	return tmp;
      }
      
      public static double code(double x, double n) {
      	double t_0 = Math.pow(x, (1.0 / n));
      	double t_1 = (t_0 / n) / x;
      	double tmp;
      	if ((1.0 / n) <= -1e-89) {
      		tmp = t_1;
      	} else if ((1.0 / n) <= 1.2e-62) {
      		tmp = (Math.log1p(x) - Math.log(x)) / n;
      	} else if ((1.0 / n) <= 4e-51) {
      		tmp = (1.0 - (0.5 / x)) / (x * n);
      	} else if ((1.0 / n) <= 2e-31) {
      		tmp = Math.log(x) / -n;
      	} else if ((1.0 / n) <= 1e-5) {
      		tmp = t_1;
      	} else {
      		tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / Math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))))) - t_0;
      	}
      	return tmp;
      }
      
      def code(x, n):
      	t_0 = math.pow(x, (1.0 / n))
      	t_1 = (t_0 / n) / x
      	tmp = 0
      	if (1.0 / n) <= -1e-89:
      		tmp = t_1
      	elif (1.0 / n) <= 1.2e-62:
      		tmp = (math.log1p(x) - math.log(x)) / n
      	elif (1.0 / n) <= 4e-51:
      		tmp = (1.0 - (0.5 / x)) / (x * n)
      	elif (1.0 / n) <= 2e-31:
      		tmp = math.log(x) / -n
      	elif (1.0 / n) <= 1e-5:
      		tmp = t_1
      	else:
      		tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))))) - t_0
      	return tmp
      
      function code(x, n)
      	t_0 = x ^ Float64(1.0 / n)
      	t_1 = Float64(Float64(t_0 / n) / x)
      	tmp = 0.0
      	if (Float64(1.0 / n) <= -1e-89)
      		tmp = t_1;
      	elseif (Float64(1.0 / n) <= 1.2e-62)
      		tmp = Float64(Float64(log1p(x) - log(x)) / n);
      	elseif (Float64(1.0 / n) <= 4e-51)
      		tmp = Float64(Float64(1.0 - Float64(0.5 / x)) / Float64(x * n));
      	elseif (Float64(1.0 / n) <= 2e-31)
      		tmp = Float64(log(x) / Float64(-n));
      	elseif (Float64(1.0 / n) <= 1e-5)
      		tmp = t_1;
      	else
      		tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(x * Float64(Float64(0.5 * Float64(1.0 / (n ^ 2.0))) + Float64(0.5 * Float64(-1.0 / n))))))) - 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[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-89], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1.2e-62], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-51], N[(N[(1.0 - N[(0.5 / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-31], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-5], t$95$1, N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(x * N[(N[(0.5 * N[(1.0 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := {x}^{\left(\frac{1}{n}\right)}\\
      t_1 := \frac{\frac{t\_0}{n}}{x}\\
      \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-89}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;\frac{1}{n} \leq 1.2 \cdot 10^{-62}:\\
      \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
      
      \mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-51}:\\
      \;\;\;\;\frac{1 - \frac{0.5}{x}}{x \cdot n}\\
      
      \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-31}:\\
      \;\;\;\;\frac{\log x}{-n}\\
      
      \mathbf{elif}\;\frac{1}{n} \leq 10^{-5}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + x \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right)\right) - t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 5 regimes
      2. if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000004e-89 or 2e-31 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000008e-5

        1. Initial program 76.4%

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\frac{e^{\frac{\color{blue}{\log x}}{n}}}{n}}{x} \]
          8. *-rgt-identity89.6%

            \[\leadsto \frac{\frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n}}{x} \]
          9. associate-/l*89.6%

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

            \[\leadsto \frac{\frac{\color{blue}{{x}^{\left(\frac{1}{n}\right)}}}{n}}{x} \]
        5. Simplified89.6%

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

        if -1.00000000000000004e-89 < (/.f64 #s(literal 1 binary64) n) < 1.19999999999999992e-62

        1. Initial program 39.5%

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

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

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

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

        if 1.19999999999999992e-62 < (/.f64 #s(literal 1 binary64) n) < 4e-51

        1. Initial program 5.4%

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

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

            \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\frac{0.5}{{n}^{2}} + \frac{-0.5}{n}}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}} \]
          2. Taylor expanded in n around inf 99.8%

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

              \[\leadsto \frac{1 - \color{blue}{\frac{0.5 \cdot 1}{x}}}{n \cdot x} \]
            2. metadata-eval99.8%

              \[\leadsto \frac{1 - \frac{\color{blue}{0.5}}{x}}{n \cdot x} \]
            3. *-commutative99.8%

              \[\leadsto \frac{1 - \frac{0.5}{x}}{\color{blue}{x \cdot n}} \]
          4. Simplified99.8%

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

          if 4e-51 < (/.f64 #s(literal 1 binary64) n) < 2e-31

          1. Initial program 3.4%

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

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

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

              \[\leadsto 1 - e^{\color{blue}{\frac{\log x \cdot 1}{n}}} \]
            3. associate-/l*3.4%

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

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

            \[\leadsto \color{blue}{1 - {x}^{\left(\frac{1}{n}\right)}} \]
          6. Taylor expanded in n around inf 99.6%

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

              \[\leadsto \color{blue}{\frac{-1 \cdot \log x}{n}} \]
            2. neg-mul-199.6%

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

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

          if 1.00000000000000008e-5 < (/.f64 #s(literal 1 binary64) n)

          1. Initial program 53.9%

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-89}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\ \mathbf{elif}\;\frac{1}{n} \leq 1.2 \cdot 10^{-62}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-51}:\\ \;\;\;\;\frac{1 - \frac{0.5}{x}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-31}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{-5}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + x \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right)\right) - {x}^{\left(\frac{1}{n}\right)}\\ \end{array} \]
        7. Add Preprocessing

        Alternative 8: 81.4% accurate, 0.9× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{\frac{t\_0}{n}}{x}\\ \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-89}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{1}{n} \leq 1.2 \cdot 10^{-62}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-51}:\\ \;\;\;\;\frac{1 - \frac{0.5}{x}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-31}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{-5}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{+133}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{x}}{n}\right)\right)\\ \end{array} \end{array} \]
        (FPCore (x n)
         :precision binary64
         (let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (/ t_0 n) x)))
           (if (<= (/ 1.0 n) -1e-89)
             t_1
             (if (<= (/ 1.0 n) 1.2e-62)
               (/ (- (log1p x) (log x)) n)
               (if (<= (/ 1.0 n) 4e-51)
                 (/ (- 1.0 (/ 0.5 x)) (* x n))
                 (if (<= (/ 1.0 n) 2e-31)
                   (/ (log x) (- n))
                   (if (<= (/ 1.0 n) 1e-5)
                     t_1
                     (if (<= (/ 1.0 n) 1e+133)
                       (- (+ 1.0 (/ x n)) t_0)
                       (log1p (expm1 (/ (/ 1.0 x) n)))))))))))
        double code(double x, double n) {
        	double t_0 = pow(x, (1.0 / n));
        	double t_1 = (t_0 / n) / x;
        	double tmp;
        	if ((1.0 / n) <= -1e-89) {
        		tmp = t_1;
        	} else if ((1.0 / n) <= 1.2e-62) {
        		tmp = (log1p(x) - log(x)) / n;
        	} else if ((1.0 / n) <= 4e-51) {
        		tmp = (1.0 - (0.5 / x)) / (x * n);
        	} else if ((1.0 / n) <= 2e-31) {
        		tmp = log(x) / -n;
        	} else if ((1.0 / n) <= 1e-5) {
        		tmp = t_1;
        	} else if ((1.0 / n) <= 1e+133) {
        		tmp = (1.0 + (x / n)) - t_0;
        	} else {
        		tmp = log1p(expm1(((1.0 / x) / n)));
        	}
        	return tmp;
        }
        
        public static double code(double x, double n) {
        	double t_0 = Math.pow(x, (1.0 / n));
        	double t_1 = (t_0 / n) / x;
        	double tmp;
        	if ((1.0 / n) <= -1e-89) {
        		tmp = t_1;
        	} else if ((1.0 / n) <= 1.2e-62) {
        		tmp = (Math.log1p(x) - Math.log(x)) / n;
        	} else if ((1.0 / n) <= 4e-51) {
        		tmp = (1.0 - (0.5 / x)) / (x * n);
        	} else if ((1.0 / n) <= 2e-31) {
        		tmp = Math.log(x) / -n;
        	} else if ((1.0 / n) <= 1e-5) {
        		tmp = t_1;
        	} else if ((1.0 / n) <= 1e+133) {
        		tmp = (1.0 + (x / n)) - t_0;
        	} else {
        		tmp = Math.log1p(Math.expm1(((1.0 / x) / n)));
        	}
        	return tmp;
        }
        
        def code(x, n):
        	t_0 = math.pow(x, (1.0 / n))
        	t_1 = (t_0 / n) / x
        	tmp = 0
        	if (1.0 / n) <= -1e-89:
        		tmp = t_1
        	elif (1.0 / n) <= 1.2e-62:
        		tmp = (math.log1p(x) - math.log(x)) / n
        	elif (1.0 / n) <= 4e-51:
        		tmp = (1.0 - (0.5 / x)) / (x * n)
        	elif (1.0 / n) <= 2e-31:
        		tmp = math.log(x) / -n
        	elif (1.0 / n) <= 1e-5:
        		tmp = t_1
        	elif (1.0 / n) <= 1e+133:
        		tmp = (1.0 + (x / n)) - t_0
        	else:
        		tmp = math.log1p(math.expm1(((1.0 / x) / n)))
        	return tmp
        
        function code(x, n)
        	t_0 = x ^ Float64(1.0 / n)
        	t_1 = Float64(Float64(t_0 / n) / x)
        	tmp = 0.0
        	if (Float64(1.0 / n) <= -1e-89)
        		tmp = t_1;
        	elseif (Float64(1.0 / n) <= 1.2e-62)
        		tmp = Float64(Float64(log1p(x) - log(x)) / n);
        	elseif (Float64(1.0 / n) <= 4e-51)
        		tmp = Float64(Float64(1.0 - Float64(0.5 / x)) / Float64(x * n));
        	elseif (Float64(1.0 / n) <= 2e-31)
        		tmp = Float64(log(x) / Float64(-n));
        	elseif (Float64(1.0 / n) <= 1e-5)
        		tmp = t_1;
        	elseif (Float64(1.0 / n) <= 1e+133)
        		tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0);
        	else
        		tmp = log1p(expm1(Float64(Float64(1.0 / x) / n)));
        	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[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-89], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1.2e-62], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-51], N[(N[(1.0 - N[(0.5 / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-31], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-5], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+133], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[Log[1 + N[(Exp[N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]]]]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := {x}^{\left(\frac{1}{n}\right)}\\
        t_1 := \frac{\frac{t\_0}{n}}{x}\\
        \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-89}:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;\frac{1}{n} \leq 1.2 \cdot 10^{-62}:\\
        \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
        
        \mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-51}:\\
        \;\;\;\;\frac{1 - \frac{0.5}{x}}{x \cdot n}\\
        
        \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-31}:\\
        \;\;\;\;\frac{\log x}{-n}\\
        
        \mathbf{elif}\;\frac{1}{n} \leq 10^{-5}:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;\frac{1}{n} \leq 10^{+133}:\\
        \;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{x}}{n}\right)\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 6 regimes
        2. if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000004e-89 or 2e-31 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000008e-5

          1. Initial program 76.4%

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

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

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

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

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

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

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

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

              \[\leadsto \frac{\frac{e^{\frac{\color{blue}{\log x}}{n}}}{n}}{x} \]
            8. *-rgt-identity89.6%

              \[\leadsto \frac{\frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n}}{x} \]
            9. associate-/l*89.6%

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

              \[\leadsto \frac{\frac{\color{blue}{{x}^{\left(\frac{1}{n}\right)}}}{n}}{x} \]
          5. Simplified89.6%

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

          if -1.00000000000000004e-89 < (/.f64 #s(literal 1 binary64) n) < 1.19999999999999992e-62

          1. Initial program 39.5%

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

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

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

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

          if 1.19999999999999992e-62 < (/.f64 #s(literal 1 binary64) n) < 4e-51

          1. Initial program 5.4%

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

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

              \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\frac{0.5}{{n}^{2}} + \frac{-0.5}{n}}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}} \]
            2. Taylor expanded in n around inf 99.8%

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

                \[\leadsto \frac{1 - \color{blue}{\frac{0.5 \cdot 1}{x}}}{n \cdot x} \]
              2. metadata-eval99.8%

                \[\leadsto \frac{1 - \frac{\color{blue}{0.5}}{x}}{n \cdot x} \]
              3. *-commutative99.8%

                \[\leadsto \frac{1 - \frac{0.5}{x}}{\color{blue}{x \cdot n}} \]
            4. Simplified99.8%

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

            if 4e-51 < (/.f64 #s(literal 1 binary64) n) < 2e-31

            1. Initial program 3.4%

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

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

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

                \[\leadsto 1 - e^{\color{blue}{\frac{\log x \cdot 1}{n}}} \]
              3. associate-/l*3.4%

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

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

              \[\leadsto \color{blue}{1 - {x}^{\left(\frac{1}{n}\right)}} \]
            6. Taylor expanded in n around inf 99.6%

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

                \[\leadsto \color{blue}{\frac{-1 \cdot \log x}{n}} \]
              2. neg-mul-199.6%

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

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

            if 1.00000000000000008e-5 < (/.f64 #s(literal 1 binary64) n) < 1e133

            1. Initial program 79.7%

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

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

            if 1e133 < (/.f64 #s(literal 1 binary64) n)

            1. Initial program 15.2%

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

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

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
            6. Taylor expanded in n around inf 64.8%

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

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

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

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

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

              \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{x}}{n}\right)\right)} \]
          5. Recombined 6 regimes into one program.
          6. Final simplification88.6%

            \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-89}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\ \mathbf{elif}\;\frac{1}{n} \leq 1.2 \cdot 10^{-62}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-51}:\\ \;\;\;\;\frac{1 - \frac{0.5}{x}}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-31}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{-5}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{+133}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{x}}{n}\right)\right)\\ \end{array} \]
          7. Add Preprocessing

          Alternative 9: 70.5% accurate, 0.9× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ t_1 := 1 - t\_0\\ t_2 := \frac{\log x}{-n}\\ \mathbf{if}\;x \leq 7.4 \cdot 10^{-286}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{-259}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{-241}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 3.15 \cdot 10^{-223}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 1.22 \cdot 10^{-195}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 1.18 \cdot 10^{-130}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 3.9:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{x}}{n}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t\_0}{n}}{x}\\ \end{array} \end{array} \]
          (FPCore (x n)
           :precision binary64
           (let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- 1.0 t_0)) (t_2 (/ (log x) (- n))))
             (if (<= x 7.4e-286)
               t_1
               (if (<= x 6.4e-259)
                 t_2
                 (if (<= x 8.2e-241)
                   t_1
                   (if (<= x 3.15e-223)
                     t_2
                     (if (<= x 1.22e-195)
                       t_1
                       (if (<= x 1.18e-130)
                         t_2
                         (if (<= x 3.9)
                           (log1p (expm1 (/ (/ 1.0 x) n)))
                           (/ (/ t_0 n) x))))))))))
          double code(double x, double n) {
          	double t_0 = pow(x, (1.0 / n));
          	double t_1 = 1.0 - t_0;
          	double t_2 = log(x) / -n;
          	double tmp;
          	if (x <= 7.4e-286) {
          		tmp = t_1;
          	} else if (x <= 6.4e-259) {
          		tmp = t_2;
          	} else if (x <= 8.2e-241) {
          		tmp = t_1;
          	} else if (x <= 3.15e-223) {
          		tmp = t_2;
          	} else if (x <= 1.22e-195) {
          		tmp = t_1;
          	} else if (x <= 1.18e-130) {
          		tmp = t_2;
          	} else if (x <= 3.9) {
          		tmp = log1p(expm1(((1.0 / x) / n)));
          	} else {
          		tmp = (t_0 / n) / x;
          	}
          	return tmp;
          }
          
          public static double code(double x, double n) {
          	double t_0 = Math.pow(x, (1.0 / n));
          	double t_1 = 1.0 - t_0;
          	double t_2 = Math.log(x) / -n;
          	double tmp;
          	if (x <= 7.4e-286) {
          		tmp = t_1;
          	} else if (x <= 6.4e-259) {
          		tmp = t_2;
          	} else if (x <= 8.2e-241) {
          		tmp = t_1;
          	} else if (x <= 3.15e-223) {
          		tmp = t_2;
          	} else if (x <= 1.22e-195) {
          		tmp = t_1;
          	} else if (x <= 1.18e-130) {
          		tmp = t_2;
          	} else if (x <= 3.9) {
          		tmp = Math.log1p(Math.expm1(((1.0 / x) / n)));
          	} else {
          		tmp = (t_0 / n) / x;
          	}
          	return tmp;
          }
          
          def code(x, n):
          	t_0 = math.pow(x, (1.0 / n))
          	t_1 = 1.0 - t_0
          	t_2 = math.log(x) / -n
          	tmp = 0
          	if x <= 7.4e-286:
          		tmp = t_1
          	elif x <= 6.4e-259:
          		tmp = t_2
          	elif x <= 8.2e-241:
          		tmp = t_1
          	elif x <= 3.15e-223:
          		tmp = t_2
          	elif x <= 1.22e-195:
          		tmp = t_1
          	elif x <= 1.18e-130:
          		tmp = t_2
          	elif x <= 3.9:
          		tmp = math.log1p(math.expm1(((1.0 / x) / n)))
          	else:
          		tmp = (t_0 / n) / x
          	return tmp
          
          function code(x, n)
          	t_0 = x ^ Float64(1.0 / n)
          	t_1 = Float64(1.0 - t_0)
          	t_2 = Float64(log(x) / Float64(-n))
          	tmp = 0.0
          	if (x <= 7.4e-286)
          		tmp = t_1;
          	elseif (x <= 6.4e-259)
          		tmp = t_2;
          	elseif (x <= 8.2e-241)
          		tmp = t_1;
          	elseif (x <= 3.15e-223)
          		tmp = t_2;
          	elseif (x <= 1.22e-195)
          		tmp = t_1;
          	elseif (x <= 1.18e-130)
          		tmp = t_2;
          	elseif (x <= 3.9)
          		tmp = log1p(expm1(Float64(Float64(1.0 / x) / n)));
          	else
          		tmp = Float64(Float64(t_0 / n) / x);
          	end
          	return tmp
          end
          
          code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 7.4e-286], t$95$1, If[LessEqual[x, 6.4e-259], t$95$2, If[LessEqual[x, 8.2e-241], t$95$1, If[LessEqual[x, 3.15e-223], t$95$2, If[LessEqual[x, 1.22e-195], t$95$1, If[LessEqual[x, 1.18e-130], t$95$2, If[LessEqual[x, 3.9], N[Log[1 + N[(Exp[N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]]]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := {x}^{\left(\frac{1}{n}\right)}\\
          t_1 := 1 - t\_0\\
          t_2 := \frac{\log x}{-n}\\
          \mathbf{if}\;x \leq 7.4 \cdot 10^{-286}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;x \leq 6.4 \cdot 10^{-259}:\\
          \;\;\;\;t\_2\\
          
          \mathbf{elif}\;x \leq 8.2 \cdot 10^{-241}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;x \leq 3.15 \cdot 10^{-223}:\\
          \;\;\;\;t\_2\\
          
          \mathbf{elif}\;x \leq 1.22 \cdot 10^{-195}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;x \leq 1.18 \cdot 10^{-130}:\\
          \;\;\;\;t\_2\\
          
          \mathbf{elif}\;x \leq 3.9:\\
          \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{x}}{n}\right)\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 4 regimes
          2. if x < 7.3999999999999998e-286 or 6.39999999999999975e-259 < x < 8.1999999999999997e-241 or 3.14999999999999993e-223 < x < 1.2200000000000001e-195

            1. Initial program 85.1%

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

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

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

                \[\leadsto 1 - e^{\color{blue}{\frac{\log x \cdot 1}{n}}} \]
              3. associate-/l*85.1%

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

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

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

            if 7.3999999999999998e-286 < x < 6.39999999999999975e-259 or 8.1999999999999997e-241 < x < 3.14999999999999993e-223 or 1.2200000000000001e-195 < x < 1.17999999999999993e-130

            1. Initial program 28.6%

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

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

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

                \[\leadsto 1 - e^{\color{blue}{\frac{\log x \cdot 1}{n}}} \]
              3. associate-/l*28.6%

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

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

              \[\leadsto \color{blue}{1 - {x}^{\left(\frac{1}{n}\right)}} \]
            6. Taylor expanded in n around inf 67.1%

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

                \[\leadsto \color{blue}{\frac{-1 \cdot \log x}{n}} \]
              2. neg-mul-167.1%

                \[\leadsto \frac{\color{blue}{-\log x}}{n} \]
            8. Simplified67.1%

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

            if 1.17999999999999993e-130 < x < 3.89999999999999991

            1. Initial program 36.5%

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

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

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
            6. Taylor expanded in n around inf 21.1%

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

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

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

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

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

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

            if 3.89999999999999991 < x

            1. Initial program 68.2%

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

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

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

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

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

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

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

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

                \[\leadsto \frac{\frac{e^{\frac{\color{blue}{\log x}}{n}}}{n}}{x} \]
              8. *-rgt-identity98.6%

                \[\leadsto \frac{\frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n}}{x} \]
              9. associate-/l*98.6%

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

                \[\leadsto \frac{\frac{\color{blue}{{x}^{\left(\frac{1}{n}\right)}}}{n}}{x} \]
            5. Simplified98.6%

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 7.4 \cdot 10^{-286}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{-259}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{-241}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 3.15 \cdot 10^{-223}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.22 \cdot 10^{-195}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 1.18 \cdot 10^{-130}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 3.9:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{x}}{n}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 10: 71.2% accurate, 1.5× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ t_1 := 1 - t\_0\\ t_2 := \frac{\log x}{-n}\\ \mathbf{if}\;x \leq 2.55 \cdot 10^{-289}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{-259}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-242}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{-223}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{-195}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 0.175:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t\_0}{n}}{x}\\ \end{array} \end{array} \]
          (FPCore (x n)
           :precision binary64
           (let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- 1.0 t_0)) (t_2 (/ (log x) (- n))))
             (if (<= x 2.55e-289)
               t_1
               (if (<= x 6.4e-259)
                 t_2
                 (if (<= x 2.6e-242)
                   t_1
                   (if (<= x 4.5e-223)
                     t_2
                     (if (<= x 1.3e-195) t_1 (if (<= x 0.175) t_2 (/ (/ t_0 n) x)))))))))
          double code(double x, double n) {
          	double t_0 = pow(x, (1.0 / n));
          	double t_1 = 1.0 - t_0;
          	double t_2 = log(x) / -n;
          	double tmp;
          	if (x <= 2.55e-289) {
          		tmp = t_1;
          	} else if (x <= 6.4e-259) {
          		tmp = t_2;
          	} else if (x <= 2.6e-242) {
          		tmp = t_1;
          	} else if (x <= 4.5e-223) {
          		tmp = t_2;
          	} else if (x <= 1.3e-195) {
          		tmp = t_1;
          	} else if (x <= 0.175) {
          		tmp = t_2;
          	} 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) :: t_1
              real(8) :: t_2
              real(8) :: tmp
              t_0 = x ** (1.0d0 / n)
              t_1 = 1.0d0 - t_0
              t_2 = log(x) / -n
              if (x <= 2.55d-289) then
                  tmp = t_1
              else if (x <= 6.4d-259) then
                  tmp = t_2
              else if (x <= 2.6d-242) then
                  tmp = t_1
              else if (x <= 4.5d-223) then
                  tmp = t_2
              else if (x <= 1.3d-195) then
                  tmp = t_1
              else if (x <= 0.175d0) then
                  tmp = t_2
              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 t_1 = 1.0 - t_0;
          	double t_2 = Math.log(x) / -n;
          	double tmp;
          	if (x <= 2.55e-289) {
          		tmp = t_1;
          	} else if (x <= 6.4e-259) {
          		tmp = t_2;
          	} else if (x <= 2.6e-242) {
          		tmp = t_1;
          	} else if (x <= 4.5e-223) {
          		tmp = t_2;
          	} else if (x <= 1.3e-195) {
          		tmp = t_1;
          	} else if (x <= 0.175) {
          		tmp = t_2;
          	} else {
          		tmp = (t_0 / n) / x;
          	}
          	return tmp;
          }
          
          def code(x, n):
          	t_0 = math.pow(x, (1.0 / n))
          	t_1 = 1.0 - t_0
          	t_2 = math.log(x) / -n
          	tmp = 0
          	if x <= 2.55e-289:
          		tmp = t_1
          	elif x <= 6.4e-259:
          		tmp = t_2
          	elif x <= 2.6e-242:
          		tmp = t_1
          	elif x <= 4.5e-223:
          		tmp = t_2
          	elif x <= 1.3e-195:
          		tmp = t_1
          	elif x <= 0.175:
          		tmp = t_2
          	else:
          		tmp = (t_0 / n) / x
          	return tmp
          
          function code(x, n)
          	t_0 = x ^ Float64(1.0 / n)
          	t_1 = Float64(1.0 - t_0)
          	t_2 = Float64(log(x) / Float64(-n))
          	tmp = 0.0
          	if (x <= 2.55e-289)
          		tmp = t_1;
          	elseif (x <= 6.4e-259)
          		tmp = t_2;
          	elseif (x <= 2.6e-242)
          		tmp = t_1;
          	elseif (x <= 4.5e-223)
          		tmp = t_2;
          	elseif (x <= 1.3e-195)
          		tmp = t_1;
          	elseif (x <= 0.175)
          		tmp = t_2;
          	else
          		tmp = Float64(Float64(t_0 / n) / x);
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, n)
          	t_0 = x ^ (1.0 / n);
          	t_1 = 1.0 - t_0;
          	t_2 = log(x) / -n;
          	tmp = 0.0;
          	if (x <= 2.55e-289)
          		tmp = t_1;
          	elseif (x <= 6.4e-259)
          		tmp = t_2;
          	elseif (x <= 2.6e-242)
          		tmp = t_1;
          	elseif (x <= 4.5e-223)
          		tmp = t_2;
          	elseif (x <= 1.3e-195)
          		tmp = t_1;
          	elseif (x <= 0.175)
          		tmp = t_2;
          	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]}, Block[{t$95$1 = N[(1.0 - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 2.55e-289], t$95$1, If[LessEqual[x, 6.4e-259], t$95$2, If[LessEqual[x, 2.6e-242], t$95$1, If[LessEqual[x, 4.5e-223], t$95$2, If[LessEqual[x, 1.3e-195], t$95$1, If[LessEqual[x, 0.175], t$95$2, N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := {x}^{\left(\frac{1}{n}\right)}\\
          t_1 := 1 - t\_0\\
          t_2 := \frac{\log x}{-n}\\
          \mathbf{if}\;x \leq 2.55 \cdot 10^{-289}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;x \leq 6.4 \cdot 10^{-259}:\\
          \;\;\;\;t\_2\\
          
          \mathbf{elif}\;x \leq 2.6 \cdot 10^{-242}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;x \leq 4.5 \cdot 10^{-223}:\\
          \;\;\;\;t\_2\\
          
          \mathbf{elif}\;x \leq 1.3 \cdot 10^{-195}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;x \leq 0.175:\\
          \;\;\;\;t\_2\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if x < 2.5499999999999998e-289 or 6.39999999999999975e-259 < x < 2.60000000000000017e-242 or 4.49999999999999968e-223 < x < 1.3000000000000001e-195

            1. Initial program 85.1%

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

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

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

                \[\leadsto 1 - e^{\color{blue}{\frac{\log x \cdot 1}{n}}} \]
              3. associate-/l*85.1%

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

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

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

            if 2.5499999999999998e-289 < x < 6.39999999999999975e-259 or 2.60000000000000017e-242 < x < 4.49999999999999968e-223 or 1.3000000000000001e-195 < x < 0.17499999999999999

            1. Initial program 32.9%

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

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

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

                \[\leadsto 1 - e^{\color{blue}{\frac{\log x \cdot 1}{n}}} \]
              3. associate-/l*32.9%

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

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

              \[\leadsto \color{blue}{1 - {x}^{\left(\frac{1}{n}\right)}} \]
            6. Taylor expanded in n around inf 56.7%

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

                \[\leadsto \color{blue}{\frac{-1 \cdot \log x}{n}} \]
              2. neg-mul-156.7%

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

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

            if 0.17499999999999999 < x

            1. Initial program 67.7%

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

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

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

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

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

                \[\leadsto \frac{\frac{e^{-\frac{\color{blue}{-1 \cdot \log x}}{n}}}{n}}{x} \]
              5. distribute-neg-frac97.9%

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

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

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

                \[\leadsto \frac{\frac{e^{\frac{\color{blue}{\log x \cdot 1}}{n}}}{n}}{x} \]
              9. associate-/l*97.9%

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

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.55 \cdot 10^{-289}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{-259}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-242}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{-223}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{-195}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.175:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 11: 56.5% accurate, 1.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{\log x}{-n}\\ \mathbf{if}\;x \leq 6.2 \cdot 10^{-289}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{-259}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-242}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 2.2 \cdot 10^{-223}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{-195}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 0.68:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 - \frac{0.5}{x}}{n}}{x}\\ \end{array} \end{array} \]
          (FPCore (x n)
           :precision binary64
           (let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (log x) (- n))))
             (if (<= x 6.2e-289)
               t_0
               (if (<= x 6.4e-259)
                 t_1
                 (if (<= x 3.2e-242)
                   t_0
                   (if (<= x 2.2e-223)
                     t_1
                     (if (<= x 1.25e-195)
                       t_0
                       (if (<= x 0.68) t_1 (/ (/ (- 1.0 (/ 0.5 x)) n) x)))))))))
          double code(double x, double n) {
          	double t_0 = 1.0 - pow(x, (1.0 / n));
          	double t_1 = log(x) / -n;
          	double tmp;
          	if (x <= 6.2e-289) {
          		tmp = t_0;
          	} else if (x <= 6.4e-259) {
          		tmp = t_1;
          	} else if (x <= 3.2e-242) {
          		tmp = t_0;
          	} else if (x <= 2.2e-223) {
          		tmp = t_1;
          	} else if (x <= 1.25e-195) {
          		tmp = t_0;
          	} else if (x <= 0.68) {
          		tmp = t_1;
          	} else {
          		tmp = ((1.0 - (0.5 / x)) / 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 ** (1.0d0 / n))
              t_1 = log(x) / -n
              if (x <= 6.2d-289) then
                  tmp = t_0
              else if (x <= 6.4d-259) then
                  tmp = t_1
              else if (x <= 3.2d-242) then
                  tmp = t_0
              else if (x <= 2.2d-223) then
                  tmp = t_1
              else if (x <= 1.25d-195) then
                  tmp = t_0
              else if (x <= 0.68d0) then
                  tmp = t_1
              else
                  tmp = ((1.0d0 - (0.5d0 / x)) / n) / x
              end if
              code = tmp
          end function
          
          public static double code(double x, double n) {
          	double t_0 = 1.0 - Math.pow(x, (1.0 / n));
          	double t_1 = Math.log(x) / -n;
          	double tmp;
          	if (x <= 6.2e-289) {
          		tmp = t_0;
          	} else if (x <= 6.4e-259) {
          		tmp = t_1;
          	} else if (x <= 3.2e-242) {
          		tmp = t_0;
          	} else if (x <= 2.2e-223) {
          		tmp = t_1;
          	} else if (x <= 1.25e-195) {
          		tmp = t_0;
          	} else if (x <= 0.68) {
          		tmp = t_1;
          	} else {
          		tmp = ((1.0 - (0.5 / x)) / n) / x;
          	}
          	return tmp;
          }
          
          def code(x, n):
          	t_0 = 1.0 - math.pow(x, (1.0 / n))
          	t_1 = math.log(x) / -n
          	tmp = 0
          	if x <= 6.2e-289:
          		tmp = t_0
          	elif x <= 6.4e-259:
          		tmp = t_1
          	elif x <= 3.2e-242:
          		tmp = t_0
          	elif x <= 2.2e-223:
          		tmp = t_1
          	elif x <= 1.25e-195:
          		tmp = t_0
          	elif x <= 0.68:
          		tmp = t_1
          	else:
          		tmp = ((1.0 - (0.5 / x)) / n) / x
          	return tmp
          
          function code(x, n)
          	t_0 = Float64(1.0 - (x ^ Float64(1.0 / n)))
          	t_1 = Float64(log(x) / Float64(-n))
          	tmp = 0.0
          	if (x <= 6.2e-289)
          		tmp = t_0;
          	elseif (x <= 6.4e-259)
          		tmp = t_1;
          	elseif (x <= 3.2e-242)
          		tmp = t_0;
          	elseif (x <= 2.2e-223)
          		tmp = t_1;
          	elseif (x <= 1.25e-195)
          		tmp = t_0;
          	elseif (x <= 0.68)
          		tmp = t_1;
          	else
          		tmp = Float64(Float64(Float64(1.0 - Float64(0.5 / x)) / n) / x);
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, n)
          	t_0 = 1.0 - (x ^ (1.0 / n));
          	t_1 = log(x) / -n;
          	tmp = 0.0;
          	if (x <= 6.2e-289)
          		tmp = t_0;
          	elseif (x <= 6.4e-259)
          		tmp = t_1;
          	elseif (x <= 3.2e-242)
          		tmp = t_0;
          	elseif (x <= 2.2e-223)
          		tmp = t_1;
          	elseif (x <= 1.25e-195)
          		tmp = t_0;
          	elseif (x <= 0.68)
          		tmp = t_1;
          	else
          		tmp = ((1.0 - (0.5 / x)) / n) / x;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 6.2e-289], t$95$0, If[LessEqual[x, 6.4e-259], t$95$1, If[LessEqual[x, 3.2e-242], t$95$0, If[LessEqual[x, 2.2e-223], t$95$1, If[LessEqual[x, 1.25e-195], t$95$0, If[LessEqual[x, 0.68], t$95$1, N[(N[(N[(1.0 - N[(0.5 / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]]]]]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
          t_1 := \frac{\log x}{-n}\\
          \mathbf{if}\;x \leq 6.2 \cdot 10^{-289}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;x \leq 6.4 \cdot 10^{-259}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;x \leq 3.2 \cdot 10^{-242}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;x \leq 2.2 \cdot 10^{-223}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;x \leq 1.25 \cdot 10^{-195}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;x \leq 0.68:\\
          \;\;\;\;t\_1\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\frac{1 - \frac{0.5}{x}}{n}}{x}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if x < 6.2e-289 or 6.39999999999999975e-259 < x < 3.19999999999999999e-242 or 2.20000000000000009e-223 < x < 1.25000000000000002e-195

            1. Initial program 85.1%

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

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

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

                \[\leadsto 1 - e^{\color{blue}{\frac{\log x \cdot 1}{n}}} \]
              3. associate-/l*85.1%

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

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

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

            if 6.2e-289 < x < 6.39999999999999975e-259 or 3.19999999999999999e-242 < x < 2.20000000000000009e-223 or 1.25000000000000002e-195 < x < 0.680000000000000049

            1. Initial program 32.9%

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

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

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

                \[\leadsto 1 - e^{\color{blue}{\frac{\log x \cdot 1}{n}}} \]
              3. associate-/l*32.9%

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

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

              \[\leadsto \color{blue}{1 - {x}^{\left(\frac{1}{n}\right)}} \]
            6. Taylor expanded in n around inf 56.7%

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

                \[\leadsto \color{blue}{\frac{-1 \cdot \log x}{n}} \]
              2. neg-mul-156.7%

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

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

            if 0.680000000000000049 < x

            1. Initial program 67.7%

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

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

                \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\frac{0.5}{{n}^{2}} + \frac{-0.5}{n}}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}} \]
              2. Taylor expanded in n around inf 70.2%

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

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

                  \[\leadsto \frac{\frac{1 - \frac{\color{blue}{0.5}}{x}}{n}}{x} \]
              4. Simplified70.2%

                \[\leadsto \frac{\color{blue}{\frac{1 - \frac{0.5}{x}}{n}}}{x} \]
            5. Recombined 3 regimes into one program.
            6. Final simplification65.7%

              \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 6.2 \cdot 10^{-289}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{-259}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-242}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 2.2 \cdot 10^{-223}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{-195}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.68:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 - \frac{0.5}{x}}{n}}{x}\\ \end{array} \]
            7. Add Preprocessing

            Alternative 12: 56.7% accurate, 1.9× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.68:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 - \frac{0.5}{x}}{n}}{x}\\ \end{array} \end{array} \]
            (FPCore (x n)
             :precision binary64
             (if (<= x 0.68) (/ (log x) (- n)) (/ (/ (- 1.0 (/ 0.5 x)) n) x)))
            double code(double x, double n) {
            	double tmp;
            	if (x <= 0.68) {
            		tmp = log(x) / -n;
            	} else {
            		tmp = ((1.0 - (0.5 / x)) / n) / x;
            	}
            	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 - (0.5d0 / x)) / n) / x
                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 - (0.5 / x)) / n) / x;
            	}
            	return tmp;
            }
            
            def code(x, n):
            	tmp = 0
            	if x <= 0.68:
            		tmp = math.log(x) / -n
            	else:
            		tmp = ((1.0 - (0.5 / x)) / n) / x
            	return tmp
            
            function code(x, n)
            	tmp = 0.0
            	if (x <= 0.68)
            		tmp = Float64(log(x) / Float64(-n));
            	else
            		tmp = Float64(Float64(Float64(1.0 - Float64(0.5 / x)) / n) / x);
            	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 - (0.5 / x)) / n) / x;
            	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 - N[(0.5 / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;x \leq 0.68:\\
            \;\;\;\;\frac{\log x}{-n}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{\frac{1 - \frac{0.5}{x}}{n}}{x}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if x < 0.680000000000000049

              1. Initial program 43.0%

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

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

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

                  \[\leadsto 1 - e^{\color{blue}{\frac{\log x \cdot 1}{n}}} \]
                3. associate-/l*43.0%

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

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

                \[\leadsto \color{blue}{1 - {x}^{\left(\frac{1}{n}\right)}} \]
              6. Taylor expanded in n around inf 50.1%

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

                  \[\leadsto \color{blue}{\frac{-1 \cdot \log x}{n}} \]
                2. neg-mul-150.1%

                  \[\leadsto \frac{\color{blue}{-\log x}}{n} \]
              8. Simplified50.1%

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

              if 0.680000000000000049 < x

              1. Initial program 67.7%

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

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

                  \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\frac{0.5}{{n}^{2}} + \frac{-0.5}{n}}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}} \]
                2. Taylor expanded in n around inf 70.2%

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

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

                    \[\leadsto \frac{\frac{1 - \frac{\color{blue}{0.5}}{x}}{n}}{x} \]
                4. Simplified70.2%

                  \[\leadsto \frac{\color{blue}{\frac{1 - \frac{0.5}{x}}{n}}}{x} \]
              5. Recombined 2 regimes into one program.
              6. Final simplification58.9%

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

              Alternative 13: 39.7% 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. Add Preprocessing
              3. Taylor expanded in x around inf 57.8%

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
              6. Taylor expanded in n around inf 42.8%

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

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

                  \[\leadsto \color{blue}{\frac{\frac{1}{x}}{n}} \]
              8. Simplified43.2%

                \[\leadsto \color{blue}{\frac{\frac{1}{x}}{n}} \]
              9. Add Preprocessing

              Alternative 14: 39.2% accurate, 42.2× speedup?

              \[\begin{array}{l} \\ \frac{1}{x \cdot 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(1.0 / Float64(x * n))
              end
              
              function tmp = code(x, n)
              	tmp = 1.0 / (x * n);
              end
              
              code[x_, n_] := N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]
              
              \begin{array}{l}
              
              \\
              \frac{1}{x \cdot 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. Add Preprocessing
              3. Taylor expanded in x around inf 57.8%

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
              6. Taylor expanded in n around inf 42.8%

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

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

                \[\leadsto \color{blue}{\frac{1}{x \cdot n}} \]
              9. Add Preprocessing

              Reproduce

              ?
              herbie shell --seed 2024108 
              (FPCore (x n)
                :name "2nthrt (problem 3.4.6)"
                :precision binary64
                (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))