2nthrt (problem 3.4.6)

Percentage Accurate: 53.4% → 86.0%
Time: 58.7s
Alternatives: 13
Speedup: 1.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 13 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.4% 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: 86.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 -5 \cdot 10^{-22}:\\ \;\;\;\;\frac{\frac{t\_0}{n}}{x}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-69}:\\ \;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 200000:\\ \;\;\;\;\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) -5e-22)
     (/ (/ t_0 n) x)
     (if (<= (/ 1.0 n) 2e-69)
       (/ (log (/ (+ 1.0 x) x)) n)
       (if (<= (/ 1.0 n) 200000.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) <= -5e-22) {
		tmp = (t_0 / n) / x;
	} else if ((1.0 / n) <= 2e-69) {
		tmp = log(((1.0 + x) / x)) / n;
	} else if ((1.0 / n) <= 200000.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) <= (-5d-22)) then
        tmp = (t_0 / n) / x
    else if ((1.0d0 / n) <= 2d-69) then
        tmp = log(((1.0d0 + x) / x)) / n
    else if ((1.0d0 / n) <= 200000.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) <= -5e-22) {
		tmp = (t_0 / n) / x;
	} else if ((1.0 / n) <= 2e-69) {
		tmp = Math.log(((1.0 + x) / x)) / n;
	} else if ((1.0 / n) <= 200000.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) <= -5e-22:
		tmp = (t_0 / n) / x
	elif (1.0 / n) <= 2e-69:
		tmp = math.log(((1.0 + x) / x)) / n
	elif (1.0 / n) <= 200000.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) <= -5e-22)
		tmp = Float64(Float64(t_0 / n) / x);
	elseif (Float64(1.0 / n) <= 2e-69)
		tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n);
	elseif (Float64(1.0 / n) <= 200000.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) <= -5e-22)
		tmp = (t_0 / n) / x;
	elseif ((1.0 / n) <= 2e-69)
		tmp = log(((1.0 + x) / x)) / n;
	elseif ((1.0 / n) <= 200000.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], -5e-22], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-69], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 200000.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 -5 \cdot 10^{-22}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\

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

