2nthrt (problem 3.4.6)

Percentage Accurate: 52.4% → 85.9%
Time: 20.9s
Alternatives: 19
Speedup: 2.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 19 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 52.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: 85.9% accurate, 0.3× speedup?

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

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

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

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


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

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2e-14 < (/.f64 1 n) < 4.0000000000000003e-18

    1. Initial program 30.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.0000000000000003e-18 < (/.f64 1 n)

    1. Initial program 53.0%

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

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

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

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

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

Alternative 2: 85.9% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2e-14 < (/.f64 1 n) < 4.0000000000000003e-18

    1. Initial program 30.7%

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

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

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

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

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

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

    if 4.0000000000000003e-18 < (/.f64 1 n)

    1. Initial program 53.0%

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

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

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

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

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

Alternative 3: 86.0% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 30.3%

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

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

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

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

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

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

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

    1. Initial program 55.9%

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

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

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

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

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

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

Alternative 4: 80.7% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 30.3%

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

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

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

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

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

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

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

    1. Initial program 55.9%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 65.5% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;n \leq -4.2 \cdot 10^{+112}:\\
\;\;\;\;\frac{\frac{1}{x} + \left(\frac{0.3333333333333333}{{x}^{3}} + \frac{-0.5}{x \cdot x}\right)}{n}\\

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

\mathbf{elif}\;n \leq -5 \cdot 10^{-309}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\

\mathbf{elif}\;n \leq 8800000:\\
\;\;\;\;\left(\left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}\right) \cdot \left(x \cdot x\right) + \left(1 + \frac{x}{n}\right)\right) - t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\log x}{n \cdot n}}{x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if n < -4.1999999999999998e112

    1. Initial program 42.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.1999999999999998e112 < n < -9.8e13

    1. Initial program 9.5%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{n} - \frac{\log x}{n}} \]
      3. div-sub64.5%

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

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

    if -9.8e13 < n < -4.9999999999999995e-309

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999995e-309 < n < 8.8e6

    1. Initial program 55.9%

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

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

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

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

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

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

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

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

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

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

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

    if 8.8e6 < n

    1. Initial program 34.0%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right) - \log x}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right)} \]
    5. Taylor expanded in x around inf 55.6%

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

        \[\leadsto \frac{\frac{1}{n} + \color{blue}{\left(-\frac{\log \left(\frac{1}{x}\right)}{{n}^{2}}\right)}}{x} \]
      2. distribute-neg-frac55.6%

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

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

        \[\leadsto \frac{\frac{1}{n} + \frac{\color{blue}{\log x}}{{n}^{2}}}{x} \]
      5. unpow255.6%

        \[\leadsto \frac{\frac{1}{n} + \frac{\log x}{\color{blue}{n \cdot n}}}{x} \]
    7. Simplified55.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4.2 \cdot 10^{+112}:\\ \;\;\;\;\frac{\frac{1}{x} + \left(\frac{0.3333333333333333}{{x}^{3}} + \frac{-0.5}{x \cdot x}\right)}{n}\\ \mathbf{elif}\;n \leq -98000000000000:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;n \leq -5 \cdot 10^{-309}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\ \mathbf{elif}\;n \leq 8800000:\\ \;\;\;\;\left(\left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}\right) \cdot \left(x \cdot x\right) + \left(1 + \frac{x}{n}\right)\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\log x}{n \cdot n}}{x}\\ \end{array} \]

Alternative 6: 66.9% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{1}{n \cdot x}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;n \leq -2.9 \cdot 10^{+112}:\\
\;\;\;\;\frac{\frac{1}{x} + \left(\frac{0.3333333333333333}{{x}^{3}} + \frac{-0.5}{x \cdot x}\right)}{n}\\

\mathbf{elif}\;n \leq -4.4 \cdot 10^{+14}:\\
\;\;\;\;\frac{x - \log x}{n}\\

\mathbf{elif}\;n \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\

\mathbf{elif}\;n \leq 2.4 \cdot 10^{-100}:\\
\;\;\;\;\sqrt[3]{t_0 \cdot \left(t_0 \cdot t_0\right)}\\

\mathbf{elif}\;n \leq 13500000:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_1\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\log x}{n \cdot n}}{x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if n < -2.9000000000000002e112

    1. Initial program 42.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.9000000000000002e112 < n < -4.4e14

    1. Initial program 9.5%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{n} - \frac{\log x}{n}} \]
      3. div-sub64.5%

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

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

    if -4.4e14 < n < -9.999999999999969e-311

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < n < 2.4000000000000003e-100

    1. Initial program 36.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right) - \log x}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right)} \]
    5. Taylor expanded in x around inf 0.2%

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

        \[\leadsto \frac{\frac{1}{n} + \color{blue}{\left(-\frac{\log \left(\frac{1}{x}\right)}{{n}^{2}}\right)}}{x} \]
      2. distribute-neg-frac0.2%

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

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

        \[\leadsto \frac{\frac{1}{n} + \frac{\color{blue}{\log x}}{{n}^{2}}}{x} \]
      5. unpow20.2%

        \[\leadsto \frac{\frac{1}{n} + \frac{\log x}{\color{blue}{n \cdot n}}}{x} \]
    7. Simplified0.2%

      \[\leadsto \color{blue}{\frac{\frac{1}{n} + \frac{\log x}{n \cdot n}}{x}} \]
    8. Taylor expanded in n around inf 37.9%

      \[\leadsto \frac{\color{blue}{\frac{1}{n}}}{x} \]
    9. Step-by-step derivation
      1. associate-/l/37.9%

        \[\leadsto \color{blue}{\frac{1}{x \cdot n}} \]
      2. add-cbrt-cube70.5%

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

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

    if 2.4000000000000003e-100 < n < 1.35e7

    1. Initial program 100.0%

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

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

    if 1.35e7 < n

    1. Initial program 34.0%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right) - \log x}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right)} \]
    5. Taylor expanded in x around inf 55.6%

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

        \[\leadsto \frac{\frac{1}{n} + \color{blue}{\left(-\frac{\log \left(\frac{1}{x}\right)}{{n}^{2}}\right)}}{x} \]
      2. distribute-neg-frac55.6%

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

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

        \[\leadsto \frac{\frac{1}{n} + \frac{\color{blue}{\log x}}{{n}^{2}}}{x} \]
      5. unpow255.6%

        \[\leadsto \frac{\frac{1}{n} + \frac{\log x}{\color{blue}{n \cdot n}}}{x} \]
    7. Simplified55.6%

      \[\leadsto \color{blue}{\frac{\frac{1}{n} + \frac{\log x}{n \cdot n}}{x}} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification75.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.9 \cdot 10^{+112}:\\ \;\;\;\;\frac{\frac{1}{x} + \left(\frac{0.3333333333333333}{{x}^{3}} + \frac{-0.5}{x \cdot x}\right)}{n}\\ \mathbf{elif}\;n \leq -4.4 \cdot 10^{+14}:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;n \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\ \mathbf{elif}\;n \leq 2.4 \cdot 10^{-100}:\\ \;\;\;\;\sqrt[3]{\frac{1}{n \cdot x} \cdot \left(\frac{1}{n \cdot x} \cdot \frac{1}{n \cdot x}\right)}\\ \mathbf{elif}\;n \leq 13500000:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\log x}{n \cdot n}}{x}\\ \end{array} \]

