2nthrt (problem 3.4.6)

Percentage Accurate: 53.8% → 85.1%
Time: 40.7s
Alternatives: 17
Speedup: 1.7×

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 17 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.8% accurate, 1.0× speedup?

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

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

Alternative 1: 85.1% accurate, 0.2× speedup?

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

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

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

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

\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{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) < -2.00000000000000016e-5 or 5.00000000000000033e-153 < (/.f64 #s(literal 1 binary64) n) < 5e3

    1. Initial program 82.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 94.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. mul-1-neg94.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{{x}^{\left(\frac{1}{n}\right)}}{x \cdot n}} \]
    6. Step-by-step derivation
      1. add-cbrt-cube94.3%

        \[\leadsto \frac{\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)}}}}{x \cdot n} \]
      2. pow394.3%

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

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

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

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

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

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

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

    1. Initial program 39.0%

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

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

      \[\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 5e3 < (/.f64 #s(literal 1 binary64) n)

    1. Initial program 58.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 58.4%

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

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

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

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

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

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

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

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

Alternative 2: 85.0% accurate, 0.3× speedup?

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

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

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

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

\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{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) < -2.00000000000000016e-5 or 5.00000000000000033e-153 < (/.f64 #s(literal 1 binary64) n) < 5e3

    1. Initial program 82.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 94.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. mul-1-neg94.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{{x}^{\left(\frac{1}{n}\right)}}{x \cdot n}} \]
    6. Step-by-step derivation
      1. add-cbrt-cube94.3%

        \[\leadsto \frac{\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)}}}}{x \cdot n} \]
      2. pow394.3%

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

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

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

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

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

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

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

    1. Initial program 39.0%

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

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

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

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

      1. Initial program 58.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 58.4%

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

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

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

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

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

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

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

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

    Alternative 3: 84.9% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\sqrt[3]{{x}^{\left(\frac{3}{n}\right)}}}{n \cdot x}\\ \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-5}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-153}:\\ \;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5000:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \end{array} \end{array} \]
    (FPCore (x n)
     :precision binary64
     (let* ((t_0 (/ (cbrt (pow x (/ 3.0 n))) (* n x))))
       (if (<= (/ 1.0 n) -2e-5)
         t_0
         (if (<= (/ 1.0 n) 5e-153)
           (/ (log (/ (+ 1.0 x) x)) n)
           (if (<= (/ 1.0 n) 5000.0) t_0 (- (exp (/ x n)) (pow x (/ 1.0 n))))))))
    double code(double x, double n) {
    	double t_0 = cbrt(pow(x, (3.0 / n))) / (n * x);
    	double tmp;
    	if ((1.0 / n) <= -2e-5) {
    		tmp = t_0;
    	} else if ((1.0 / n) <= 5e-153) {
    		tmp = log(((1.0 + x) / x)) / n;
    	} else if ((1.0 / n) <= 5000.0) {
    		tmp = t_0;
    	} else {
    		tmp = exp((x / n)) - pow(x, (1.0 / n));
    	}
    	return tmp;
    }
    
    public static double code(double x, double n) {
    	double t_0 = Math.cbrt(Math.pow(x, (3.0 / n))) / (n * x);
    	double tmp;
    	if ((1.0 / n) <= -2e-5) {
    		tmp = t_0;
    	} else if ((1.0 / n) <= 5e-153) {
    		tmp = Math.log(((1.0 + x) / x)) / n;
    	} else if ((1.0 / n) <= 5000.0) {
    		tmp = t_0;
    	} else {
    		tmp = Math.exp((x / n)) - Math.pow(x, (1.0 / n));
    	}
    	return tmp;
    }
    
    function code(x, n)
    	t_0 = Float64(cbrt((x ^ Float64(3.0 / n))) / Float64(n * x))
    	tmp = 0.0
    	if (Float64(1.0 / n) <= -2e-5)
    		tmp = t_0;
    	elseif (Float64(1.0 / n) <= 5e-153)
    		tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n);
    	elseif (Float64(1.0 / n) <= 5000.0)
    		tmp = t_0;
    	else
    		tmp = Float64(exp(Float64(x / n)) - (x ^ Float64(1.0 / n)));
    	end
    	return tmp
    end
    
    code[x_, n_] := Block[{t$95$0 = N[(N[Power[N[Power[x, N[(3.0 / n), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-5], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-153], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5000.0], t$95$0, N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{\sqrt[3]{{x}^{\left(\frac{3}{n}\right)}}}{n \cdot x}\\
    \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-5}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-153}:\\
    \;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 5000:\\
    \;\;\;\;t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;e^{\frac{x}{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) < -2.00000000000000016e-5 or 5.00000000000000033e-153 < (/.f64 #s(literal 1 binary64) n) < 5e3

      1. Initial program 82.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 94.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. mul-1-neg94.3%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{{x}^{\left(\frac{1}{n}\right)}}{x \cdot n}} \]
      6. Step-by-step derivation
        1. add-cbrt-cube94.3%

          \[\leadsto \frac{\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)}}}}{x \cdot n} \]
        2. pow394.3%

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

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

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

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

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

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

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

      1. Initial program 39.0%

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

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

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

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

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

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

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

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

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

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

      1. Initial program 58.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 58.4%

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

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

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

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

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

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

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

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

    Alternative 4: 85.0% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-5}:\\ \;\;\;\;\frac{t\_0}{n \cdot x}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-153}:\\ \;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5000:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{n \cdot x}\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{x}{n}} - t\_0\\ \end{array} \end{array} \]
    (FPCore (x n)
     :precision binary64
     (let* ((t_0 (pow x (/ 1.0 n))))
       (if (<= (/ 1.0 n) -2e-5)
         (/ t_0 (* n x))
         (if (<= (/ 1.0 n) 5e-153)
           (/ (log (/ (+ 1.0 x) x)) n)
           (if (<= (/ 1.0 n) 5000.0)
             (/ (exp (/ (log x) n)) (* n x))
             (- (exp (/ x n)) t_0))))))
    double code(double x, double n) {
    	double t_0 = pow(x, (1.0 / n));
    	double tmp;
    	if ((1.0 / n) <= -2e-5) {
    		tmp = t_0 / (n * x);
    	} else if ((1.0 / n) <= 5e-153) {
    		tmp = log(((1.0 + x) / x)) / n;
    	} else if ((1.0 / n) <= 5000.0) {
    		tmp = exp((log(x) / n)) / (n * x);
    	} else {
    		tmp = exp((x / 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-5)) then
            tmp = t_0 / (n * x)
        else if ((1.0d0 / n) <= 5d-153) then
            tmp = log(((1.0d0 + x) / x)) / n
        else if ((1.0d0 / n) <= 5000.0d0) then
            tmp = exp((log(x) / n)) / (n * x)
        else
            tmp = exp((x / 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-5) {
    		tmp = t_0 / (n * x);
    	} else if ((1.0 / n) <= 5e-153) {
    		tmp = Math.log(((1.0 + x) / x)) / n;
    	} else if ((1.0 / n) <= 5000.0) {
    		tmp = Math.exp((Math.log(x) / n)) / (n * x);
    	} else {
    		tmp = Math.exp((x / n)) - t_0;
    	}
    	return tmp;
    }
    
    def code(x, n):
    	t_0 = math.pow(x, (1.0 / n))
    	tmp = 0
    	if (1.0 / n) <= -2e-5:
    		tmp = t_0 / (n * x)
    	elif (1.0 / n) <= 5e-153:
    		tmp = math.log(((1.0 + x) / x)) / n
    	elif (1.0 / n) <= 5000.0:
    		tmp = math.exp((math.log(x) / n)) / (n * x)
    	else:
    		tmp = math.exp((x / n)) - t_0
    	return tmp
    
    function code(x, n)
    	t_0 = x ^ Float64(1.0 / n)
    	tmp = 0.0
    	if (Float64(1.0 / n) <= -2e-5)
    		tmp = Float64(t_0 / Float64(n * x));
    	elseif (Float64(1.0 / n) <= 5e-153)
    		tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n);
    	elseif (Float64(1.0 / n) <= 5000.0)
    		tmp = Float64(exp(Float64(log(x) / n)) / Float64(n * x));
    	else
    		tmp = Float64(exp(Float64(x / 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-5)
    		tmp = t_0 / (n * x);
    	elseif ((1.0 / n) <= 5e-153)
    		tmp = log(((1.0 + x) / x)) / n;
    	elseif ((1.0 / n) <= 5000.0)
    		tmp = exp((log(x) / n)) / (n * x);
    	else
    		tmp = exp((x / 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-5], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-153], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5000.0], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := {x}^{\left(\frac{1}{n}\right)}\\
    \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-5}:\\
    \;\;\;\;\frac{t\_0}{n \cdot x}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-153}:\\
    \;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 5000:\\
    \;\;\;\;\frac{e^{\frac{\log x}{n}}}{n \cdot x}\\
    
    \mathbf{else}:\\
    \;\;\;\;e^{\frac{x}{n}} - t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if (/.f64 #s(literal 1 binary64) n) < -2.00000000000000016e-5

      1. Initial program 97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

      1. Initial program 39.0%

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

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

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

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

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

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

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

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

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

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

      1. Initial program 21.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 76.1%

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

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

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

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

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

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

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

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

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

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

      1. Initial program 58.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 58.4%

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

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

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

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

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

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

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

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

    Alternative 5: 81.7% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-5}:\\ \;\;\;\;\frac{t\_0}{n \cdot x}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-153}:\\ \;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5000:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}}}{n \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + x \cdot \frac{1 + 0.5 \cdot \frac{x}{n}}{n}\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-5)
         (/ t_0 (* n x))
         (if (<= (/ 1.0 n) 5e-153)
           (/ (log (/ (+ 1.0 x) x)) n)
           (if (<= (/ 1.0 n) 5000.0)
             (/ (exp (/ (log x) n)) (* n x))
             (- (+ 1.0 (* x (/ (+ 1.0 (* 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-5) {
    		tmp = t_0 / (n * x);
    	} else if ((1.0 / n) <= 5e-153) {
    		tmp = log(((1.0 + x) / x)) / n;
    	} else if ((1.0 / n) <= 5000.0) {
    		tmp = exp((log(x) / n)) / (n * x);
    	} else {
    		tmp = (1.0 + (x * ((1.0 + (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-5)) then
            tmp = t_0 / (n * x)
        else if ((1.0d0 / n) <= 5d-153) then
            tmp = log(((1.0d0 + x) / x)) / n
        else if ((1.0d0 / n) <= 5000.0d0) then
            tmp = exp((log(x) / n)) / (n * x)
        else
            tmp = (1.0d0 + (x * ((1.0d0 + (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-5) {
    		tmp = t_0 / (n * x);
    	} else if ((1.0 / n) <= 5e-153) {
    		tmp = Math.log(((1.0 + x) / x)) / n;
    	} else if ((1.0 / n) <= 5000.0) {
    		tmp = Math.exp((Math.log(x) / n)) / (n * x);
    	} else {
    		tmp = (1.0 + (x * ((1.0 + (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-5:
    		tmp = t_0 / (n * x)
    	elif (1.0 / n) <= 5e-153:
    		tmp = math.log(((1.0 + x) / x)) / n
    	elif (1.0 / n) <= 5000.0:
    		tmp = math.exp((math.log(x) / n)) / (n * x)
    	else:
    		tmp = (1.0 + (x * ((1.0 + (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-5)
    		tmp = Float64(t_0 / Float64(n * x));
    	elseif (Float64(1.0 / n) <= 5e-153)
    		tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n);
    	elseif (Float64(1.0 / n) <= 5000.0)
    		tmp = Float64(exp(Float64(log(x) / n)) / Float64(n * x));
    	else
    		tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 + 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-5)
    		tmp = t_0 / (n * x);
    	elseif ((1.0 / n) <= 5e-153)
    		tmp = log(((1.0 + x) / x)) / n;
    	elseif ((1.0 / n) <= 5000.0)
    		tmp = exp((log(x) / n)) / (n * x);
    	else
    		tmp = (1.0 + (x * ((1.0 + (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-5], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-153], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5000.0], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x * N[(N[(1.0 + N[(0.5 * N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $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^{-5}:\\
    \;\;\;\;\frac{t\_0}{n \cdot x}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-153}:\\
    \;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 5000:\\
    \;\;\;\;\frac{e^{\frac{\log x}{n}}}{n \cdot x}\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(1 + x \cdot \frac{1 + 0.5 \cdot \frac{x}{n}}{n}\right) - t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if (/.f64 #s(literal 1 binary64) n) < -2.00000000000000016e-5

      1. Initial program 97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

      1. Initial program 39.0%

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

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

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

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

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

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

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

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

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

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

      1. Initial program 21.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 76.1%

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

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

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

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

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

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

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

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

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

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

      1. Initial program 58.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 63.3%

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

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

        \[\leadsto \left(1 + x \cdot \frac{1 + \color{blue}{0.5 \cdot \frac{x}{n}}}{n}\right) - {x}^{\left(\frac{1}{n}\right)} \]
      6. Step-by-step derivation
        1. *-commutative80.9%

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

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

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

    Alternative 6: 81.7% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{t\_0}{n \cdot x}\\ \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-5}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-153}:\\ \;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5000:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\left(1 + x \cdot \frac{1 + 0.5 \cdot \frac{x}{n}}{n}\right) - t\_0\\ \end{array} \end{array} \]
    (FPCore (x n)
     :precision binary64
     (let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ t_0 (* n x))))
       (if (<= (/ 1.0 n) -2e-5)
         t_1
         (if (<= (/ 1.0 n) 5e-153)
           (/ (log (/ (+ 1.0 x) x)) n)
           (if (<= (/ 1.0 n) 5000.0)
             t_1
             (- (+ 1.0 (* x (/ (+ 1.0 (* 0.5 (/ x n))) n))) t_0))))))
    double code(double x, double n) {
    	double t_0 = pow(x, (1.0 / n));
    	double t_1 = t_0 / (n * x);
    	double tmp;
    	if ((1.0 / n) <= -2e-5) {
    		tmp = t_1;
    	} else if ((1.0 / n) <= 5e-153) {
    		tmp = log(((1.0 + x) / x)) / n;
    	} else if ((1.0 / n) <= 5000.0) {
    		tmp = t_1;
    	} else {
    		tmp = (1.0 + (x * ((1.0 + (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) :: t_1
        real(8) :: tmp
        t_0 = x ** (1.0d0 / n)
        t_1 = t_0 / (n * x)
        if ((1.0d0 / n) <= (-2d-5)) then
            tmp = t_1
        else if ((1.0d0 / n) <= 5d-153) then
            tmp = log(((1.0d0 + x) / x)) / n
        else if ((1.0d0 / n) <= 5000.0d0) then
            tmp = t_1
        else
            tmp = (1.0d0 + (x * ((1.0d0 + (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 t_1 = t_0 / (n * x);
    	double tmp;
    	if ((1.0 / n) <= -2e-5) {
    		tmp = t_1;
    	} else if ((1.0 / n) <= 5e-153) {
    		tmp = Math.log(((1.0 + x) / x)) / n;
    	} else if ((1.0 / n) <= 5000.0) {
    		tmp = t_1;
    	} else {
    		tmp = (1.0 + (x * ((1.0 + (0.5 * (x / n))) / n))) - t_0;
    	}
    	return tmp;
    }
    
    def code(x, n):
    	t_0 = math.pow(x, (1.0 / n))
    	t_1 = t_0 / (n * x)
    	tmp = 0
    	if (1.0 / n) <= -2e-5:
    		tmp = t_1
    	elif (1.0 / n) <= 5e-153:
    		tmp = math.log(((1.0 + x) / x)) / n
    	elif (1.0 / n) <= 5000.0:
    		tmp = t_1
    	else:
    		tmp = (1.0 + (x * ((1.0 + (0.5 * (x / n))) / n))) - t_0
    	return tmp
    
    function code(x, n)
    	t_0 = x ^ Float64(1.0 / n)
    	t_1 = Float64(t_0 / Float64(n * x))
    	tmp = 0.0
    	if (Float64(1.0 / n) <= -2e-5)
    		tmp = t_1;
    	elseif (Float64(1.0 / n) <= 5e-153)
    		tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n);
    	elseif (Float64(1.0 / n) <= 5000.0)
    		tmp = t_1;
    	else
    		tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 + 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);
    	t_1 = t_0 / (n * x);
    	tmp = 0.0;
    	if ((1.0 / n) <= -2e-5)
    		tmp = t_1;
    	elseif ((1.0 / n) <= 5e-153)
    		tmp = log(((1.0 + x) / x)) / n;
    	elseif ((1.0 / n) <= 5000.0)
    		tmp = t_1;
    	else
    		tmp = (1.0 + (x * ((1.0 + (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]}, Block[{t$95$1 = N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-5], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-153], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5000.0], t$95$1, N[(N[(1.0 + N[(x * N[(N[(1.0 + N[(0.5 * N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := {x}^{\left(\frac{1}{n}\right)}\\
    t_1 := \frac{t\_0}{n \cdot x}\\
    \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-5}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-153}:\\
    \;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 5000:\\
    \;\;\;\;t\_1\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(1 + x \cdot \frac{1 + 0.5 \cdot \frac{x}{n}}{n}\right) - t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if (/.f64 #s(literal 1 binary64) n) < -2.00000000000000016e-5 or 5.00000000000000033e-153 < (/.f64 #s(literal 1 binary64) n) < 5e3

      1. Initial program 82.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 94.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. mul-1-neg94.3%

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

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

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

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

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

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

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

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

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

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

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

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

      1. Initial program 39.0%

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

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

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

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

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

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

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

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

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

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

      1. Initial program 58.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 63.3%

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

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

        \[\leadsto \left(1 + x \cdot \frac{1 + \color{blue}{0.5 \cdot \frac{x}{n}}}{n}\right) - {x}^{\left(\frac{1}{n}\right)} \]
      6. Step-by-step derivation
        1. *-commutative80.9%

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

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

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

    Alternative 7: 79.9% accurate, 1.5× speedup?

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

      1. Initial program 82.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 94.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. mul-1-neg94.3%

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

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

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

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

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

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

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

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

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

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

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

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

      1. Initial program 39.0%

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

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

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

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

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

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

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

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

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

      if 5e3 < (/.f64 #s(literal 1 binary64) n) < 1e251

      1. Initial program 73.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 71.7%

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

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

      1. Initial program 12.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 8: 79.8% accurate, 1.6× speedup?

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

      1. Initial program 82.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 94.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. mul-1-neg94.3%

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

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

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

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

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

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

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

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

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

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

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

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

      1. Initial program 39.0%

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

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

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

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

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

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

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

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

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

      if 5e3 < (/.f64 #s(literal 1 binary64) n) < 1e251

      1. Initial program 73.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 70.5%

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

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

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

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

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

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

      1. Initial program 12.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 9: 64.9% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+166}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-153}:\\ \;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5000:\\ \;\;\;\;\frac{\frac{1}{x}}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{+251}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{0.5 + \frac{-0.3333333333333333}{x}}{x} + -1}{-x}}{n}\\ \end{array} \end{array} \]
    (FPCore (x n)
     :precision binary64
     (let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
       (if (<= (/ 1.0 n) -1e+166)
         t_0
         (if (<= (/ 1.0 n) 5e-153)
           (/ (log (/ (+ 1.0 x) x)) n)
           (if (<= (/ 1.0 n) 5000.0)
             (/ (/ 1.0 x) n)
             (if (<= (/ 1.0 n) 1e+251)
               t_0
               (/
                (/ (+ (/ (+ 0.5 (/ -0.3333333333333333 x)) x) -1.0) (- x))
                n)))))))
    double code(double x, double n) {
    	double t_0 = 1.0 - pow(x, (1.0 / n));
    	double tmp;
    	if ((1.0 / n) <= -1e+166) {
    		tmp = t_0;
    	} else if ((1.0 / n) <= 5e-153) {
    		tmp = log(((1.0 + x) / x)) / n;
    	} else if ((1.0 / n) <= 5000.0) {
    		tmp = (1.0 / x) / n;
    	} else if ((1.0 / n) <= 1e+251) {
    		tmp = t_0;
    	} else {
    		tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
    	}
    	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 = 1.0d0 - (x ** (1.0d0 / n))
        if ((1.0d0 / n) <= (-1d+166)) then
            tmp = t_0
        else if ((1.0d0 / n) <= 5d-153) then
            tmp = log(((1.0d0 + x) / x)) / n
        else if ((1.0d0 / n) <= 5000.0d0) then
            tmp = (1.0d0 / x) / n
        else if ((1.0d0 / n) <= 1d+251) then
            tmp = t_0
        else
            tmp = ((((0.5d0 + ((-0.3333333333333333d0) / x)) / x) + (-1.0d0)) / -x) / n
        end if
        code = tmp
    end function
    
    public static double code(double x, double n) {
    	double t_0 = 1.0 - Math.pow(x, (1.0 / n));
    	double tmp;
    	if ((1.0 / n) <= -1e+166) {
    		tmp = t_0;
    	} else if ((1.0 / n) <= 5e-153) {
    		tmp = Math.log(((1.0 + x) / x)) / n;
    	} else if ((1.0 / n) <= 5000.0) {
    		tmp = (1.0 / x) / n;
    	} else if ((1.0 / n) <= 1e+251) {
    		tmp = t_0;
    	} else {
    		tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
    	}
    	return tmp;
    }
    
    def code(x, n):
    	t_0 = 1.0 - math.pow(x, (1.0 / n))
    	tmp = 0
    	if (1.0 / n) <= -1e+166:
    		tmp = t_0
    	elif (1.0 / n) <= 5e-153:
    		tmp = math.log(((1.0 + x) / x)) / n
    	elif (1.0 / n) <= 5000.0:
    		tmp = (1.0 / x) / n
    	elif (1.0 / n) <= 1e+251:
    		tmp = t_0
    	else:
    		tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n
    	return tmp
    
    function code(x, n)
    	t_0 = Float64(1.0 - (x ^ Float64(1.0 / n)))
    	tmp = 0.0
    	if (Float64(1.0 / n) <= -1e+166)
    		tmp = t_0;
    	elseif (Float64(1.0 / n) <= 5e-153)
    		tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n);
    	elseif (Float64(1.0 / n) <= 5000.0)
    		tmp = Float64(Float64(1.0 / x) / n);
    	elseif (Float64(1.0 / n) <= 1e+251)
    		tmp = t_0;
    	else
    		tmp = Float64(Float64(Float64(Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x) + -1.0) / Float64(-x)) / n);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, n)
    	t_0 = 1.0 - (x ^ (1.0 / n));
    	tmp = 0.0;
    	if ((1.0 / n) <= -1e+166)
    		tmp = t_0;
    	elseif ((1.0 / n) <= 5e-153)
    		tmp = log(((1.0 + x) / x)) / n;
    	elseif ((1.0 / n) <= 5000.0)
    		tmp = (1.0 / x) / n;
    	elseif ((1.0 / n) <= 1e+251)
    		tmp = t_0;
    	else
    		tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+166], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-153], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5000.0], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+251], t$95$0, N[(N[(N[(N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + -1.0), $MachinePrecision] / (-x)), $MachinePrecision] / n), $MachinePrecision]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
    \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+166}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-153}:\\
    \;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 5000:\\
    \;\;\;\;\frac{\frac{1}{x}}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 10^{+251}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{\frac{0.5 + \frac{-0.3333333333333333}{x}}{x} + -1}{-x}}{n}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if (/.f64 #s(literal 1 binary64) n) < -9.9999999999999994e165 or 5e3 < (/.f64 #s(literal 1 binary64) n) < 1e251

      1. Initial program 88.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 68.1%

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

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

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

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

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

      if -9.9999999999999994e165 < (/.f64 #s(literal 1 binary64) n) < 5.00000000000000033e-153

      1. Initial program 58.9%

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

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

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

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

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

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

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

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

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

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

      1. Initial program 21.1%

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

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

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

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

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

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

      1. Initial program 12.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 10: 55.6% accurate, 1.7× speedup?

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

      1. Initial program 59.9%

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

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

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

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

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

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

      if 1.18e-79 < x < 3.20000000000000003e-34

      1. Initial program 26.7%

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

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

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

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

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

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

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

      if 3.20000000000000003e-34 < x < 3.09999999999999981e97

      1. Initial program 56.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 3.09999999999999981e97 < x

      1. Initial program 79.6%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{0.25 \cdot \frac{1}{x} - 0.3333333333333333}{x} - 0.5}{x} - 1}{x}}}{n} \]
      7. Taylor expanded in x around 0 79.6%

        \[\leadsto \color{blue}{\frac{-0.25}{n \cdot {x}^{4}}} \]
    3. Recombined 4 regimes into one program.
    4. Final simplification63.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.18 \cdot 10^{-79}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-34}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 3.1 \cdot 10^{+97}:\\ \;\;\;\;\frac{\frac{\frac{0.5 + \frac{-0.3333333333333333}{x}}{x} + -1}{-x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.25}{n \cdot {x}^{4}}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 11: 52.4% accurate, 1.9× speedup?

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

      1. Initial program 59.9%

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

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

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

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

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

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

      if 1.59999999999999994e-79 < x < 3.0999999999999998e-34

      1. Initial program 26.7%

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

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

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

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

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

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

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

      if 3.0999999999999998e-34 < x

      1. Initial program 71.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 12: 46.8% accurate, 1.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq 1.1 \cdot 10^{+164}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} + 0.5 \cdot \frac{-1}{n}}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log x}{-n}\\ \end{array} \end{array} \]
    (FPCore (x n)
     :precision binary64
     (if (<= n 1.1e+164)
       (/
        (+
         (/ 1.0 n)
         (/ (+ (* 0.3333333333333333 (/ 1.0 (* n x))) (* 0.5 (/ -1.0 n))) x))
        x)
       (/ (log x) (- n))))
    double code(double x, double n) {
    	double tmp;
    	if (n <= 1.1e+164) {
    		tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (n * x))) + (0.5 * (-1.0 / n))) / x)) / x;
    	} else {
    		tmp = log(x) / -n;
    	}
    	return tmp;
    }
    
    real(8) function code(x, n)
        real(8), intent (in) :: x
        real(8), intent (in) :: n
        real(8) :: tmp
        if (n <= 1.1d+164) then
            tmp = ((1.0d0 / n) + (((0.3333333333333333d0 * (1.0d0 / (n * x))) + (0.5d0 * ((-1.0d0) / n))) / x)) / x
        else
            tmp = log(x) / -n
        end if
        code = tmp
    end function
    
    public static double code(double x, double n) {
    	double tmp;
    	if (n <= 1.1e+164) {
    		tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (n * x))) + (0.5 * (-1.0 / n))) / x)) / x;
    	} else {
    		tmp = Math.log(x) / -n;
    	}
    	return tmp;
    }
    
    def code(x, n):
    	tmp = 0
    	if n <= 1.1e+164:
    		tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (n * x))) + (0.5 * (-1.0 / n))) / x)) / x
    	else:
    		tmp = math.log(x) / -n
    	return tmp
    
    function code(x, n)
    	tmp = 0.0
    	if (n <= 1.1e+164)
    		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / Float64(n * x))) + Float64(0.5 * Float64(-1.0 / n))) / x)) / x);
    	else
    		tmp = Float64(log(x) / Float64(-n));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, n)
    	tmp = 0.0;
    	if (n <= 1.1e+164)
    		tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (n * x))) + (0.5 * (-1.0 / n))) / x)) / x;
    	else
    		tmp = log(x) / -n;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, n_] := If[LessEqual[n, 1.1e+164], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 * N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;n \leq 1.1 \cdot 10^{+164}:\\
    \;\;\;\;\frac{\frac{1}{n} + \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} + 0.5 \cdot \frac{-1}{n}}{x}}{x}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\log x}{-n}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if n < 1.10000000000000003e164

      1. Initial program 65.3%

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

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

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

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

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

      if 1.10000000000000003e164 < n

      1. Initial program 39.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 96.4%

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq 1.1 \cdot 10^{+164}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} + 0.5 \cdot \frac{-1}{n}}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log x}{-n}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 13: 46.5% accurate, 10.0× speedup?

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
    7. Final simplification48.8%

      \[\leadsto \frac{\frac{1}{n} + \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} + 0.5 \cdot \frac{-1}{n}}{x}}{x} \]
    8. Add Preprocessing

    Alternative 14: 46.5% accurate, 15.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{\frac{\frac{-0.3333333333333333}{x} + 0.5}{x} + -1}{-x}}}{n} \]
    11. Final simplification48.8%

      \[\leadsto \frac{\frac{\frac{0.5 + \frac{-0.3333333333333333}{x}}{x} + -1}{-x}}{n} \]
    12. Add Preprocessing

    Alternative 15: 41.0% 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 62.2%

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

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

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

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

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

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

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

    Alternative 16: 40.6% accurate, 42.2× speedup?

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

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

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

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

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

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

    Alternative 17: 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 62.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.4%

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

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

    Reproduce

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