2nthrt (problem 3.4.6)

Percentage Accurate: 53.3% → 91.9%
Time: 1.0min
Alternatives: 21
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 21 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.3% 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: 91.9% accurate, 0.2× speedup?

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

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

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


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

    1. Initial program 48.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around -inf 79.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. Simplified79.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-log-exp87.0%

        \[\leadsto \frac{\log x - \color{blue}{\log \left(e^{\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} \]
      2. diff-log87.1%

        \[\leadsto \frac{\color{blue}{\log \left(\frac{x}{e^{\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} \]
    6. Applied egg-rr87.1%

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

    if 5.5e5 < x

    1. Initial program 66.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.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 88.6% 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(0.16666666666666666, \frac{{\left(-\log x\right)}^{3}}{n}, \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) \cdot 0.5\right)}{n}\right)}^{3}}}{-n}\\ \mathbf{if}\;x \leq 8.2 \cdot 10^{-203}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-189}:\\ \;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\ \mathbf{elif}\;x \leq 440000:\\ \;\;\;\;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
               0.16666666666666666
               (/ (pow (- (log x)) 3.0) n)
               (* (- (pow (log1p x) 2.0) (pow (log x) 2.0)) 0.5))
              n))
            3.0))
          (- n))))
   (if (<= x 8.2e-203)
     t_1
     (if (<= x 3e-189)
       (- (exp (/ (log1p x) n)) t_0)
       (if (<= x 440000.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(0.16666666666666666, (pow(-log(x), 3.0) / n), ((pow(log1p(x), 2.0) - pow(log(x), 2.0)) * 0.5)) / n)), 3.0)) / -n;
	double tmp;
	if (x <= 8.2e-203) {
		tmp = t_1;
	} else if (x <= 3e-189) {
		tmp = exp((log1p(x) / n)) - t_0;
	} else if (x <= 440000.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(0.16666666666666666, Float64((Float64(-log(x)) ^ 3.0) / n), Float64(Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)) * 0.5)) / n)) ^ 3.0)) / Float64(-n))
	tmp = 0.0
	if (x <= 8.2e-203)
		tmp = t_1;
	elseif (x <= 3e-189)
		tmp = Float64(exp(Float64(log1p(x) / n)) - t_0);
	elseif (x <= 440000.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[(0.16666666666666666 * N[(N[Power[(-N[Log[x], $MachinePrecision]), 3.0], $MachinePrecision] / n), $MachinePrecision] + N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 1/3], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 8.2e-203], t$95$1, If[LessEqual[x, 3e-189], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 440000.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(0.16666666666666666, \frac{{\left(-\log x\right)}^{3}}{n}, \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) \cdot 0.5\right)}{n}\right)}^{3}}}{-n}\\
\mathbf{if}\;x \leq 8.2 \cdot 10^{-203}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 3 \cdot 10^{-189}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 8.19999999999999962e-203 or 3e-189 < x < 4.4e5

    1. Initial program 46.8%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\sqrt[3]{{\left(\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{\mathsf{fma}\left(0.16666666666666666, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}, \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) \cdot 0.5\right)}{n}\right)}^{3}}}}{-n} \]
    7. Taylor expanded in x around 0 86.2%

      \[\leadsto \frac{\sqrt[3]{{\left(\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{\mathsf{fma}\left(0.16666666666666666, \frac{\color{blue}{-1 \cdot {\log x}^{3}}}{n}, \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) \cdot 0.5\right)}{n}\right)}^{3}}}{-n} \]
    8. Step-by-step derivation
      1. neg-mul-186.2%

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

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

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

    if 8.19999999999999962e-203 < x < 3e-189

    1. Initial program 78.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 78.9%

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

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

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

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

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

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

    if 4.4e5 < x

    1. Initial program 66.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.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 86.3% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -0.5:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \sqrt[3]{{x}^{\left(\frac{3}{n}\right)}}\\

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

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    if -0.5 < (/.f64 #s(literal 1 binary64) n) < 2e-8

    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 n around -inf 75.3%

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

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

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

    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 n around 0 53.8%

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

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

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

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

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

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

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

Alternative 4: 85.2% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-8}:\\
\;\;\;\;{\left(\sqrt[3]{1 - t\_0}\right)}^{3}\\

\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -2e-8

    1. Initial program 98.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 98.7%

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

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

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

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

      \[\leadsto \color{blue}{1 - {x}^{\left(\frac{1}{n}\right)}} \]
    6. Step-by-step derivation
      1. add-cube-cbrt98.7%

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

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

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

    if -2e-8 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 0.0

    1. Initial program 42.8%

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

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

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

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

    if 0.0 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n)))

    1. Initial program 55.4%

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

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

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

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

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

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

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

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

Alternative 5: 85.3% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-8}:\\
\;\;\;\;{\left(\sqrt[3]{1 - t\_0}\right)}^{3}\\