Alternative 7: 65.5% accurate, 1.7× speedup?

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

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

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

\mathbf{elif}\;n \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\

\mathbf{elif}\;n \leq 3.1 \cdot 10^{-227}:\\
\;\;\;\;\frac{1}{n \cdot x}\\

\mathbf{elif}\;n \leq 1850000:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\log x}{n \cdot n}}{x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if n < -7.99999999999999985e150

    1. Initial program 47.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x}}{n} - \frac{\color{blue}{0.5 \cdot \frac{1}{{x}^{2}}}}{n} \]
      7. div-sub70.5%

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

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

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

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

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

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

    if -7.99999999999999985e150 < n < -6.8e13

    1. Initial program 11.3%

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

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

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

        \[\leadsto \frac{\color{blue}{\log \left(1 + x\right)} - \log x}{n} \]
      3. log1p-def70.8%

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{n} - \frac{\log x}{n}} \]
      3. div-sub62.4%

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

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

    if -6.8e13 < n < -9.999999999999969e-311

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < n < 3.09999999999999979e-227

    1. Initial program 3.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.09999999999999979e-227 < n < 1.85e6

    1. Initial program 70.1%

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

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

    if 1.85e6 < n

    1. Initial program 34.0%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right) - \log x}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right)} \]
    5. Taylor expanded in x around inf 55.6%

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

        \[\leadsto \frac{\frac{1}{n} + \color{blue}{\left(-\frac{\log \left(\frac{1}{x}\right)}{{n}^{2}}\right)}}{x} \]
      2. distribute-neg-frac55.6%

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

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

        \[\leadsto \frac{\frac{1}{n} + \frac{\color{blue}{\log x}}{{n}^{2}}}{x} \]
      5. unpow255.6%

        \[\leadsto \frac{\frac{1}{n} + \frac{\log x}{\color{blue}{n \cdot n}}}{x} \]
    7. Simplified55.6%

      \[\leadsto \color{blue}{\frac{\frac{1}{n} + \frac{\log x}{n \cdot n}}{x}} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification74.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -8 \cdot 10^{+150}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\ \mathbf{elif}\;n \leq -68000000000000:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;n \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\ \mathbf{elif}\;n \leq 3.1 \cdot 10^{-227}:\\ \;\;\;\;\frac{1}{n \cdot x}\\ \mathbf{elif}\;n \leq 1850000:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\log x}{n \cdot n}}{x}\\ \end{array} \]

Alternative 8: 65.7% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;n \leq -9.5 \cdot 10^{+106}:\\
\;\;\;\;\frac{\frac{1}{x} + \left(\frac{0.3333333333333333}{{x}^{3}} + \frac{-0.5}{x \cdot x}\right)}{n}\\

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

\mathbf{elif}\;n \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\

\mathbf{elif}\;n \leq 1.15 \cdot 10^{-228}:\\
\;\;\;\;\frac{1}{n \cdot x}\\

\mathbf{elif}\;n \leq 13500000:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\log x}{n \cdot n}}{x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if n < -9.4999999999999995e106

    1. Initial program 42.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.4999999999999995e106 < n < -6.8e13

    1. Initial program 9.5%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{n} - \frac{\log x}{n}} \]
      3. div-sub64.5%

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

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

    if -6.8e13 < n < -9.999999999999969e-311

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < n < 1.1499999999999999e-228

    1. Initial program 3.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.1499999999999999e-228 < n < 1.35e7

    1. Initial program 70.1%

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

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

    if 1.35e7 < n

    1. Initial program 34.0%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right) - \log x}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right)} \]
    5. Taylor expanded in x around inf 55.6%

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

        \[\leadsto \frac{\frac{1}{n} + \color{blue}{\left(-\frac{\log \left(\frac{1}{x}\right)}{{n}^{2}}\right)}}{x} \]
      2. distribute-neg-frac55.6%

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

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

        \[\leadsto \frac{\frac{1}{n} + \frac{\color{blue}{\log x}}{{n}^{2}}}{x} \]
      5. unpow255.6%

        \[\leadsto \frac{\frac{1}{n} + \frac{\log x}{\color{blue}{n \cdot n}}}{x} \]
    7. Simplified55.6%

      \[\leadsto \color{blue}{\frac{\frac{1}{n} + \frac{\log x}{n \cdot n}}{x}} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification74.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -9.5 \cdot 10^{+106}:\\ \;\;\;\;\frac{\frac{1}{x} + \left(\frac{0.3333333333333333}{{x}^{3}} + \frac{-0.5}{x \cdot x}\right)}{n}\\ \mathbf{elif}\;n \leq -68000000000000:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;n \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\ \mathbf{elif}\;n \leq 1.15 \cdot 10^{-228}:\\ \;\;\;\;\frac{1}{n \cdot x}\\ \mathbf{elif}\;n \leq 13500000:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\log x}{n \cdot n}}{x}\\ \end{array} \]

Alternative 9: 60.0% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{-\log x}{n}\\ \mathbf{if}\;x \leq 6 \cdot 10^{-296}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 3.35 \cdot 10^{-248}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.1 \cdot 10^{-233}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{-190}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.9 \cdot 10^{-156}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 0.98:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{+136}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.25}{n}}{{x}^{4}}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (- (log x)) n)))
   (if (<= x 6e-296)
     t_0
     (if (<= x 3.35e-248)
       t_1
       (if (<= x 5.1e-233)
         t_0
         (if (<= x 1.8e-190)
           t_1
           (if (<= x 4.9e-156)
             t_0
             (if (<= x 0.98)
               (/ (- x (log x)) n)
               (if (<= x 2.7e+136)
                 (/ (- (/ 1.0 x) (/ (/ 0.5 x) x)) n)
                 (/ (/ -0.25 n) (pow x 4.0)))))))))))