\mathbf{elif}\;\frac{1}{n} \leq 200000:\\
\;\;\;\;\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) < -4.99999999999999954e-22

    1. Initial program 95.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999999999954e-22 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e-69

    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 82.5%

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

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

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

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

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

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

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

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

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

    1. Initial program 10.0%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 45.2%

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

      \[\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^{\color{blue}{\frac{\log x}{n} \cdot 1}} \]
      3. associate-*l/100.0%

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - e^{\color{blue}{\log x \cdot \frac{1}{n}}} \]
      5. 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 simplification88.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-22}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-69}:\\ \;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 200000:\\ \;\;\;\;\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 2: 80.6% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;x \leq 92:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\

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


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

    1. Initial program 38.4%

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

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

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

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

      \[\leadsto \frac{\color{blue}{x - \log x}}{n} \]
    7. Taylor expanded in x around inf 74.3%

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

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

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

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

    if 1.00000000000000001e-35 < x < 3.7e-16

    1. Initial program 68.2%

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{\frac{\frac{1}{x}}{n}}\right)\right) \]
      3. rem-exp-log89.9%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\color{blue}{e^{\log \left(\frac{1}{x}\right)}}}{n}\right)\right) \]
      4. neg-log89.9%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{e^{\color{blue}{-\log x}}}{n}\right)\right) \]
      5. add-sqr-sqrt89.9%

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

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{e^{\color{blue}{\sqrt{\left(-\log x\right) \cdot \left(-\log x\right)}}}}{n}\right)\right) \]
      7. sqr-neg89.9%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{e^{\sqrt{\color{blue}{\log x \cdot \log x}}}}{n}\right)\right) \]
      8. sqrt-prod0.0%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{e^{\color{blue}{\sqrt{\log x} \cdot \sqrt{\log x}}}}{n}\right)\right) \]
      9. add-sqr-sqrt89.9%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{e^{\color{blue}{\log x}}}{n}\right)\right) \]
      10. add-exp-log89.9%

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

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

    if 3.7e-16 < x < 92

    1. Initial program 17.8%

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

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

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

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

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

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

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

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

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

    if 92 < x

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 82.1% accurate, 1.5× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 #s(literal 1 binary64) n) < -4.99999999999999954e-22 or 1.9999999999999999e-69 < (/.f64 #s(literal 1 binary64) n) < 2e5

    1. Initial program 80.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999999999954e-22 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e-69

    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 82.5%

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

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

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

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

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

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

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

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

    if 2e5 < (/.f64 #s(literal 1 binary64) n) < 1.0000000000000001e182

    1. Initial program 60.1%

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

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

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

    1. Initial program 24.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 6.7%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} + \frac{-0.5}{n}}{x}}{x}} \]
    10. Recombined 4 regimes into one program.
    11. Final simplification84.8%

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

    Alternative 4: 82.0% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{\frac{t\_0}{n}}{x}\\ \mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-22}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-69}:\\ \;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 200000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{+170}:\\ \;\;\;\;1 - t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\ \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) -5e-22)
         t_1
         (if (<= (/ 1.0 n) 2e-69)
           (/ (log (/ (+ 1.0 x) x)) n)
           (if (<= (/ 1.0 n) 200000.0)
             t_1
             (if (<= (/ 1.0 n) 1e+170)
               (- 1.0 t_0)
               (/
                (+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x))
                x)))))))
    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) <= -5e-22) {
    		tmp = t_1;
    	} else if ((1.0 / n) <= 2e-69) {
    		tmp = log(((1.0 + x) / x)) / n;
    	} else if ((1.0 / n) <= 200000.0) {
    		tmp = t_1;
    	} else if ((1.0 / n) <= 1e+170) {
    		tmp = 1.0 - t_0;
    	} else {
    		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
    	}
    	return tmp;
    }
    
    real(8) function code(x, n)
        real(8), intent (in) :: x
        real(8), intent (in) :: n
        real(8) :: t_0
        real(8) :: t_1
        real(8) :: tmp
        t_0 = x ** (1.0d0 / n)
        t_1 = (t_0 / n) / x
        if ((1.0d0 / n) <= (-5d-22)) then
            tmp = t_1
        else if ((1.0d0 / n) <= 2d-69) then
            tmp = log(((1.0d0 + x) / x)) / n
        else if ((1.0d0 / n) <= 200000.0d0) then
            tmp = t_1
        else if ((1.0d0 / n) <= 1d+170) then
            tmp = 1.0d0 - t_0
        else
            tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) + ((-0.5d0) / n)) / x)) / x
        end if
        code = tmp
    end function
    
    public static double code(double x, double n) {
    	double t_0 = Math.pow(x, (1.0 / n));
    	double t_1 = (t_0 / n) / x;
    	double tmp;
    	if ((1.0 / n) <= -5e-22) {
    		tmp = t_1;
    	} else if ((1.0 / n) <= 2e-69) {
    		tmp = Math.log(((1.0 + x) / x)) / n;
    	} else if ((1.0 / n) <= 200000.0) {
    		tmp = t_1;
    	} else if ((1.0 / n) <= 1e+170) {
    		tmp = 1.0 - t_0;
    	} else {
    		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
    	}
    	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) <= -5e-22:
    		tmp = t_1
    	elif (1.0 / n) <= 2e-69:
    		tmp = math.log(((1.0 + x) / x)) / n
    	elif (1.0 / n) <= 200000.0:
    		tmp = t_1
    	elif (1.0 / n) <= 1e+170:
    		tmp = 1.0 - t_0
    	else:
    		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x
    	return tmp
    
    function code(x, n)
    	t_0 = x ^ Float64(1.0 / n)
    	t_1 = Float64(Float64(t_0 / n) / x)
    	tmp = 0.0
    	if (Float64(1.0 / n) <= -5e-22)
    		tmp = t_1;
    	elseif (Float64(1.0 / n) <= 2e-69)
    		tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n);
    	elseif (Float64(1.0 / n) <= 200000.0)
    		tmp = t_1;
    	elseif (Float64(1.0 / n) <= 1e+170)
    		tmp = Float64(1.0 - t_0);
    	else
    		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x);
    	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) <= -5e-22)
    		tmp = t_1;
    	elseif ((1.0 / n) <= 2e-69)
    		tmp = log(((1.0 + x) / x)) / n;
    	elseif ((1.0 / n) <= 200000.0)
    		tmp = t_1;
    	elseif ((1.0 / n) <= 1e+170)
    		tmp = 1.0 - t_0;
    	else
    		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-22], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-69], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 200000.0], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+170], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := {x}^{\left(\frac{1}{n}\right)}\\
    t_1 := \frac{\frac{t\_0}{n}}{x}\\
    \mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-22}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-69}:\\
    \;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 200000:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 10^{+170}:\\
    \;\;\;\;1 - t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if (/.f64 #s(literal 1 binary64) n) < -4.99999999999999954e-22 or 1.9999999999999999e-69 < (/.f64 #s(literal 1 binary64) n) < 2e5

      1. Initial program 80.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -4.99999999999999954e-22 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e-69

      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 82.5%

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

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

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

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

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

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

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

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

      if 2e5 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000003e170

      1. Initial program 61.6%

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

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

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

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

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

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

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

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

      1. Initial program 28.8%

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} + \frac{-0.5}{n}}{x}}{x}} \]
      10. Recombined 4 regimes into one program.
      11. Final simplification84.8%

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

      Alternative 5: 79.9% accurate, 1.7× speedup?

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

        1. Initial program 38.4%

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

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

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

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

          \[\leadsto \frac{\color{blue}{x - \log x}}{n} \]
        7. Taylor expanded in x around inf 74.3%

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

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

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

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

        if 1.00000000000000001e-35 < x < 3.50000000000000017e-16

        1. Initial program 68.2%

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

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

        if 3.50000000000000017e-16 < x < 145

        1. Initial program 17.8%

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

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

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

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

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

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

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

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

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

        if 145 < x

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 6: 56.4% accurate, 1.8× speedup?

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

        1. Initial program 36.4%

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

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

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

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

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

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

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

        if 3.0000000000000002e-163 < x < 3.0000000000000002e-119

        1. Initial program 67.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 30.7%

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

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

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

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

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

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

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

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

          if 3.0000000000000002e-119 < x < 0.880000000000000004

          1. Initial program 34.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 57.0%

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

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

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

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

          if 0.880000000000000004 < x

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

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

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

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

            \[\leadsto \frac{\color{blue}{-1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{0.25 \cdot \frac{1}{x} - 0.3333333333333333}{x} - 0.5}{x} - 1}{x}}}{n} \]
        10. Recombined 4 regimes into one program.
        11. Final simplification60.5%

          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 3 \cdot 10^{-163}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-119}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \end{array} \]
        12. Add Preprocessing

        Alternative 7: 56.5% accurate, 1.8× speedup?

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

          1. Initial program 34.4%

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

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

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

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

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

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

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

          if 1.8000000000000002e-170 < x < 5.6999999999999999e-117

          1. Initial program 64.8%

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

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

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

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

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

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

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

          if 5.6999999999999999e-117 < x < 0.900000000000000022

          1. Initial program 34.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 57.9%

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

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

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

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

          if 0.900000000000000022 < x

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

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

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.8 \cdot 10^{-170}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 5.7 \cdot 10^{-117}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.9:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 8: 56.1% accurate, 1.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ \mathbf{if}\;x \leq 1.4 \cdot 10^{-163}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{-119}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.7:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \end{array} \end{array} \]
        (FPCore (x n)
         :precision binary64
         (let* ((t_0 (/ (log x) (- n))))
           (if (<= x 1.4e-163)
             t_0
             (if (<= x 6.5e-119)
               (/ (+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x)) x)
               (if (<= x 0.7)
                 t_0
                 (/
                  (/
                   (+
                    1.0
                    (/ (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5) x))
                   x)
                  n))))))
        double code(double x, double n) {
        	double t_0 = log(x) / -n;
        	double tmp;
        	if (x <= 1.4e-163) {
        		tmp = t_0;
        	} else if (x <= 6.5e-119) {
        		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
        	} else if (x <= 0.7) {
        		tmp = t_0;
        	} else {
        		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
        	}
        	return tmp;
        }
        
        real(8) function code(x, n)
            real(8), intent (in) :: x
            real(8), intent (in) :: n
            real(8) :: t_0
            real(8) :: tmp
            t_0 = log(x) / -n
            if (x <= 1.4d-163) then
                tmp = t_0
            else if (x <= 6.5d-119) then
                tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) + ((-0.5d0) / n)) / x)) / x
            else if (x <= 0.7d0) then
                tmp = t_0
            else
                tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
            end if
            code = tmp
        end function
        
        public static double code(double x, double n) {
        	double t_0 = Math.log(x) / -n;
        	double tmp;
        	if (x <= 1.4e-163) {
        		tmp = t_0;
        	} else if (x <= 6.5e-119) {
        		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
        	} else if (x <= 0.7) {
        		tmp = t_0;
        	} else {
        		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
        	}
        	return tmp;
        }
        
        def code(x, n):
        	t_0 = math.log(x) / -n
        	tmp = 0
        	if x <= 1.4e-163:
        		tmp = t_0
        	elif x <= 6.5e-119:
        		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x
        	elif x <= 0.7:
        		tmp = t_0
        	else:
        		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n
        	return tmp
        
        function code(x, n)
        	t_0 = Float64(log(x) / Float64(-n))
        	tmp = 0.0
        	if (x <= 1.4e-163)
        		tmp = t_0;
        	elseif (x <= 6.5e-119)
        		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x);
        	elseif (x <= 0.7)
        		tmp = t_0;
        	else
        		tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, n)
        	t_0 = log(x) / -n;
        	tmp = 0.0;
        	if (x <= 1.4e-163)
        		tmp = t_0;
        	elseif (x <= 6.5e-119)
        		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
        	elseif (x <= 0.7)
        		tmp = t_0;
        	else
        		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 1.4e-163], t$95$0, If[LessEqual[x, 6.5e-119], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.7], t$95$0, N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \frac{\log x}{-n}\\
        \mathbf{if}\;x \leq 1.4 \cdot 10^{-163}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;x \leq 6.5 \cdot 10^{-119}:\\
        \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\
        
        \mathbf{elif}\;x \leq 0.7:\\
        \;\;\;\;t\_0\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if x < 1.4e-163 or 6.5e-119 < x < 0.69999999999999996

          1. Initial program 35.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 60.7%

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

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

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

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

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

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

          if 1.4e-163 < x < 6.5e-119

          1. Initial program 67.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 30.7%

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

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

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

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

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

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

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

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

            if 0.69999999999999996 < x

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

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

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

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

              \[\leadsto \frac{\color{blue}{-1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{0.25 \cdot \frac{1}{x} - 0.3333333333333333}{x} - 0.5}{x} - 1}{x}}}{n} \]
          10. Recombined 3 regimes into one program.
          11. Final simplification60.0%

            \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.4 \cdot 10^{-163}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{-119}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.7:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \end{array} \]
          12. Add Preprocessing

          Alternative 9: 61.9% accurate, 1.8× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -9.6 \cdot 10^{-231} \lor \neg \left(n \leq 2.5 \cdot 10^{+67}\right):\\ \;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\ \end{array} \end{array} \]
          (FPCore (x n)
           :precision binary64
           (if (or (<= n -9.6e-231) (not (<= n 2.5e+67)))
             (/ (log (/ (+ 1.0 x) x)) n)
             (/ (+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x)) x)))
          double code(double x, double n) {
          	double tmp;
          	if ((n <= -9.6e-231) || !(n <= 2.5e+67)) {
          		tmp = log(((1.0 + x) / x)) / n;
          	} else {
          		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
          	}
          	return tmp;
          }
          
          real(8) function code(x, n)
              real(8), intent (in) :: x
              real(8), intent (in) :: n
              real(8) :: tmp
              if ((n <= (-9.6d-231)) .or. (.not. (n <= 2.5d+67))) then
                  tmp = log(((1.0d0 + x) / x)) / n
              else
                  tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) + ((-0.5d0) / n)) / x)) / x
              end if
              code = tmp
          end function
          
          public static double code(double x, double n) {
          	double tmp;
          	if ((n <= -9.6e-231) || !(n <= 2.5e+67)) {
          		tmp = Math.log(((1.0 + x) / x)) / n;
          	} else {
          		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
          	}
          	return tmp;
          }
          
          def code(x, n):
          	tmp = 0
          	if (n <= -9.6e-231) or not (n <= 2.5e+67):
          		tmp = math.log(((1.0 + x) / x)) / n
          	else:
          		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x
          	return tmp
          
          function code(x, n)
          	tmp = 0.0
          	if ((n <= -9.6e-231) || !(n <= 2.5e+67))
          		tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n);
          	else
          		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x);
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, n)
          	tmp = 0.0;
          	if ((n <= -9.6e-231) || ~((n <= 2.5e+67)))
          		tmp = log(((1.0 + x) / x)) / n;
          	else
          		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, n_] := If[Or[LessEqual[n, -9.6e-231], N[Not[LessEqual[n, 2.5e+67]], $MachinePrecision]], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;n \leq -9.6 \cdot 10^{-231} \lor \neg \left(n \leq 2.5 \cdot 10^{+67}\right):\\
          \;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if n < -9.59999999999999967e-231 or 2.49999999999999988e67 < n

            1. Initial program 50.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 73.6%

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

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

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

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

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

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

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

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

            if -9.59999999999999967e-231 < n < 2.49999999999999988e67

            1. Initial program 52.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 23.2%

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} + \frac{-0.5}{n}}{x}}{x}} \]
            10. Recombined 2 regimes into one program.
            11. Final simplification68.5%

              \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -9.6 \cdot 10^{-231} \lor \neg \left(n \leq 2.5 \cdot 10^{+67}\right):\\ \;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\ \end{array} \]
            12. Add Preprocessing

            Alternative 10: 46.5% accurate, 12.4× speedup?

            \[\begin{array}{l} \\ \frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x} \end{array} \]
            (FPCore (x n)
             :precision binary64
             (/ (+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x)) x))
            double code(double x, double n) {
            	return ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / 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 / (n * x)) + ((-0.5d0) / n)) / x)) / x
            end function
            
            public static double code(double x, double n) {
            	return ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
            }
            
            def code(x, n):
            	return ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x
            
            function code(x, n)
            	return Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x)
            end
            
            function tmp = code(x, n)
            	tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
            end
            
            code[x_, n_] := N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            \frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}
            \end{array}
            
            Derivation
            1. Initial program 50.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 61.4%

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} + \frac{-0.5}{n}}{x}}{x}} \]
              2. Final simplification44.0%

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

              Alternative 11: 39.7% 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 50.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 61.4%

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

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

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

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

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

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

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

              Alternative 12: 40.2% 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 50.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 61.4%

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

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

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

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

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

                \[\leadsto \color{blue}{\frac{1}{x \cdot n}} \]
              9. Taylor expanded in x around 0 36.9%

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

                  \[\leadsto \color{blue}{\frac{\frac{1}{n}}{x}} \]
              11. Simplified37.4%

                \[\leadsto \color{blue}{\frac{\frac{1}{n}}{x}} \]
              12. Final simplification37.4%

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

              Alternative 13: 4.6% accurate, 70.3× speedup?

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

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

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

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

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

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

                \[\leadsto \color{blue}{\frac{1}{x \cdot n}} \]
              9. Step-by-step derivation
                1. *-un-lft-identity36.9%

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

                  \[\leadsto 1 \cdot \color{blue}{\frac{\frac{1}{x}}{n}} \]
                3. rem-exp-log36.3%

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

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

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

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

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

                  \[\leadsto 1 \cdot \frac{e^{\color{blue}{\sqrt{\log x} \cdot \sqrt{\log x}}}}{n} \]
                9. add-sqr-sqrt4.6%

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

                  \[\leadsto 1 \cdot \frac{\color{blue}{x}}{n} \]
              10. Applied egg-rr4.6%

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

                  \[\leadsto \color{blue}{\frac{x}{n}} \]
              12. Simplified4.6%

                \[\leadsto \color{blue}{\frac{x}{n}} \]
              13. Final simplification4.6%

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

              Reproduce

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