\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -2e-8

    1. Initial program 98.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 98.7%

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

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

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

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

      \[\leadsto \color{blue}{1 - {x}^{\left(\frac{1}{n}\right)}} \]
    6. Step-by-step derivation
      1. add-cube-cbrt98.7%

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

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

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

    if -2e-8 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 0.0

    1. Initial program 42.8%

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

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

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

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

    if 0.0 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n)))

    1. Initial program 55.4%

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

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

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

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

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

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

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

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

Alternative 6: 81.9% accurate, 0.3× speedup?

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

\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -2e-8

    1. Initial program 98.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 98.7%

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

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

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

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

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

    if -2e-8 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 0.0

    1. Initial program 42.8%

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

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

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

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

    if 0.0 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n)))

    1. Initial program 55.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 80.6%

      \[\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)} \]
    4. Step-by-step derivation
      1. inv-pow80.6%

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

        \[\leadsto \left(1 + x \cdot \left(x \cdot \left(0.5 \cdot {\color{blue}{\left(n \cdot n\right)}}^{-1} - 0.5 \cdot \frac{1}{n}\right) + \frac{1}{n}\right)\right) - {x}^{\left(\frac{1}{n}\right)} \]
      3. unpow-prod-down80.6%

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

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

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

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

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

Alternative 7: 81.9% accurate, 0.3× speedup?

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

\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -2e-8

    1. Initial program 98.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 98.7%

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

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

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

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

      \[\leadsto \color{blue}{1 - {x}^{\left(\frac{1}{n}\right)}} \]
    6. Step-by-step derivation
      1. add-cube-cbrt98.7%

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

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

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

    if -2e-8 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 0.0

    1. Initial program 42.8%

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

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

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

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

    if 0.0 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n)))

    1. Initial program 55.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 80.6%

      \[\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)} \]
    4. Step-by-step derivation
      1. inv-pow80.6%

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

        \[\leadsto \left(1 + x \cdot \left(x \cdot \left(0.5 \cdot {\color{blue}{\left(n \cdot n\right)}}^{-1} - 0.5 \cdot \frac{1}{n}\right) + \frac{1}{n}\right)\right) - {x}^{\left(\frac{1}{n}\right)} \]
      3. unpow-prod-down80.6%

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

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

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

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

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