double code(double x, double n) {
	double t_0 = 1.0 - pow(x, (1.0 / n));
	double t_1 = -log(x) / n;
	double tmp;
	if (x <= 6e-296) {
		tmp = t_0;
	} else if (x <= 3.35e-248) {
		tmp = t_1;
	} else if (x <= 5.1e-233) {
		tmp = t_0;
	} else if (x <= 1.8e-190) {
		tmp = t_1;
	} else if (x <= 4.9e-156) {
		tmp = t_0;
	} else if (x <= 0.98) {
		tmp = (x - log(x)) / n;
	} else if (x <= 2.7e+136) {
		tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
	} else {
		tmp = (-0.25 / n) / pow(x, 4.0);
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 1.0d0 - (x ** (1.0d0 / n))
    t_1 = -log(x) / n
    if (x <= 6d-296) then
        tmp = t_0
    else if (x <= 3.35d-248) then
        tmp = t_1
    else if (x <= 5.1d-233) then
        tmp = t_0
    else if (x <= 1.8d-190) then
        tmp = t_1
    else if (x <= 4.9d-156) then
        tmp = t_0
    else if (x <= 0.98d0) then
        tmp = (x - log(x)) / n
    else if (x <= 2.7d+136) then
        tmp = ((1.0d0 / x) - ((0.5d0 / x) / x)) / n
    else
        tmp = ((-0.25d0) / n) / (x ** 4.0d0)
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double t_0 = 1.0 - Math.pow(x, (1.0 / n));
	double t_1 = -Math.log(x) / n;
	double tmp;
	if (x <= 6e-296) {
		tmp = t_0;
	} else if (x <= 3.35e-248) {
		tmp = t_1;
	} else if (x <= 5.1e-233) {
		tmp = t_0;
	} else if (x <= 1.8e-190) {
		tmp = t_1;
	} else if (x <= 4.9e-156) {
		tmp = t_0;
	} else if (x <= 0.98) {
		tmp = (x - Math.log(x)) / n;
	} else if (x <= 2.7e+136) {
		tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
	} else {
		tmp = (-0.25 / n) / Math.pow(x, 4.0);
	}
	return tmp;
}
def code(x, n):
	t_0 = 1.0 - math.pow(x, (1.0 / n))
	t_1 = -math.log(x) / n
	tmp = 0
	if x <= 6e-296:
		tmp = t_0
	elif x <= 3.35e-248:
		tmp = t_1
	elif x <= 5.1e-233:
		tmp = t_0
	elif x <= 1.8e-190:
		tmp = t_1
	elif x <= 4.9e-156:
		tmp = t_0
	elif x <= 0.98:
		tmp = (x - math.log(x)) / n
	elif x <= 2.7e+136:
		tmp = ((1.0 / x) - ((0.5 / x) / x)) / n
	else:
		tmp = (-0.25 / n) / math.pow(x, 4.0)
	return tmp
function code(x, n)
	t_0 = Float64(1.0 - (x ^ Float64(1.0 / n)))
	t_1 = Float64(Float64(-log(x)) / n)
	tmp = 0.0
	if (x <= 6e-296)
		tmp = t_0;
	elseif (x <= 3.35e-248)
		tmp = t_1;
	elseif (x <= 5.1e-233)
		tmp = t_0;
	elseif (x <= 1.8e-190)
		tmp = t_1;
	elseif (x <= 4.9e-156)
		tmp = t_0;
	elseif (x <= 0.98)
		tmp = Float64(Float64(x - log(x)) / n);
	elseif (x <= 2.7e+136)
		tmp = Float64(Float64(Float64(1.0 / x) - Float64(Float64(0.5 / x) / x)) / n);
	else
		tmp = Float64(Float64(-0.25 / n) / (x ^ 4.0));
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = 1.0 - (x ^ (1.0 / n));
	t_1 = -log(x) / n;
	tmp = 0.0;
	if (x <= 6e-296)
		tmp = t_0;
	elseif (x <= 3.35e-248)
		tmp = t_1;
	elseif (x <= 5.1e-233)
		tmp = t_0;
	elseif (x <= 1.8e-190)
		tmp = t_1;
	elseif (x <= 4.9e-156)
		tmp = t_0;
	elseif (x <= 0.98)
		tmp = (x - log(x)) / n;
	elseif (x <= 2.7e+136)
		tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
	else
		tmp = (-0.25 / n) / (x ^ 4.0);
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 6e-296], t$95$0, If[LessEqual[x, 3.35e-248], t$95$1, If[LessEqual[x, 5.1e-233], t$95$0, If[LessEqual[x, 1.8e-190], t$95$1, If[LessEqual[x, 4.9e-156], t$95$0, If[LessEqual[x, 0.98], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 2.7e+136], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(N[(0.5 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(-0.25 / n), $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 3.35 \cdot 10^{-248}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 5.1 \cdot 10^{-233}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 1.8 \cdot 10^{-190}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 4.9 \cdot 10^{-156}:\\
\;\;\;\;t_0\\

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\frac{-0.25}{n}}{{x}^{4}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < 5.9999999999999995e-296 or 3.35e-248 < x < 5.1000000000000003e-233 or 1.80000000000000003e-190 < x < 4.89999999999999951e-156

    1. Initial program 81.0%

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

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

    if 5.9999999999999995e-296 < x < 3.35e-248 or 5.1000000000000003e-233 < x < 1.80000000000000003e-190

    1. Initial program 36.3%

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

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

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

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

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

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

    if 4.89999999999999951e-156 < x < 0.97999999999999998

    1. Initial program 37.5%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{n} - \frac{\log x}{n}} \]
      3. div-sub47.9%

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

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

    if 0.97999999999999998 < x < 2.7000000000000002e136

    1. Initial program 40.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x}}{n} - \frac{\color{blue}{0.5}}{n \cdot {x}^{2}} \]
      4. associate-/l/70.4%

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

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

        \[\leadsto \frac{\frac{1}{x}}{n} - \frac{\color{blue}{0.5 \cdot \frac{1}{{x}^{2}}}}{n} \]
      7. div-sub70.5%

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

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

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

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

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

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

    if 2.7000000000000002e136 < x

    1. Initial program 90.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right) - \log x}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right)} \]
    5. Taylor expanded in x around inf 66.1%

      \[\leadsto \mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\color{blue}{\left(0.3333333333333333 \cdot \frac{1}{{x}^{3}} + \frac{1}{x}\right) - \left(0.25 \cdot \frac{1}{{x}^{4}} + 0.5 \cdot \frac{1}{{x}^{2}}\right)}}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right) \]
    6. Step-by-step derivation
      1. +-commutative66.1%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\left(\frac{1}{x} + \frac{0.3333333333333333}{{x}^{3}}\right) - \left(\color{blue}{\frac{0.5 \cdot 1}{{x}^{2}}} + 0.25 \cdot \frac{1}{{x}^{4}}\right)}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right) \]
      6. metadata-eval66.1%

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

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

        \[\leadsto \mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\left(\frac{1}{x} + \frac{0.3333333333333333}{{x}^{3}}\right) - \left(\frac{0.5}{x \cdot x} + \color{blue}{\frac{0.25 \cdot 1}{{x}^{4}}}\right)}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right) \]
      9. metadata-eval66.1%

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

      \[\leadsto \mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\color{blue}{\left(\frac{1}{x} + \frac{0.3333333333333333}{{x}^{3}}\right) - \left(\frac{0.5}{x \cdot x} + \frac{0.25}{{x}^{4}}\right)}}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right) \]
    8. Taylor expanded in x around 0 90.8%

      \[\leadsto \color{blue}{\frac{-0.25}{n \cdot {x}^{4}}} \]
    9. Step-by-step derivation
      1. associate-/r*90.8%

        \[\leadsto \color{blue}{\frac{\frac{-0.25}{n}}{{x}^{4}}} \]
    10. Simplified90.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 6 \cdot 10^{-296}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 3.35 \cdot 10^{-248}:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{elif}\;x \leq 5.1 \cdot 10^{-233}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{-190}:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{elif}\;x \leq 4.9 \cdot 10^{-156}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.98:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{+136}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.25}{n}}{{x}^{4}}\\ \end{array} \]

