2nthrt (problem 3.4.6)

Percentage Accurate: 53.5% → 85.8%
Time: 39.8s
Alternatives: 15
Speedup: 1.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 alternatives:

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

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

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

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

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

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

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


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

    1. Initial program 83.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.9999999999999999e-72 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-18

    1. Initial program 31.5%

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000001e-18 < (/.f64 #s(literal 1 binary64) n) < 1e6

    1. Initial program 2.1%

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

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

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

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

      1. Initial program 63.2%

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

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

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

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

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

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

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

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

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

    Alternative 2: 85.8% accurate, 0.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-72}:\\ \;\;\;\;\frac{t\_0}{n \cdot x}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-18}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 1000000:\\ \;\;\;\;\frac{\mathsf{fma}\left(t\_0, \frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x}, \frac{t\_0}{n}\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\ \end{array} \end{array} \]
    (FPCore (x n)
     :precision binary64
     (let* ((t_0 (pow x (/ 1.0 n))))
       (if (<= (/ 1.0 n) -4e-72)
         (/ t_0 (* n x))
         (if (<= (/ 1.0 n) 2e-18)
           (/ (- (log1p x) (log x)) n)
           (if (<= (/ 1.0 n) 1000000.0)
             (/ (fma t_0 (/ (fma 0.5 (pow n -2.0) (/ -0.5 n)) x) (/ t_0 n)) x)
             (- (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) <= -4e-72) {
    		tmp = t_0 / (n * x);
    	} else if ((1.0 / n) <= 2e-18) {
    		tmp = (log1p(x) - log(x)) / n;
    	} else if ((1.0 / n) <= 1000000.0) {
    		tmp = fma(t_0, (fma(0.5, pow(n, -2.0), (-0.5 / n)) / x), (t_0 / n)) / x;
    	} 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) <= -4e-72)
    		tmp = Float64(t_0 / Float64(n * x));
    	elseif (Float64(1.0 / n) <= 2e-18)
    		tmp = Float64(Float64(log1p(x) - log(x)) / n);
    	elseif (Float64(1.0 / n) <= 1000000.0)
    		tmp = Float64(fma(t_0, Float64(fma(0.5, (n ^ -2.0), Float64(-0.5 / n)) / x), Float64(t_0 / n)) / x);
    	else
    		tmp = Float64(exp(Float64(log1p(x) / n)) - t_0);
    	end
    	return tmp
    end
    
    code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-72], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-18], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1000000.0], N[(N[(t$95$0 * N[(N[(0.5 * N[Power[n, -2.0], $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(t$95$0 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := {x}^{\left(\frac{1}{n}\right)}\\
    \mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-72}:\\
    \;\;\;\;\frac{t\_0}{n \cdot x}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-18}:\\
    \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 1000000:\\
    \;\;\;\;\frac{\mathsf{fma}\left(t\_0, \frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x}, \frac{t\_0}{n}\right)}{x}\\
    
    \mathbf{else}:\\
    \;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if (/.f64 #s(literal 1 binary64) n) < -3.9999999999999999e-72

      1. Initial program 83.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -3.9999999999999999e-72 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-18

      1. Initial program 31.5%

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

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

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

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

      if 2.0000000000000001e-18 < (/.f64 #s(literal 1 binary64) n) < 1e6

      1. Initial program 2.1%

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

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

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

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

        1. Initial program 63.2%

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

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

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

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

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

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

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

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

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

      Alternative 3: 85.8% accurate, 0.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{t\_0}{n \cdot x}\\ \mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-72}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-18}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 1000000:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\ \end{array} \end{array} \]
      (FPCore (x n)
       :precision binary64
       (let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ t_0 (* n x))))
         (if (<= (/ 1.0 n) -4e-72)
           t_1
           (if (<= (/ 1.0 n) 2e-18)
             (/ (- (log1p x) (log x)) n)
             (if (<= (/ 1.0 n) 1000000.0) t_1 (- (exp (/ (log1p x) n)) t_0))))))
      double code(double x, double n) {
      	double t_0 = pow(x, (1.0 / n));
      	double t_1 = t_0 / (n * x);
      	double tmp;
      	if ((1.0 / n) <= -4e-72) {
      		tmp = t_1;
      	} else if ((1.0 / n) <= 2e-18) {
      		tmp = (log1p(x) - log(x)) / n;
      	} else if ((1.0 / n) <= 1000000.0) {
      		tmp = t_1;
      	} else {
      		tmp = exp((log1p(x) / n)) - t_0;
      	}
      	return tmp;
      }
      
      public static double code(double x, double n) {
      	double t_0 = Math.pow(x, (1.0 / n));
      	double t_1 = t_0 / (n * x);
      	double tmp;
      	if ((1.0 / n) <= -4e-72) {
      		tmp = t_1;
      	} else if ((1.0 / n) <= 2e-18) {
      		tmp = (Math.log1p(x) - Math.log(x)) / n;
      	} else if ((1.0 / n) <= 1000000.0) {
      		tmp = t_1;
      	} else {
      		tmp = Math.exp((Math.log1p(x) / n)) - t_0;
      	}
      	return tmp;
      }
      
      def code(x, n):
      	t_0 = math.pow(x, (1.0 / n))
      	t_1 = t_0 / (n * x)
      	tmp = 0
      	if (1.0 / n) <= -4e-72:
      		tmp = t_1
      	elif (1.0 / n) <= 2e-18:
      		tmp = (math.log1p(x) - math.log(x)) / n
      	elif (1.0 / n) <= 1000000.0:
      		tmp = t_1
      	else:
      		tmp = math.exp((math.log1p(x) / n)) - t_0
      	return tmp
      
      function code(x, n)
      	t_0 = x ^ Float64(1.0 / n)
      	t_1 = Float64(t_0 / Float64(n * x))
      	tmp = 0.0
      	if (Float64(1.0 / n) <= -4e-72)
      		tmp = t_1;
      	elseif (Float64(1.0 / n) <= 2e-18)
      		tmp = Float64(Float64(log1p(x) - log(x)) / n);
      	elseif (Float64(1.0 / n) <= 1000000.0)
      		tmp = t_1;
      	else
      		tmp = Float64(exp(Float64(log1p(x) / n)) - t_0);
      	end
      	return tmp
      end
      
      code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-72], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-18], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1000000.0], t$95$1, N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := {x}^{\left(\frac{1}{n}\right)}\\
      t_1 := \frac{t\_0}{n \cdot x}\\
      \mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-72}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-18}:\\
      \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
      
      \mathbf{elif}\;\frac{1}{n} \leq 1000000:\\
      \;\;\;\;t\_1\\
      
      \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 #s(literal 1 binary64) n) < -3.9999999999999999e-72 or 2.0000000000000001e-18 < (/.f64 #s(literal 1 binary64) n) < 1e6

        1. Initial program 78.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -3.9999999999999999e-72 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-18

        1. Initial program 31.5%

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

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

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

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

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

        1. Initial program 63.2%

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

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

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

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

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

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

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

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

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

      Alternative 4: 82.1% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{t\_0}{n \cdot x}\\ \mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-72}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-18}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 1000000:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + x \cdot \frac{-0.5 + \frac{0.5}{n}}{n}\right)\right) - t\_0\\ \end{array} \end{array} \]
      (FPCore (x n)
       :precision binary64
       (let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ t_0 (* n x))))
         (if (<= (/ 1.0 n) -4e-72)
           t_1
           (if (<= (/ 1.0 n) 2e-18)
             (/ (- (log1p x) (log x)) n)
             (if (<= (/ 1.0 n) 1000000.0)
               t_1
               (-
                (+ 1.0 (* x (+ (/ 1.0 n) (* x (/ (+ -0.5 (/ 0.5 n)) n)))))
                t_0))))))
      double code(double x, double n) {
      	double t_0 = pow(x, (1.0 / n));
      	double t_1 = t_0 / (n * x);
      	double tmp;
      	if ((1.0 / n) <= -4e-72) {
      		tmp = t_1;
      	} else if ((1.0 / n) <= 2e-18) {
      		tmp = (log1p(x) - log(x)) / n;
      	} else if ((1.0 / n) <= 1000000.0) {
      		tmp = t_1;
      	} else {
      		tmp = (1.0 + (x * ((1.0 / n) + (x * ((-0.5 + (0.5 / n)) / n))))) - t_0;
      	}
      	return tmp;
      }
      
      public static double code(double x, double n) {
      	double t_0 = Math.pow(x, (1.0 / n));
      	double t_1 = t_0 / (n * x);
      	double tmp;
      	if ((1.0 / n) <= -4e-72) {
      		tmp = t_1;
      	} else if ((1.0 / n) <= 2e-18) {
      		tmp = (Math.log1p(x) - Math.log(x)) / n;
      	} else if ((1.0 / n) <= 1000000.0) {
      		tmp = t_1;
      	} else {
      		tmp = (1.0 + (x * ((1.0 / n) + (x * ((-0.5 + (0.5 / n)) / n))))) - t_0;
      	}
      	return tmp;
      }
      
      def code(x, n):
      	t_0 = math.pow(x, (1.0 / n))
      	t_1 = t_0 / (n * x)
      	tmp = 0
      	if (1.0 / n) <= -4e-72:
      		tmp = t_1
      	elif (1.0 / n) <= 2e-18:
      		tmp = (math.log1p(x) - math.log(x)) / n
      	elif (1.0 / n) <= 1000000.0:
      		tmp = t_1
      	else:
      		tmp = (1.0 + (x * ((1.0 / n) + (x * ((-0.5 + (0.5 / n)) / n))))) - t_0
      	return tmp
      
      function code(x, n)
      	t_0 = x ^ Float64(1.0 / n)
      	t_1 = Float64(t_0 / Float64(n * x))
      	tmp = 0.0
      	if (Float64(1.0 / n) <= -4e-72)
      		tmp = t_1;
      	elseif (Float64(1.0 / n) <= 2e-18)
      		tmp = Float64(Float64(log1p(x) - log(x)) / n);
      	elseif (Float64(1.0 / n) <= 1000000.0)
      		tmp = t_1;
      	else
      		tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(x * Float64(Float64(-0.5 + Float64(0.5 / n)) / n))))) - t_0);
      	end
      	return tmp
      end
      
      code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-72], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-18], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1000000.0], t$95$1, N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(x * N[(N[(-0.5 + N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := {x}^{\left(\frac{1}{n}\right)}\\
      t_1 := \frac{t\_0}{n \cdot x}\\
      \mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-72}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-18}:\\
      \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
      
      \mathbf{elif}\;\frac{1}{n} \leq 1000000:\\
      \;\;\;\;t\_1\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + x \cdot \frac{-0.5 + \frac{0.5}{n}}{n}\right)\right) - t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (/.f64 #s(literal 1 binary64) n) < -3.9999999999999999e-72 or 2.0000000000000001e-18 < (/.f64 #s(literal 1 binary64) n) < 1e6

        1. Initial program 78.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -3.9999999999999999e-72 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-18

        1. Initial program 31.5%

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

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

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

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

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

        1. Initial program 63.2%

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

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

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

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

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

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

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

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

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

      Alternative 5: 70.3% accurate, 1.7× speedup?

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

        1. Initial program 53.7%

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

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

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

        if 5.3999999999999997e-170 < x < 3.10000000000000014e-5

        1. Initial program 37.2%

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

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

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

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

        if 3.10000000000000014e-5 < x

        1. Initial program 65.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 6: 70.3% accurate, 1.7× speedup?

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

        1. Initial program 53.7%

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

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

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

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

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

        if 4.2000000000000001e-169 < x < 4.30000000000000033e-6

        1. Initial program 37.2%

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

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

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

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

        if 4.30000000000000033e-6 < x

        1. Initial program 65.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 7: 70.2% accurate, 1.8× speedup?

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

        1. Initial program 53.7%

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

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

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

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

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

        if 6.50000000000000035e-170 < x < 1.45e-5

        1. Initial program 37.2%

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

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

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

        if 1.45e-5 < x

        1. Initial program 65.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 8: 70.3% accurate, 1.8× speedup?

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

        1. Initial program 53.7%

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

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

        if 6.3999999999999999e-170 < x < 4.7999999999999998e-6

        1. Initial program 37.2%

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

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

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

        if 4.7999999999999998e-6 < x

        1. Initial program 65.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 9: 70.1% accurate, 1.8× speedup?

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

        1. Initial program 53.7%

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

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

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

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

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

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

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

        if 1.10000000000000004e-169 < x < 2.1500000000000001e-5

        1. Initial program 37.2%

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

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

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

        if 2.1500000000000001e-5 < x

        1. Initial program 65.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 10: 56.9% accurate, 1.9× speedup?

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

        1. Initial program 53.7%

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

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

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

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

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

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

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

        if 5.8000000000000001e-170 < x < 7.19999999999999989e-7

        1. Initial program 36.4%

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

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

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

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

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

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

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

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

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

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

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

        if 7.19999999999999989e-7 < x < 1.4000000000000001e24

        1. Initial program 31.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\frac{\left(-\frac{\color{blue}{-\log x}}{n}\right) + 1}{x}}{n} \]
          4. neg-mul-161.0%

            \[\leadsto \frac{\frac{\left(-\frac{\color{blue}{-1 \cdot \log x}}{n}\right) + 1}{x}}{n} \]
          5. associate-*r/61.0%

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

            \[\leadsto \frac{\frac{\left(-\color{blue}{\left(-\frac{\log x}{n}\right)}\right) + 1}{x}}{n} \]
          7. remove-double-neg61.0%

            \[\leadsto \frac{\frac{\color{blue}{\frac{\log x}{n}} + 1}{x}}{n} \]
        8. Simplified61.0%

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

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

        if 1.4000000000000001e24 < x

        1. Initial program 69.7%

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\log \left(e^{1 - {x}^{\left(\frac{1}{n}\right)}}\right)} \]
        7. Applied egg-rr33.9%

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

          \[\leadsto \log \color{blue}{1} \]
      3. Recombined 4 regimes into one program.
      4. Final simplification60.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5.8 \cdot 10^{-170}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{-7}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{+24}:\\ \;\;\;\;\frac{\frac{1}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      5. Add Preprocessing

      Alternative 11: 57.2% accurate, 1.9× speedup?

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

        1. Initial program 44.5%

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

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

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

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

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

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

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

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

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

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

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

        if 7.19999999999999989e-7 < x < 2.20000000000000002e24

        1. Initial program 31.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\frac{\left(-\frac{\color{blue}{-\log x}}{n}\right) + 1}{x}}{n} \]
          4. neg-mul-161.0%

            \[\leadsto \frac{\frac{\left(-\frac{\color{blue}{-1 \cdot \log x}}{n}\right) + 1}{x}}{n} \]
          5. associate-*r/61.0%

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

            \[\leadsto \frac{\frac{\left(-\color{blue}{\left(-\frac{\log x}{n}\right)}\right) + 1}{x}}{n} \]
          7. remove-double-neg61.0%

            \[\leadsto \frac{\frac{\color{blue}{\frac{\log x}{n}} + 1}{x}}{n} \]
        8. Simplified61.0%

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

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

        if 2.20000000000000002e24 < x

        1. Initial program 69.7%

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\log \left(e^{1 - {x}^{\left(\frac{1}{n}\right)}}\right)} \]
        7. Applied egg-rr33.9%

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

          \[\leadsto \log \color{blue}{1} \]
      3. Recombined 3 regimes into one program.
      4. Final simplification58.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 7.2 \cdot 10^{-7}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 2.2 \cdot 10^{+24}:\\ \;\;\;\;\frac{\frac{1}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      5. Add Preprocessing

      Alternative 12: 45.4% accurate, 17.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{+39}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{n}\\ \end{array} \end{array} \]
      (FPCore (x n)
       :precision binary64
       (if (<= (/ 1.0 n) -5e+39) 0.0 (/ (/ 1.0 x) n)))
      double code(double x, double n) {
      	double tmp;
      	if ((1.0 / n) <= -5e+39) {
      		tmp = 0.0;
      	} else {
      		tmp = (1.0 / x) / n;
      	}
      	return tmp;
      }
      
      real(8) function code(x, n)
          real(8), intent (in) :: x
          real(8), intent (in) :: n
          real(8) :: tmp
          if ((1.0d0 / n) <= (-5d+39)) then
              tmp = 0.0d0
          else
              tmp = (1.0d0 / x) / n
          end if
          code = tmp
      end function
      
      public static double code(double x, double n) {
      	double tmp;
      	if ((1.0 / n) <= -5e+39) {
      		tmp = 0.0;
      	} else {
      		tmp = (1.0 / x) / n;
      	}
      	return tmp;
      }
      
      def code(x, n):
      	tmp = 0
      	if (1.0 / n) <= -5e+39:
      		tmp = 0.0
      	else:
      		tmp = (1.0 / x) / n
      	return tmp
      
      function code(x, n)
      	tmp = 0.0
      	if (Float64(1.0 / n) <= -5e+39)
      		tmp = 0.0;
      	else
      		tmp = Float64(Float64(1.0 / x) / n);
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, n)
      	tmp = 0.0;
      	if ((1.0 / n) <= -5e+39)
      		tmp = 0.0;
      	else
      		tmp = (1.0 / x) / n;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e+39], 0.0, N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{+39}:\\
      \;\;\;\;0\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\frac{1}{x}}{n}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (/.f64 #s(literal 1 binary64) n) < -5.00000000000000015e39

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

          \[\leadsto \log \color{blue}{1} \]

        if -5.00000000000000015e39 < (/.f64 #s(literal 1 binary64) n)

        1. Initial program 37.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\frac{\left(-\frac{\color{blue}{-\log x}}{n}\right) + 1}{x}}{n} \]
          4. neg-mul-138.2%

            \[\leadsto \frac{\frac{\left(-\frac{\color{blue}{-1 \cdot \log x}}{n}\right) + 1}{x}}{n} \]
          5. associate-*r/38.2%

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

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

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

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

          \[\leadsto \frac{\color{blue}{\frac{1}{x}}}{n} \]
      3. Recombined 2 regimes into one program.
      4. Final simplification47.7%

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

      Alternative 13: 41.0% 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 54.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\frac{\left(-\frac{\color{blue}{-\log x}}{n}\right) + 1}{x}}{n} \]
        4. neg-mul-138.5%

          \[\leadsto \frac{\frac{\left(-\frac{\color{blue}{-1 \cdot \log x}}{n}\right) + 1}{x}}{n} \]
        5. associate-*r/38.5%

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

          \[\leadsto \frac{\frac{\left(-\color{blue}{\left(-\frac{\log x}{n}\right)}\right) + 1}{x}}{n} \]
        7. remove-double-neg38.5%

          \[\leadsto \frac{\frac{\color{blue}{\frac{\log x}{n}} + 1}{x}}{n} \]
      8. Simplified38.5%

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

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

      Alternative 14: 40.5% 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 54.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\frac{\left(-\frac{\color{blue}{-\log x}}{n}\right) + 1}{x}}{n} \]
        4. neg-mul-138.5%

          \[\leadsto \frac{\frac{\left(-\frac{\color{blue}{-1 \cdot \log x}}{n}\right) + 1}{x}}{n} \]
        5. associate-*r/38.5%

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

          \[\leadsto \frac{\frac{\left(-\color{blue}{\left(-\frac{\log x}{n}\right)}\right) + 1}{x}}{n} \]
        7. remove-double-neg38.5%

          \[\leadsto \frac{\frac{\color{blue}{\frac{\log x}{n}} + 1}{x}}{n} \]
      8. Simplified38.5%

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

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

          \[\leadsto \frac{1}{\color{blue}{x \cdot n}} \]
      11. Simplified39.6%

        \[\leadsto \color{blue}{\frac{1}{x \cdot n}} \]
      12. Final simplification39.6%

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

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

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

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

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

      Reproduce

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