Alternative 8: 86.2% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -0.5:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \sqrt[3]{{x}^{\left(\frac{3}{n}\right)}}\\

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

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    if -0.5 < (/.f64 #s(literal 1 binary64) n) < 2e-8

    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 n around inf 75.1%

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

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

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

      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 n around 0 53.8%

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

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

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

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

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

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

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

    Alternative 9: 70.1% accurate, 0.9× speedup?

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

      1. Initial program 63.2%

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

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

          \[\leadsto \left(1 + \frac{x}{n}\right) - e^{\frac{\color{blue}{\log x \cdot 1}}{n}} \]
        2. associate-/l*63.9%

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

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

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

      if 4.40000000000000038e-189 < x < 9.00000000000000037e-173 or 1.84999999999999995e-124 < x < 9.99999999999999923e-66

      1. Initial program 28.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 28.1%

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

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

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

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

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

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

          \[\leadsto \color{blue}{-\frac{\log x}{n}} \]
        2. distribute-neg-frac263.5%

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

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

      if 9.00000000000000037e-173 < x < 1.84999999999999995e-124

      1. Initial program 47.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 46.9%

        \[\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)} \]
      4. Taylor expanded in n around inf 60.8%

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

      if 9.99999999999999923e-66 < x < 2.24999999999999988e-9

      1. Initial program 56.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 2.24999999999999988e-9 < x

      1. Initial program 64.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.3%

        \[\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*96.7%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4.4 \cdot 10^{-189}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-173}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.85 \cdot 10^{-124}:\\ \;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + \frac{x \cdot -0.5 + 0.5 \cdot \frac{x}{n}}{n}\right)\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 10^{-65}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 2.25 \cdot 10^{-9}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{x \cdot n}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 10: 68.0% accurate, 1.3× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-32}:\\ \;\;\;\;\frac{t\_0}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-113}:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-259}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-24}:\\ \;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + x \cdot \left(0.5 \cdot \left(\frac{1}{n} \cdot \frac{1}{n}\right) + 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))))
       (if (<= (/ 1.0 n) -2e-32)
         (/ t_0 (* x n))
         (if (<= (/ 1.0 n) -2e-113)
           (/ (- x (log x)) n)
           (if (<= (/ 1.0 n) 4e-259)
             (/ (pow x (+ (/ 1.0 n) -1.0)) n)
             (if (<= (/ 1.0 n) 2e-24)
               (- (/ x n) (/ (log x) n))
               (-
                (+
                 1.0
                 (*
                  x
                  (+
                   (/ 1.0 n)
                   (* x (+ (* 0.5 (* (/ 1.0 n) (/ 1.0 n))) (* 0.5 (/ -1.0 n)))))))
                t_0)))))))
    double code(double x, double n) {
    	double t_0 = pow(x, (1.0 / n));
    	double tmp;
    	if ((1.0 / n) <= -2e-32) {
    		tmp = t_0 / (x * n);
    	} else if ((1.0 / n) <= -2e-113) {
    		tmp = (x - log(x)) / n;
    	} else if ((1.0 / n) <= 4e-259) {
    		tmp = pow(x, ((1.0 / n) + -1.0)) / n;
    	} else if ((1.0 / n) <= 2e-24) {
    		tmp = (x / n) - (log(x) / n);
    	} else {
    		tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * ((1.0 / n) * (1.0 / n))) + (0.5 * (-1.0 / n))))))) - t_0;
    	}
    	return tmp;
    }
    
    real(8) function code(x, n)
        real(8), intent (in) :: x
        real(8), intent (in) :: n
        real(8) :: t_0
        real(8) :: tmp
        t_0 = x ** (1.0d0 / n)
        if ((1.0d0 / n) <= (-2d-32)) then
            tmp = t_0 / (x * n)
        else if ((1.0d0 / n) <= (-2d-113)) then
            tmp = (x - log(x)) / n
        else if ((1.0d0 / n) <= 4d-259) then
            tmp = (x ** ((1.0d0 / n) + (-1.0d0))) / n
        else if ((1.0d0 / n) <= 2d-24) then
            tmp = (x / n) - (log(x) / n)
        else
            tmp = (1.0d0 + (x * ((1.0d0 / n) + (x * ((0.5d0 * ((1.0d0 / n) * (1.0d0 / n))) + (0.5d0 * ((-1.0d0) / n))))))) - t_0
        end if
        code = tmp
    end function
    
    public static double code(double x, double n) {
    	double t_0 = Math.pow(x, (1.0 / n));
    	double tmp;
    	if ((1.0 / n) <= -2e-32) {
    		tmp = t_0 / (x * n);
    	} else if ((1.0 / n) <= -2e-113) {
    		tmp = (x - Math.log(x)) / n;
    	} else if ((1.0 / n) <= 4e-259) {
    		tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
    	} else if ((1.0 / n) <= 2e-24) {
    		tmp = (x / n) - (Math.log(x) / n);
    	} else {
    		tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * ((1.0 / n) * (1.0 / n))) + (0.5 * (-1.0 / n))))))) - t_0;
    	}
    	return tmp;
    }
    
    def code(x, n):
    	t_0 = math.pow(x, (1.0 / n))
    	tmp = 0
    	if (1.0 / n) <= -2e-32:
    		tmp = t_0 / (x * n)
    	elif (1.0 / n) <= -2e-113:
    		tmp = (x - math.log(x)) / n
    	elif (1.0 / n) <= 4e-259:
    		tmp = math.pow(x, ((1.0 / n) + -1.0)) / n
    	elif (1.0 / n) <= 2e-24:
    		tmp = (x / n) - (math.log(x) / n)
    	else:
    		tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * ((1.0 / n) * (1.0 / n))) + (0.5 * (-1.0 / n))))))) - t_0
    	return tmp
    
    function code(x, n)
    	t_0 = x ^ Float64(1.0 / n)
    	tmp = 0.0
    	if (Float64(1.0 / n) <= -2e-32)
    		tmp = Float64(t_0 / Float64(x * n));
    	elseif (Float64(1.0 / n) <= -2e-113)
    		tmp = Float64(Float64(x - log(x)) / n);
    	elseif (Float64(1.0 / n) <= 4e-259)
    		tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n);
    	elseif (Float64(1.0 / n) <= 2e-24)
    		tmp = Float64(Float64(x / n) - Float64(log(x) / n));
    	else
    		tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(x * Float64(Float64(0.5 * Float64(Float64(1.0 / n) * Float64(1.0 / n))) + Float64(0.5 * Float64(-1.0 / n))))))) - t_0);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, n)
    	t_0 = x ^ (1.0 / n);
    	tmp = 0.0;
    	if ((1.0 / n) <= -2e-32)
    		tmp = t_0 / (x * n);
    	elseif ((1.0 / n) <= -2e-113)
    		tmp = (x - log(x)) / n;
    	elseif ((1.0 / n) <= 4e-259)
    		tmp = (x ^ ((1.0 / n) + -1.0)) / n;
    	elseif ((1.0 / n) <= 2e-24)
    		tmp = (x / n) - (log(x) / n);
    	else
    		tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * ((1.0 / n) * (1.0 / n))) + (0.5 * (-1.0 / n))))))) - t_0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-32], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-113], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-259], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-24], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(x * N[(N[(0.5 * N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / n), $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)}\\
    \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-32}:\\
    \;\;\;\;\frac{t\_0}{x \cdot n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-113}:\\
    \;\;\;\;\frac{x - \log x}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-259}:\\
    \;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-24}:\\
    \;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + x \cdot \left(0.5 \cdot \left(\frac{1}{n} \cdot \frac{1}{n}\right) + 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) < -2.00000000000000011e-32

      1. Initial program 93.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 94.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-neg94.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -2.00000000000000011e-32 < (/.f64 #s(literal 1 binary64) n) < -1.99999999999999996e-113

      1. Initial program 12.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 0 3.5%

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

          \[\leadsto \left(1 + \frac{x}{n}\right) - e^{\frac{\color{blue}{\log x \cdot 1}}{n}} \]
        2. associate-/l*3.5%

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

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

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

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

      if -1.99999999999999996e-113 < (/.f64 #s(literal 1 binary64) n) < 4.0000000000000003e-259

      1. Initial program 45.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 63.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. mul-1-neg63.5%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
      6. Step-by-step derivation
        1. *-un-lft-identity63.5%

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

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

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

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

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

          \[\leadsto 1 \cdot \frac{\color{blue}{{x}^{\left(\frac{1}{n} - 1\right)}}}{n} \]
      7. Applied egg-rr64.5%

        \[\leadsto \color{blue}{1 \cdot \frac{{x}^{\left(\frac{1}{n} - 1\right)}}{n}} \]
      8. Step-by-step derivation
        1. *-lft-identity64.5%

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

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

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

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

      if 4.0000000000000003e-259 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999985e-24

      1. Initial program 20.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 3.9%

        \[\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)} \]
      4. Taylor expanded in n around inf 54.5%

        \[\leadsto \color{blue}{\frac{x \cdot \left(1 + -0.5 \cdot x\right) - \log x}{n}} \]
      5. Step-by-step derivation
        1. *-commutative54.5%

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

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

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

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

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

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

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

      if 1.99999999999999985e-24 < (/.f64 #s(literal 1 binary64) n)

      1. Initial program 54.2%

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

        \[\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)} \]
      4. Step-by-step derivation
        1. inv-pow78.7%

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

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

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

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

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

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

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

    Alternative 11: 68.0% accurate, 1.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-32}:\\ \;\;\;\;\frac{t\_0}{x \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-113}:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-259}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-24}:\\ \;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + \frac{x \cdot -0.5 + 0.5 \cdot \frac{x}{n}}{n}\right)\right) - t\_0\\ \end{array} \end{array} \]
    (FPCore (x n)
     :precision binary64
     (let* ((t_0 (pow x (/ 1.0 n))))
       (if (<= (/ 1.0 n) -2e-32)
         (/ t_0 (* x n))
         (if (<= (/ 1.0 n) -2e-113)
           (/ (- x (log x)) n)
           (if (<= (/ 1.0 n) 4e-259)
             (/ (pow x (+ (/ 1.0 n) -1.0)) n)
             (if (<= (/ 1.0 n) 2e-24)
               (- (/ x n) (/ (log x) n))
               (-
                (+ 1.0 (* x (+ (/ 1.0 n) (/ (+ (* x -0.5) (* 0.5 (/ x n))) n))))
                t_0)))))))
    double code(double x, double n) {
    	double t_0 = pow(x, (1.0 / n));
    	double tmp;
    	if ((1.0 / n) <= -2e-32) {
    		tmp = t_0 / (x * n);
    	} else if ((1.0 / n) <= -2e-113) {
    		tmp = (x - log(x)) / n;
    	} else if ((1.0 / n) <= 4e-259) {
    		tmp = pow(x, ((1.0 / n) + -1.0)) / n;
    	} else if ((1.0 / n) <= 2e-24) {
    		tmp = (x / n) - (log(x) / n);
    	} else {
    		tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0;
    	}
    	return tmp;
    }
    
    real(8) function code(x, n)
        real(8), intent (in) :: x
        real(8), intent (in) :: n
        real(8) :: t_0
        real(8) :: tmp
        t_0 = x ** (1.0d0 / n)
        if ((1.0d0 / n) <= (-2d-32)) then
            tmp = t_0 / (x * n)
        else if ((1.0d0 / n) <= (-2d-113)) then
            tmp = (x - log(x)) / n
        else if ((1.0d0 / n) <= 4d-259) then
            tmp = (x ** ((1.0d0 / n) + (-1.0d0))) / n
        else if ((1.0d0 / n) <= 2d-24) then
            tmp = (x / n) - (log(x) / n)
        else
            tmp = (1.0d0 + (x * ((1.0d0 / n) + (((x * (-0.5d0)) + (0.5d0 * (x / n))) / n)))) - t_0
        end if
        code = tmp
    end function
    
    public static double code(double x, double n) {
    	double t_0 = Math.pow(x, (1.0 / n));
    	double tmp;
    	if ((1.0 / n) <= -2e-32) {
    		tmp = t_0 / (x * n);
    	} else if ((1.0 / n) <= -2e-113) {
    		tmp = (x - Math.log(x)) / n;
    	} else if ((1.0 / n) <= 4e-259) {
    		tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
    	} else if ((1.0 / n) <= 2e-24) {
    		tmp = (x / n) - (Math.log(x) / n);
    	} else {
    		tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0;
    	}
    	return tmp;
    }
    
    def code(x, n):
    	t_0 = math.pow(x, (1.0 / n))
    	tmp = 0
    	if (1.0 / n) <= -2e-32:
    		tmp = t_0 / (x * n)
    	elif (1.0 / n) <= -2e-113:
    		tmp = (x - math.log(x)) / n
    	elif (1.0 / n) <= 4e-259:
    		tmp = math.pow(x, ((1.0 / n) + -1.0)) / n
    	elif (1.0 / n) <= 2e-24:
    		tmp = (x / n) - (math.log(x) / n)
    	else:
    		tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0
    	return tmp
    
    function code(x, n)
    	t_0 = x ^ Float64(1.0 / n)
    	tmp = 0.0
    	if (Float64(1.0 / n) <= -2e-32)
    		tmp = Float64(t_0 / Float64(x * n));
    	elseif (Float64(1.0 / n) <= -2e-113)
    		tmp = Float64(Float64(x - log(x)) / n);
    	elseif (Float64(1.0 / n) <= 4e-259)
    		tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n);
    	elseif (Float64(1.0 / n) <= 2e-24)
    		tmp = Float64(Float64(x / n) - Float64(log(x) / n));
    	else
    		tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(Float64(Float64(x * -0.5) + Float64(0.5 * Float64(x / n))) / n)))) - t_0);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, n)
    	t_0 = x ^ (1.0 / n);
    	tmp = 0.0;
    	if ((1.0 / n) <= -2e-32)
    		tmp = t_0 / (x * n);
    	elseif ((1.0 / n) <= -2e-113)
    		tmp = (x - log(x)) / n;
    	elseif ((1.0 / n) <= 4e-259)
    		tmp = (x ^ ((1.0 / n) + -1.0)) / n;
    	elseif ((1.0 / n) <= 2e-24)
    		tmp = (x / n) - (log(x) / n);
    	else
    		tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-32], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-113], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-259], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-24], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(x * -0.5), $MachinePrecision] + N[(0.5 * N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := {x}^{\left(\frac{1}{n}\right)}\\
    \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-32}:\\
    \;\;\;\;\frac{t\_0}{x \cdot n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-113}:\\
    \;\;\;\;\frac{x - \log x}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-259}:\\
    \;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-24}:\\
    \;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + \frac{x \cdot -0.5 + 0.5 \cdot \frac{x}{n}}{n}\right)\right) - t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 5 regimes
    2. if (/.f64 #s(literal 1 binary64) n) < -2.00000000000000011e-32

      1. Initial program 93.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 94.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-neg94.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -2.00000000000000011e-32 < (/.f64 #s(literal 1 binary64) n) < -1.99999999999999996e-113

      1. Initial program 12.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 0 3.5%

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

          \[\leadsto \left(1 + \frac{x}{n}\right) - e^{\frac{\color{blue}{\log x \cdot 1}}{n}} \]
        2. associate-/l*3.5%

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

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

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

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

      if -1.99999999999999996e-113 < (/.f64 #s(literal 1 binary64) n) < 4.0000000000000003e-259

      1. Initial program 45.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 63.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. mul-1-neg63.5%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
      6. Step-by-step derivation
        1. *-un-lft-identity63.5%

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

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

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

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

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

          \[\leadsto 1 \cdot \frac{\color{blue}{{x}^{\left(\frac{1}{n} - 1\right)}}}{n} \]
      7. Applied egg-rr64.5%

        \[\leadsto \color{blue}{1 \cdot \frac{{x}^{\left(\frac{1}{n} - 1\right)}}{n}} \]
      8. Step-by-step derivation
        1. *-lft-identity64.5%

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

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

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

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

      if 4.0000000000000003e-259 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999985e-24

      1. Initial program 20.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 3.9%

        \[\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)} \]
      4. Taylor expanded in n around inf 54.5%

        \[\leadsto \color{blue}{\frac{x \cdot \left(1 + -0.5 \cdot x\right) - \log x}{n}} \]
      5. Step-by-step derivation
        1. *-commutative54.5%

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

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

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

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

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

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

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

      if 1.99999999999999985e-24 < (/.f64 #s(literal 1 binary64) n)

      1. Initial program 54.2%

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

        \[\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)} \]
      4. Taylor expanded in n around inf 74.2%

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

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

    Alternative 12: 69.8% accurate, 1.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;x \leq 1.38 \cdot 10^{-188}:\\ \;\;\;\;1 - t\_0\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-45}:\\ \;\;\;\;\frac{\log x}{-n}\\ \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))))
       (if (<= x 1.38e-188)
         (- 1.0 t_0)
         (if (<= x 2.6e-45) (/ (log x) (- n)) (/ (/ t_0 n) x)))))
    double code(double x, double n) {
    	double t_0 = pow(x, (1.0 / n));
    	double tmp;
    	if (x <= 1.38e-188) {
    		tmp = 1.0 - t_0;
    	} else if (x <= 2.6e-45) {
    		tmp = log(x) / -n;
    	} else {
    		tmp = (t_0 / n) / x;
    	}
    	return tmp;
    }
    
    real(8) function code(x, n)
        real(8), intent (in) :: x
        real(8), intent (in) :: n
        real(8) :: t_0
        real(8) :: tmp
        t_0 = x ** (1.0d0 / n)
        if (x <= 1.38d-188) then
            tmp = 1.0d0 - t_0
        else if (x <= 2.6d-45) then
            tmp = log(x) / -n
        else
            tmp = (t_0 / n) / x
        end if
        code = tmp
    end function
    
    public static double code(double x, double n) {
    	double t_0 = Math.pow(x, (1.0 / n));
    	double tmp;
    	if (x <= 1.38e-188) {
    		tmp = 1.0 - t_0;
    	} else if (x <= 2.6e-45) {
    		tmp = Math.log(x) / -n;
    	} else {
    		tmp = (t_0 / n) / x;
    	}
    	return tmp;
    }
    
    def code(x, n):
    	t_0 = math.pow(x, (1.0 / n))
    	tmp = 0
    	if x <= 1.38e-188:
    		tmp = 1.0 - t_0
    	elif x <= 2.6e-45:
    		tmp = math.log(x) / -n
    	else:
    		tmp = (t_0 / n) / x
    	return tmp
    
    function code(x, n)
    	t_0 = x ^ Float64(1.0 / n)
    	tmp = 0.0
    	if (x <= 1.38e-188)
    		tmp = Float64(1.0 - t_0);
    	elseif (x <= 2.6e-45)
    		tmp = Float64(log(x) / Float64(-n));
    	else
    		tmp = Float64(Float64(t_0 / n) / x);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, n)
    	t_0 = x ^ (1.0 / n);
    	tmp = 0.0;
    	if (x <= 1.38e-188)
    		tmp = 1.0 - t_0;
    	elseif (x <= 2.6e-45)
    		tmp = log(x) / -n;
    	else
    		tmp = (t_0 / n) / x;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1.38e-188], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[x, 2.6e-45], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := {x}^{\left(\frac{1}{n}\right)}\\
    \mathbf{if}\;x \leq 1.38 \cdot 10^{-188}:\\
    \;\;\;\;1 - t\_0\\
    
    \mathbf{elif}\;x \leq 2.6 \cdot 10^{-45}:\\
    \;\;\;\;\frac{\log x}{-n}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if x < 1.3800000000000001e-188

      1. Initial program 63.2%

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

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

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

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

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

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

      if 1.3800000000000001e-188 < x < 2.59999999999999987e-45

      1. Initial program 36.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 36.7%

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

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

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

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

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

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

          \[\leadsto \color{blue}{-\frac{\log x}{n}} \]
        2. distribute-neg-frac252.6%

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

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

      if 2.59999999999999987e-45 < x

      1. Initial program 64.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 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*88.7%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.38 \cdot 10^{-188}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-45}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 13: 69.8% accurate, 1.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;x \leq 3 \cdot 10^{-189}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{-45}:\\ \;\;\;\;\frac{\log x}{-n}\\ \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))))
       (if (<= x 3e-189)
         (- (+ 1.0 (/ x n)) t_0)
         (if (<= x 2.3e-45) (/ (log x) (- n)) (/ (/ t_0 n) x)))))
    double code(double x, double n) {
    	double t_0 = pow(x, (1.0 / n));
    	double tmp;
    	if (x <= 3e-189) {
    		tmp = (1.0 + (x / n)) - t_0;
    	} else if (x <= 2.3e-45) {
    		tmp = log(x) / -n;
    	} else {
    		tmp = (t_0 / n) / x;
    	}
    	return tmp;
    }
    
    real(8) function code(x, n)
        real(8), intent (in) :: x
        real(8), intent (in) :: n
        real(8) :: t_0
        real(8) :: tmp
        t_0 = x ** (1.0d0 / n)
        if (x <= 3d-189) then
            tmp = (1.0d0 + (x / n)) - t_0
        else if (x <= 2.3d-45) then
            tmp = log(x) / -n
        else
            tmp = (t_0 / n) / x
        end if
        code = tmp
    end function
    
    public static double code(double x, double n) {
    	double t_0 = Math.pow(x, (1.0 / n));
    	double tmp;
    	if (x <= 3e-189) {
    		tmp = (1.0 + (x / n)) - t_0;
    	} else if (x <= 2.3e-45) {
    		tmp = Math.log(x) / -n;
    	} else {
    		tmp = (t_0 / n) / x;
    	}
    	return tmp;
    }
    
    def code(x, n):
    	t_0 = math.pow(x, (1.0 / n))
    	tmp = 0
    	if x <= 3e-189:
    		tmp = (1.0 + (x / n)) - t_0
    	elif x <= 2.3e-45:
    		tmp = math.log(x) / -n
    	else:
    		tmp = (t_0 / n) / x
    	return tmp
    
    function code(x, n)
    	t_0 = x ^ Float64(1.0 / n)
    	tmp = 0.0
    	if (x <= 3e-189)
    		tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0);
    	elseif (x <= 2.3e-45)
    		tmp = Float64(log(x) / Float64(-n));
    	else
    		tmp = Float64(Float64(t_0 / n) / x);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, n)
    	t_0 = x ^ (1.0 / n);
    	tmp = 0.0;
    	if (x <= 3e-189)
    		tmp = (1.0 + (x / n)) - t_0;
    	elseif (x <= 2.3e-45)
    		tmp = log(x) / -n;
    	else
    		tmp = (t_0 / n) / x;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 3e-189], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 2.3e-45], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := {x}^{\left(\frac{1}{n}\right)}\\
    \mathbf{if}\;x \leq 3 \cdot 10^{-189}:\\
    \;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
    
    \mathbf{elif}\;x \leq 2.3 \cdot 10^{-45}:\\
    \;\;\;\;\frac{\log x}{-n}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if x < 3e-189

      1. Initial program 63.2%

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

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

          \[\leadsto \left(1 + \frac{x}{n}\right) - e^{\frac{\color{blue}{\log x \cdot 1}}{n}} \]
        2. associate-/l*63.9%

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

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

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

      if 3e-189 < x < 2.29999999999999992e-45

      1. Initial program 36.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 36.7%

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

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

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

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

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

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

          \[\leadsto \color{blue}{-\frac{\log x}{n}} \]
        2. distribute-neg-frac252.6%

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

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

      if 2.29999999999999992e-45 < x

      1. Initial program 64.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 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*88.7%

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 14: 56.8% accurate, 1.8× speedup?

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

      1. Initial program 63.2%

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

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

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

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

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

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

      if 5.3999999999999999e-189 < x < 1

      1. Initial program 41.2%

        \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
      2. Add Preprocessing
      3. Taylor expanded in x around 0 38.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)} \]
      4. Taylor expanded in n around inf 48.1%

        \[\leadsto \color{blue}{\frac{x \cdot \left(1 + -0.5 \cdot x\right) - \log x}{n}} \]
      5. Step-by-step derivation
        1. *-commutative48.1%

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

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

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

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

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

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

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

      if 1 < x

      1. Initial program 65.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 84.5%

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

          \[\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 64.8%

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5.4 \cdot 10^{-189}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 - \frac{0.5}{x}}{n}}{x}\\ \end{array} \]
      7. Add Preprocessing

      Alternative 15: 56.8% accurate, 1.8× speedup?

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

        1. Initial program 63.2%

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

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

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

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

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

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

        if 3.05e-189 < x < 0.97999999999999998

        1. Initial program 41.2%

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

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

            \[\leadsto \left(1 + \frac{x}{n}\right) - e^{\frac{\color{blue}{\log x \cdot 1}}{n}} \]
          2. associate-/l*38.7%

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

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

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

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

        if 0.97999999999999998 < x

        1. Initial program 65.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 84.5%

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

            \[\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 64.8%

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

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 3.05 \cdot 10^{-189}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.98:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 - \frac{0.5}{x}}{n}}{x}\\ \end{array} \]
        7. Add Preprocessing

        Alternative 16: 57.3% accurate, 1.9× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.96:\\ \;\;\;\;\frac{x - \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.96) (/ (- x (log x)) n) (/ (/ (- 1.0 (/ 0.5 x)) n) x)))
        double code(double x, double n) {
        	double tmp;
        	if (x <= 0.96) {
        		tmp = (x - 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.96d0) then
                tmp = (x - 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.96) {
        		tmp = (x - Math.log(x)) / n;
        	} else {
        		tmp = ((1.0 - (0.5 / x)) / n) / x;
        	}
        	return tmp;
        }
        
        def code(x, n):
        	tmp = 0
        	if x <= 0.96:
        		tmp = (x - 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.96)
        		tmp = Float64(Float64(x - log(x)) / 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.96)
        		tmp = (x - log(x)) / n;
        	else
        		tmp = ((1.0 - (0.5 / x)) / n) / x;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, n_] := If[LessEqual[x, 0.96], N[(N[(x - N[Log[x], $MachinePrecision]), $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.96:\\
        \;\;\;\;\frac{x - \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.95999999999999996

          1. Initial program 49.2%

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

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

              \[\leadsto \left(1 + \frac{x}{n}\right) - e^{\frac{\color{blue}{\log x \cdot 1}}{n}} \]
            2. associate-/l*47.9%

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

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

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

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

          if 0.95999999999999996 < x

          1. Initial program 65.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 84.5%

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

              \[\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 64.8%

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

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

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

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

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

          Alternative 17: 57.2% 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 49.2%

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{-\frac{\log x}{n}} \]
              2. distribute-neg-frac245.6%

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

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

            if 0.680000000000000049 < x

            1. Initial program 65.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 84.5%

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

                \[\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 64.8%

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

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

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

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

              \[\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 18: 40.6% accurate, 30.1× speedup?

            \[\begin{array}{l} \\ \frac{1}{n} \cdot \frac{1}{x} \end{array} \]
            (FPCore (x n) :precision binary64 (* (/ 1.0 n) (/ 1.0 x)))
            double code(double x, double n) {
            	return (1.0 / n) * (1.0 / x);
            }
            
            real(8) function code(x, n)
                real(8), intent (in) :: x
                real(8), intent (in) :: n
                code = (1.0d0 / n) * (1.0d0 / x)
            end function
            
            public static double code(double x, double n) {
            	return (1.0 / n) * (1.0 / x);
            }
            
            def code(x, n):
            	return (1.0 / n) * (1.0 / x)
            
            function code(x, n)
            	return Float64(Float64(1.0 / n) * Float64(1.0 / x))
            end
            
            function tmp = code(x, n)
            	tmp = (1.0 / n) * (1.0 / x);
            end
            
            code[x_, n_] := N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            \frac{1}{n} \cdot \frac{1}{x}
            \end{array}
            
            Derivation
            1. Initial program 55.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 59.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. mul-1-neg59.0%

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

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{{\left(x \cdot n\right)}^{-1}} \]
              2. unpow-prod-down41.3%

                \[\leadsto \color{blue}{{x}^{-1} \cdot {n}^{-1}} \]
              3. inv-pow41.3%

                \[\leadsto \color{blue}{\frac{1}{x}} \cdot {n}^{-1} \]
              4. inv-pow41.3%

                \[\leadsto \frac{1}{x} \cdot \color{blue}{\frac{1}{n}} \]
            8. Applied egg-rr41.3%

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

              \[\leadsto \frac{1}{n} \cdot \frac{1}{x} \]
            10. Add Preprocessing

            Alternative 19: 40.1% 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 55.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 59.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. mul-1-neg59.0%

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{1}{x \cdot n} \]
            8. Add Preprocessing

            Alternative 20: 40.6% accurate, 42.2× speedup?

            \[\begin{array}{l} \\ \frac{\frac{1}{n}}{x} \end{array} \]
            (FPCore (x n) :precision binary64 (/ (/ 1.0 n) x))
            double code(double x, double n) {
            	return (1.0 / n) / x;
            }
            
            real(8) function code(x, n)
                real(8), intent (in) :: x
                real(8), intent (in) :: n
                code = (1.0d0 / n) / x
            end function
            
            public static double code(double x, double n) {
            	return (1.0 / n) / x;
            }
            
            def code(x, n):
            	return (1.0 / n) / x
            
            function code(x, n)
            	return Float64(Float64(1.0 / n) / x)
            end
            
            function tmp = code(x, n)
            	tmp = (1.0 / n) / x;
            end
            
            code[x_, n_] := N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            \frac{\frac{1}{n}}{x}
            \end{array}
            
            Derivation
            1. Initial program 55.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 59.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. mul-1-neg59.0%

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{\frac{\frac{1}{n}}{x}} \]
            9. Final simplification41.3%

              \[\leadsto \frac{\frac{1}{n}}{x} \]
            10. Add Preprocessing

            Alternative 21: 4.5% accurate, 70.3× speedup?

            \[\begin{array}{l} \\ \frac{x}{n} \end{array} \]
            (FPCore (x n) :precision binary64 (/ x n))
            double code(double x, double n) {
            	return x / n;
            }
            
            real(8) function code(x, n)
                real(8), intent (in) :: x
                real(8), intent (in) :: n
                code = x / n
            end function
            
            public static double code(double x, double n) {
            	return x / n;
            }
            
            def code(x, n):
            	return x / n
            
            function code(x, n)
            	return Float64(x / n)
            end
            
            function tmp = code(x, n)
            	tmp = x / n;
            end
            
            code[x_, n_] := N[(x / n), $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            \frac{x}{n}
            \end{array}
            
            Derivation
            1. Initial program 55.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 36.7%

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

                \[\leadsto \left(1 + \frac{x}{n}\right) - e^{\frac{\color{blue}{\log x \cdot 1}}{n}} \]
              2. associate-/l*36.7%

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

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

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

              \[\leadsto \color{blue}{\frac{x}{n}} \]
            7. Final simplification4.3%

              \[\leadsto \frac{x}{n} \]
            8. Add Preprocessing

            Reproduce

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