Alternative 10: 59.9% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{-\log x}{n}\\ \mathbf{if}\;x \leq 4.7 \cdot 10^{-296}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{-250}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.05 \cdot 10^{-233}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-190}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 6.6 \cdot 10^{-156}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 0.94:\\ \;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{+136}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.25}{n}}{{x}^{4}}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (- (log x)) n)))
   (if (<= x 4.7e-296)
     t_0
     (if (<= x 8.2e-250)
       t_1
       (if (<= x 3.05e-233)
         t_0
         (if (<= x 1.6e-190)
           t_1
           (if (<= x 6.6e-156)
             t_0
             (if (<= x 0.94)
               (- (/ x n) (/ (log x) n))
               (if (<= x 2.7e+136)
                 (/ (- (/ 1.0 x) (/ (/ 0.5 x) x)) n)
                 (/ (/ -0.25 n) (pow x 4.0)))))))))))
double code(double x, double n) {
	double t_0 = 1.0 - pow(x, (1.0 / n));
	double t_1 = -log(x) / n;
	double tmp;
	if (x <= 4.7e-296) {
		tmp = t_0;
	} else if (x <= 8.2e-250) {
		tmp = t_1;
	} else if (x <= 3.05e-233) {
		tmp = t_0;
	} else if (x <= 1.6e-190) {
		tmp = t_1;
	} else if (x <= 6.6e-156) {
		tmp = t_0;
	} else if (x <= 0.94) {
		tmp = (x / n) - (log(x) / n);
	} else if (x <= 2.7e+136) {
		tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
	} else {
		tmp = (-0.25 / n) / pow(x, 4.0);
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 1.0d0 - (x ** (1.0d0 / n))
    t_1 = -log(x) / n
    if (x <= 4.7d-296) then
        tmp = t_0
    else if (x <= 8.2d-250) then
        tmp = t_1
    else if (x <= 3.05d-233) then
        tmp = t_0
    else if (x <= 1.6d-190) then
        tmp = t_1
    else if (x <= 6.6d-156) then
        tmp = t_0
    else if (x <= 0.94d0) then
        tmp = (x / n) - (log(x) / n)
    else if (x <= 2.7d+136) then
        tmp = ((1.0d0 / x) - ((0.5d0 / x) / x)) / n
    else
        tmp = ((-0.25d0) / n) / (x ** 4.0d0)
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double t_0 = 1.0 - Math.pow(x, (1.0 / n));
	double t_1 = -Math.log(x) / n;
	double tmp;
	if (x <= 4.7e-296) {
		tmp = t_0;
	} else if (x <= 8.2e-250) {
		tmp = t_1;
	} else if (x <= 3.05e-233) {
		tmp = t_0;
	} else if (x <= 1.6e-190) {
		tmp = t_1;
	} else if (x <= 6.6e-156) {
		tmp = t_0;
	} else if (x <= 0.94) {
		tmp = (x / n) - (Math.log(x) / n);
	} else if (x <= 2.7e+136) {
		tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
	} else {
		tmp = (-0.25 / n) / Math.pow(x, 4.0);
	}
	return tmp;
}
def code(x, n):
	t_0 = 1.0 - math.pow(x, (1.0 / n))
	t_1 = -math.log(x) / n
	tmp = 0
	if x <= 4.7e-296:
		tmp = t_0
	elif x <= 8.2e-250:
		tmp = t_1
	elif x <= 3.05e-233:
		tmp = t_0
	elif x <= 1.6e-190:
		tmp = t_1
	elif x <= 6.6e-156:
		tmp = t_0
	elif x <= 0.94:
		tmp = (x / n) - (math.log(x) / n)
	elif x <= 2.7e+136:
		tmp = ((1.0 / x) - ((0.5 / x) / x)) / n
	else:
		tmp = (-0.25 / n) / math.pow(x, 4.0)
	return tmp
function code(x, n)
	t_0 = Float64(1.0 - (x ^ Float64(1.0 / n)))
	t_1 = Float64(Float64(-log(x)) / n)
	tmp = 0.0
	if (x <= 4.7e-296)
		tmp = t_0;
	elseif (x <= 8.2e-250)
		tmp = t_1;
	elseif (x <= 3.05e-233)
		tmp = t_0;
	elseif (x <= 1.6e-190)
		tmp = t_1;
	elseif (x <= 6.6e-156)
		tmp = t_0;
	elseif (x <= 0.94)
		tmp = Float64(Float64(x / n) - Float64(log(x) / n));
	elseif (x <= 2.7e+136)
		tmp = Float64(Float64(Float64(1.0 / x) - Float64(Float64(0.5 / x) / x)) / n);
	else
		tmp = Float64(Float64(-0.25 / n) / (x ^ 4.0));
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = 1.0 - (x ^ (1.0 / n));
	t_1 = -log(x) / n;
	tmp = 0.0;
	if (x <= 4.7e-296)
		tmp = t_0;
	elseif (x <= 8.2e-250)
		tmp = t_1;
	elseif (x <= 3.05e-233)
		tmp = t_0;
	elseif (x <= 1.6e-190)
		tmp = t_1;
	elseif (x <= 6.6e-156)
		tmp = t_0;
	elseif (x <= 0.94)
		tmp = (x / n) - (log(x) / n);
	elseif (x <= 2.7e+136)
		tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
	else
		tmp = (-0.25 / n) / (x ^ 4.0);
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 4.7e-296], t$95$0, If[LessEqual[x, 8.2e-250], t$95$1, If[LessEqual[x, 3.05e-233], t$95$0, If[LessEqual[x, 1.6e-190], t$95$1, If[LessEqual[x, 6.6e-156], t$95$0, If[LessEqual[x, 0.94], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.7e+136], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(N[(0.5 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(-0.25 / n), $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 8.2 \cdot 10^{-250}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 3.05 \cdot 10^{-233}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 1.6 \cdot 10^{-190}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 6.6 \cdot 10^{-156}:\\
\;\;\;\;t_0\\

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\frac{-0.25}{n}}{{x}^{4}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < 4.7e-296 or 8.20000000000000032e-250 < x < 3.0500000000000001e-233 or 1.6e-190 < x < 6.5999999999999997e-156

    1. Initial program 81.0%

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

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

    if 4.7e-296 < x < 8.20000000000000032e-250 or 3.0500000000000001e-233 < x < 1.6e-190

    1. Initial program 36.3%

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

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

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

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

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

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

    if 6.5999999999999997e-156 < x < 0.93999999999999995

    1. Initial program 37.5%

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{n} + \color{blue}{\frac{-1 \cdot \log x}{n}} \]
      2. mul-1-neg47.9%

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

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

    if 0.93999999999999995 < x < 2.7000000000000002e136

    1. Initial program 40.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x}}{n} - \frac{\color{blue}{0.5}}{n \cdot {x}^{2}} \]
      4. associate-/l/70.4%

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

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

        \[\leadsto \frac{\frac{1}{x}}{n} - \frac{\color{blue}{0.5 \cdot \frac{1}{{x}^{2}}}}{n} \]
      7. div-sub70.5%

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

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

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

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

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

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

    if 2.7000000000000002e136 < x

    1. Initial program 90.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right) - \log x}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right)} \]
    5. Taylor expanded in x around inf 66.1%

      \[\leadsto \mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\color{blue}{\left(0.3333333333333333 \cdot \frac{1}{{x}^{3}} + \frac{1}{x}\right) - \left(0.25 \cdot \frac{1}{{x}^{4}} + 0.5 \cdot \frac{1}{{x}^{2}}\right)}}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right) \]
    6. Step-by-step derivation
      1. +-commutative66.1%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\left(\frac{1}{x} + \frac{0.3333333333333333}{{x}^{3}}\right) - \left(\color{blue}{\frac{0.5 \cdot 1}{{x}^{2}}} + 0.25 \cdot \frac{1}{{x}^{4}}\right)}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right) \]
      6. metadata-eval66.1%

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

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

        \[\leadsto \mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\left(\frac{1}{x} + \frac{0.3333333333333333}{{x}^{3}}\right) - \left(\frac{0.5}{x \cdot x} + \color{blue}{\frac{0.25 \cdot 1}{{x}^{4}}}\right)}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right) \]
      9. metadata-eval66.1%

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

      \[\leadsto \mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\color{blue}{\left(\frac{1}{x} + \frac{0.3333333333333333}{{x}^{3}}\right) - \left(\frac{0.5}{x \cdot x} + \frac{0.25}{{x}^{4}}\right)}}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right) \]
    8. Taylor expanded in x around 0 90.8%

      \[\leadsto \color{blue}{\frac{-0.25}{n \cdot {x}^{4}}} \]
    9. Step-by-step derivation
      1. associate-/r*90.8%

        \[\leadsto \color{blue}{\frac{\frac{-0.25}{n}}{{x}^{4}}} \]
    10. Simplified90.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4.7 \cdot 10^{-296}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{-250}:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{elif}\;x \leq 3.05 \cdot 10^{-233}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-190}:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{elif}\;x \leq 6.6 \cdot 10^{-156}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.94:\\ \;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{+136}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.25}{n}}{{x}^{4}}\\ \end{array} \]

Alternative 11: 64.9% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\ t_1 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;n \leq -4.7 \cdot 10^{+150}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;n \leq -7.5 \cdot 10^{+14}:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;n \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\frac{t_1}{n \cdot x}\\ \mathbf{elif}\;n \leq 4.8 \cdot 10^{-228}:\\ \;\;\;\;\frac{1}{n \cdot x}\\ \mathbf{elif}\;n \leq 13500000:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (/ (- (/ 1.0 x) (/ (/ 0.5 x) x)) n)) (t_1 (pow x (/ 1.0 n))))
   (if (<= n -4.7e+150)
     t_0
     (if (<= n -7.5e+14)
       (/ (- x (log x)) n)
       (if (<= n -1e-310)
         (/ t_1 (* n x))
         (if (<= n 4.8e-228)
           (/ 1.0 (* n x))
           (if (<= n 13500000.0) (- (+ 1.0 (/ x n)) t_1) t_0)))))))
double code(double x, double n) {
	double t_0 = ((1.0 / x) - ((0.5 / x) / x)) / n;
	double t_1 = pow(x, (1.0 / n));
	double tmp;
	if (n <= -4.7e+150) {
		tmp = t_0;
	} else if (n <= -7.5e+14) {
		tmp = (x - log(x)) / n;
	} else if (n <= -1e-310) {
		tmp = t_1 / (n * x);
	} else if (n <= 4.8e-228) {
		tmp = 1.0 / (n * x);
	} else if (n <= 13500000.0) {
		tmp = (1.0 + (x / n)) - t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = ((1.0d0 / x) - ((0.5d0 / x) / x)) / n
    t_1 = x ** (1.0d0 / n)
    if (n <= (-4.7d+150)) then
        tmp = t_0
    else if (n <= (-7.5d+14)) then
        tmp = (x - log(x)) / n
    else if (n <= (-1d-310)) then
        tmp = t_1 / (n * x)
    else if (n <= 4.8d-228) then
        tmp = 1.0d0 / (n * x)
    else if (n <= 13500000.0d0) then
        tmp = (1.0d0 + (x / n)) - t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double t_0 = ((1.0 / x) - ((0.5 / x) / x)) / n;
	double t_1 = Math.pow(x, (1.0 / n));
	double tmp;
	if (n <= -4.7e+150) {
		tmp = t_0;
	} else if (n <= -7.5e+14) {
		tmp = (x - Math.log(x)) / n;
	} else if (n <= -1e-310) {
		tmp = t_1 / (n * x);
	} else if (n <= 4.8e-228) {
		tmp = 1.0 / (n * x);
	} else if (n <= 13500000.0) {
		tmp = (1.0 + (x / n)) - t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, n):
	t_0 = ((1.0 / x) - ((0.5 / x) / x)) / n
	t_1 = math.pow(x, (1.0 / n))
	tmp = 0
	if n <= -4.7e+150:
		tmp = t_0
	elif n <= -7.5e+14:
		tmp = (x - math.log(x)) / n
	elif n <= -1e-310:
		tmp = t_1 / (n * x)
	elif n <= 4.8e-228:
		tmp = 1.0 / (n * x)
	elif n <= 13500000.0:
		tmp = (1.0 + (x / n)) - t_1
	else:
		tmp = t_0
	return tmp
function code(x, n)
	t_0 = Float64(Float64(Float64(1.0 / x) - Float64(Float64(0.5 / x) / x)) / n)
	t_1 = x ^ Float64(1.0 / n)
	tmp = 0.0
	if (n <= -4.7e+150)
		tmp = t_0;
	elseif (n <= -7.5e+14)
		tmp = Float64(Float64(x - log(x)) / n);
	elseif (n <= -1e-310)
		tmp = Float64(t_1 / Float64(n * x));
	elseif (n <= 4.8e-228)
		tmp = Float64(1.0 / Float64(n * x));
	elseif (n <= 13500000.0)
		tmp = Float64(Float64(1.0 + Float64(x / n)) - t_1);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = ((1.0 / x) - ((0.5 / x) / x)) / n;
	t_1 = x ^ (1.0 / n);
	tmp = 0.0;
	if (n <= -4.7e+150)
		tmp = t_0;
	elseif (n <= -7.5e+14)
		tmp = (x - log(x)) / n;
	elseif (n <= -1e-310)
		tmp = t_1 / (n * x);
	elseif (n <= 4.8e-228)
		tmp = 1.0 / (n * x);
	elseif (n <= 13500000.0)
		tmp = (1.0 + (x / n)) - t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[(N[(N[(1.0 / x), $MachinePrecision] - N[(N[(0.5 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -4.7e+150], t$95$0, If[LessEqual[n, -7.5e+14], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, -1e-310], N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.8e-228], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 13500000.0], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;n \leq -7.5 \cdot 10^{+14}:\\
\;\;\;\;\frac{x - \log x}{n}\\

\mathbf{elif}\;n \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\

\mathbf{elif}\;n \leq 4.8 \cdot 10^{-228}:\\
\;\;\;\;\frac{1}{n \cdot x}\\

\mathbf{elif}\;n \leq 13500000:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_1\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if n < -4.70000000000000004e150 or 1.35e7 < n

    1. Initial program 37.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x}}{n} - \frac{\color{blue}{0.5}}{n \cdot {x}^{2}} \]
      4. associate-/l/58.5%

        \[\leadsto \frac{\frac{1}{x}}{n} - \color{blue}{\frac{\frac{0.5}{{x}^{2}}}{n}} \]
      5. metadata-eval58.5%

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

        \[\leadsto \frac{\frac{1}{x}}{n} - \frac{\color{blue}{0.5 \cdot \frac{1}{{x}^{2}}}}{n} \]
      7. div-sub58.5%

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

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

        \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{0.5}}{{x}^{2}}}{n} \]
      10. unpow258.5%

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

        \[\leadsto \frac{\frac{1}{x} - \color{blue}{\frac{\frac{0.5}{x}}{x}}}{n} \]
    7. Simplified58.5%

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

    if -4.70000000000000004e150 < n < -7.5e14

    1. Initial program 11.3%

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

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

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

        \[\leadsto \frac{\color{blue}{\log \left(1 + x\right)} - \log x}{n} \]
      3. log1p-def70.8%

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{n} - \frac{\log x}{n}} \]
      3. div-sub62.4%

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

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

    if -7.5e14 < n < -9.999999999999969e-311

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < n < 4.80000000000000004e-228

    1. Initial program 3.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.80000000000000004e-228 < n < 1.35e7

    1. Initial program 70.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4.7 \cdot 10^{+150}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\ \mathbf{elif}\;n \leq -7.5 \cdot 10^{+14}:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;n \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\ \mathbf{elif}\;n \leq 4.8 \cdot 10^{-228}:\\ \;\;\;\;\frac{1}{n \cdot x}\\ \mathbf{elif}\;n \leq 13500000:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\ \end{array} \]

Alternative 12: 56.2% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{-\log x}{n}\\ \mathbf{if}\;x \leq 5 \cdot 10^{-296}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 7.3 \cdot 10^{-249}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.35 \cdot 10^{-232}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-191}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-152}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 0.98:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (- (log x)) n)))
   (if (<= x 5e-296)
     t_0
     (if (<= x 7.3e-249)
       t_1
       (if (<= x 2.35e-232)
         t_0
         (if (<= x 9.5e-191)
           t_1
           (if (<= x 3.6e-152)
             t_0
             (if (<= x 0.98)
               (/ (- x (log x)) n)
               (/ (- (/ 1.0 x) (/ (/ 0.5 x) x)) n)))))))))
double code(double x, double n) {
	double t_0 = 1.0 - pow(x, (1.0 / n));
	double t_1 = -log(x) / n;
	double tmp;
	if (x <= 5e-296) {
		tmp = t_0;
	} else if (x <= 7.3e-249) {
		tmp = t_1;
	} else if (x <= 2.35e-232) {
		tmp = t_0;
	} else if (x <= 9.5e-191) {
		tmp = t_1;
	} else if (x <= 3.6e-152) {
		tmp = t_0;
	} else if (x <= 0.98) {
		tmp = (x - log(x)) / n;
	} else {
		tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 1.0d0 - (x ** (1.0d0 / n))
    t_1 = -log(x) / n
    if (x <= 5d-296) then
        tmp = t_0
    else if (x <= 7.3d-249) then
        tmp = t_1
    else if (x <= 2.35d-232) then
        tmp = t_0
    else if (x <= 9.5d-191) then
        tmp = t_1
    else if (x <= 3.6d-152) then
        tmp = t_0
    else if (x <= 0.98d0) then
        tmp = (x - log(x)) / n
    else
        tmp = ((1.0d0 / x) - ((0.5d0 / x) / x)) / n
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double t_0 = 1.0 - Math.pow(x, (1.0 / n));
	double t_1 = -Math.log(x) / n;
	double tmp;
	if (x <= 5e-296) {
		tmp = t_0;
	} else if (x <= 7.3e-249) {
		tmp = t_1;
	} else if (x <= 2.35e-232) {
		tmp = t_0;
	} else if (x <= 9.5e-191) {
		tmp = t_1;
	} else if (x <= 3.6e-152) {
		tmp = t_0;
	} else if (x <= 0.98) {
		tmp = (x - Math.log(x)) / n;
	} else {
		tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
	}
	return tmp;
}
def code(x, n):
	t_0 = 1.0 - math.pow(x, (1.0 / n))
	t_1 = -math.log(x) / n
	tmp = 0
	if x <= 5e-296:
		tmp = t_0
	elif x <= 7.3e-249:
		tmp = t_1
	elif x <= 2.35e-232:
		tmp = t_0
	elif x <= 9.5e-191:
		tmp = t_1
	elif x <= 3.6e-152:
		tmp = t_0
	elif x <= 0.98:
		tmp = (x - math.log(x)) / n
	else:
		tmp = ((1.0 / x) - ((0.5 / x) / x)) / n
	return tmp
function code(x, n)
	t_0 = Float64(1.0 - (x ^ Float64(1.0 / n)))
	t_1 = Float64(Float64(-log(x)) / n)
	tmp = 0.0
	if (x <= 5e-296)
		tmp = t_0;
	elseif (x <= 7.3e-249)
		tmp = t_1;
	elseif (x <= 2.35e-232)
		tmp = t_0;
	elseif (x <= 9.5e-191)
		tmp = t_1;
	elseif (x <= 3.6e-152)
		tmp = t_0;
	elseif (x <= 0.98)
		tmp = Float64(Float64(x - log(x)) / n);
	else
		tmp = Float64(Float64(Float64(1.0 / x) - Float64(Float64(0.5 / x) / x)) / n);
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = 1.0 - (x ^ (1.0 / n));
	t_1 = -log(x) / n;
	tmp = 0.0;
	if (x <= 5e-296)
		tmp = t_0;
	elseif (x <= 7.3e-249)
		tmp = t_1;
	elseif (x <= 2.35e-232)
		tmp = t_0;
	elseif (x <= 9.5e-191)
		tmp = t_1;
	elseif (x <= 3.6e-152)
		tmp = t_0;
	elseif (x <= 0.98)
		tmp = (x - log(x)) / n;
	else
		tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 5e-296], t$95$0, If[LessEqual[x, 7.3e-249], t$95$1, If[LessEqual[x, 2.35e-232], t$95$0, If[LessEqual[x, 9.5e-191], t$95$1, If[LessEqual[x, 3.6e-152], t$95$0, If[LessEqual[x, 0.98], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(N[(0.5 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 7.3 \cdot 10^{-249}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 2.35 \cdot 10^{-232}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 9.5 \cdot 10^{-191}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 3.6 \cdot 10^{-152}:\\
\;\;\;\;t_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < 5.0000000000000003e-296 or 7.2999999999999997e-249 < x < 2.35000000000000017e-232 or 9.4999999999999996e-191 < x < 3.6e-152

    1. Initial program 81.0%

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

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

    if 5.0000000000000003e-296 < x < 7.2999999999999997e-249 or 2.35000000000000017e-232 < x < 9.4999999999999996e-191

    1. Initial program 36.3%

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

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

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

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

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

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

    if 3.6e-152 < x < 0.97999999999999998

    1. Initial program 37.5%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{n} - \frac{\log x}{n}} \]
      3. div-sub47.9%

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

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

    if 0.97999999999999998 < x

    1. Initial program 67.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x}}{n} - \frac{\color{blue}{0.5}}{n \cdot {x}^{2}} \]
      4. associate-/l/62.2%

        \[\leadsto \frac{\frac{1}{x}}{n} - \color{blue}{\frac{\frac{0.5}{{x}^{2}}}{n}} \]
      5. metadata-eval62.2%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5 \cdot 10^{-296}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 7.3 \cdot 10^{-249}:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{elif}\;x \leq 2.35 \cdot 10^{-232}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-191}:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-152}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.98:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\ \end{array} \]

Alternative 13: 64.8% accurate, 1.8× speedup?

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

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

\mathbf{elif}\;n \leq -6.8 \cdot 10^{+15}:\\
\;\;\;\;\frac{x - \log x}{n}\\

\mathbf{elif}\;n \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\

\mathbf{elif}\;n \leq 2.05 \cdot 10^{-226}:\\
\;\;\;\;\frac{1}{n \cdot x}\\

\mathbf{elif}\;n \leq 13500000:\\
\;\;\;\;1 - t_1\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if n < -7.99999999999999985e150 or 1.35e7 < n

    1. Initial program 37.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x}}{n} - \frac{\color{blue}{0.5}}{n \cdot {x}^{2}} \]
      4. associate-/l/58.5%

        \[\leadsto \frac{\frac{1}{x}}{n} - \color{blue}{\frac{\frac{0.5}{{x}^{2}}}{n}} \]
      5. metadata-eval58.5%

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

        \[\leadsto \frac{\frac{1}{x}}{n} - \frac{\color{blue}{0.5 \cdot \frac{1}{{x}^{2}}}}{n} \]
      7. div-sub58.5%

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

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

        \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{0.5}}{{x}^{2}}}{n} \]
      10. unpow258.5%

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

        \[\leadsto \frac{\frac{1}{x} - \color{blue}{\frac{\frac{0.5}{x}}{x}}}{n} \]
    7. Simplified58.5%

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

    if -7.99999999999999985e150 < n < -6.8e15

    1. Initial program 11.3%

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

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

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

        \[\leadsto \frac{\color{blue}{\log \left(1 + x\right)} - \log x}{n} \]
      3. log1p-def70.8%

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{n} - \frac{\log x}{n}} \]
      3. div-sub62.4%

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

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

    if -6.8e15 < n < -9.999999999999969e-311

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < n < 2.05000000000000019e-226

    1. Initial program 3.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.05000000000000019e-226 < n < 1.35e7

    1. Initial program 70.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -8 \cdot 10^{+150}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\ \mathbf{elif}\;n \leq -6.8 \cdot 10^{+15}:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;n \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\ \mathbf{elif}\;n \leq 2.05 \cdot 10^{-226}:\\ \;\;\;\;\frac{1}{n \cdot x}\\ \mathbf{elif}\;n \leq 13500000:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\ \end{array} \]

Alternative 14: 57.5% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 46.3%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{n} - \frac{\log x}{n}} \]
      3. div-sub48.1%

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

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

    if 0.97999999999999998 < x

    1. Initial program 67.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x}}{n} - \frac{\color{blue}{0.5}}{n \cdot {x}^{2}} \]
      4. associate-/l/62.2%

        \[\leadsto \frac{\frac{1}{x}}{n} - \color{blue}{\frac{\frac{0.5}{{x}^{2}}}{n}} \]
      5. metadata-eval62.2%

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

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

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

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

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

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

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

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

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

Alternative 15: 57.3% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 46.3%

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

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

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

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

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

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

    if 0.660000000000000031 < x

    1. Initial program 67.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x}}{n} - \frac{\color{blue}{0.5}}{n \cdot {x}^{2}} \]
      4. associate-/l/62.2%

        \[\leadsto \frac{\frac{1}{x}}{n} - \color{blue}{\frac{\frac{0.5}{{x}^{2}}}{n}} \]
      5. metadata-eval62.2%

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

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

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

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

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

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

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

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

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

Alternative 16: 39.9% 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 56.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 17: 40.4% 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 56.3%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \color{blue}{\frac{\left(\log \left(1 + x\right) + 0\right) - \log x}{n}} - 0.5 \cdot \frac{{\log x}^{2}}{{n}^{2}}\right) \]
    8. +-rgt-identity49.1%

      \[\leadsto \mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\color{blue}{\log \left(1 + x\right)} - \log x}{n} - 0.5 \cdot \frac{{\log x}^{2}}{{n}^{2}}\right) \]
    9. log1p-def49.1%

      \[\leadsto \mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}{n} - 0.5 \cdot \frac{{\log x}^{2}}{{n}^{2}}\right) \]
    10. unpow249.1%

      \[\leadsto \mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right) - \log x}{n} - 0.5 \cdot \frac{{\log x}^{2}}{\color{blue}{n \cdot n}}\right) \]
  4. Simplified49.1%

    \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right) - \log x}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right)} \]
  5. Taylor expanded in x around inf 42.8%

    \[\leadsto \color{blue}{\frac{\frac{1}{n} + -1 \cdot \frac{\log \left(\frac{1}{x}\right)}{{n}^{2}}}{x}} \]
  6. Step-by-step derivation
    1. mul-1-neg42.8%

      \[\leadsto \frac{\frac{1}{n} + \color{blue}{\left(-\frac{\log \left(\frac{1}{x}\right)}{{n}^{2}}\right)}}{x} \]
    2. distribute-neg-frac42.8%

      \[\leadsto \frac{\frac{1}{n} + \color{blue}{\frac{-\log \left(\frac{1}{x}\right)}{{n}^{2}}}}{x} \]
    3. log-rec42.8%

      \[\leadsto \frac{\frac{1}{n} + \frac{-\color{blue}{\left(-\log x\right)}}{{n}^{2}}}{x} \]
    4. remove-double-neg42.8%

      \[\leadsto \frac{\frac{1}{n} + \frac{\color{blue}{\log x}}{{n}^{2}}}{x} \]
    5. unpow242.8%

      \[\leadsto \frac{\frac{1}{n} + \frac{\log x}{\color{blue}{n \cdot n}}}{x} \]
  7. Simplified42.8%

    \[\leadsto \color{blue}{\frac{\frac{1}{n} + \frac{\log x}{n \cdot n}}{x}} \]
  8. Taylor expanded in n around inf 41.1%

    \[\leadsto \frac{\color{blue}{\frac{1}{n}}}{x} \]
  9. Final simplification41.1%

    \[\leadsto \frac{\frac{1}{n}}{x} \]

Alternative 18: 40.4% accurate, 42.2× speedup?

\[\begin{array}{l} \\ \frac{\frac{1}{x}}{n} \end{array} \]
(FPCore (x n) :precision binary64 (/ (/ 1.0 x) n))
double code(double x, double n) {
	return (1.0 / x) / n;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    code = (1.0d0 / x) / n
end function
public static double code(double x, double n) {
	return (1.0 / x) / n;
}
def code(x, n):
	return (1.0 / x) / n
function code(x, n)
	return Float64(Float64(1.0 / x) / n)
end
function tmp = code(x, n)
	tmp = (1.0 / x) / n;
end
code[x_, n_] := N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{1}{x}}{n}
\end{array}
Derivation
  1. Initial program 56.3%

    \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
  2. Taylor expanded in n around inf 58.3%

    \[\leadsto \color{blue}{\frac{\log \left(1 + x\right) - \log x}{n}} \]
  3. Step-by-step derivation
    1. +-rgt-identity58.3%

      \[\leadsto \frac{\color{blue}{\left(\log \left(1 + x\right) + 0\right)} - \log x}{n} \]
    2. +-rgt-identity58.3%

      \[\leadsto \frac{\color{blue}{\log \left(1 + x\right)} - \log x}{n} \]
    3. log1p-def58.3%

      \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}{n} \]
  4. Simplified58.3%

    \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(x\right) - \log x}{n}} \]
  5. Taylor expanded in x around inf 41.1%

    \[\leadsto \frac{\color{blue}{\frac{1}{x}}}{n} \]
  6. Final simplification41.1%

    \[\leadsto \frac{\frac{1}{x}}{n} \]

Alternative 19: 4.5% accurate, 70.3× speedup?

\[\begin{array}{l} \\ \frac{x}{n} \end{array} \]
(FPCore (x n) :precision binary64 (/ x n))
double code(double x, double n) {
	return x / n;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    code = x / n
end function
public static double code(double x, double n) {
	return x / n;
}
def code(x, n):
	return x / n
function code(x, n)
	return Float64(x / n)
end
function tmp = code(x, n)
	tmp = x / n;
end
code[x_, n_] := N[(x / n), $MachinePrecision]
\begin{array}{l}

\\
\frac{x}{n}
\end{array}
Derivation
  1. Initial program 56.3%

    \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
  2. Taylor expanded in x around 0 32.7%

    \[\leadsto \color{blue}{\left(\frac{x}{n} + 1\right)} - {x}^{\left(\frac{1}{n}\right)} \]
  3. Taylor expanded in x around inf 4.5%

    \[\leadsto \color{blue}{\frac{x}{n}} \]
  4. Final simplification4.5%

    \[\leadsto \frac{x}{n} \]

Reproduce

?
herbie shell --seed 2023195 
(FPCore (x n)
  :name "2nthrt (problem 3.4.6)"
  :precision binary64
  (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))