2nthrt (problem 3.4.6)

Percentage Accurate: 53.6% → 84.5%
Time: 1.1min
Alternatives: 13
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 13 alternatives:

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

Initial Program: 53.6% 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: 84.5% accurate, 0.3× speedup?

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

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

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


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

    1. Initial program 35.3%

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

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

        \[\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}} \]
      2. Step-by-step derivation
        1. associate-+r-69.5%

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

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

          \[\leadsto \frac{\log \color{blue}{\left(\frac{e^{\mathsf{log1p}\left(x\right) + 0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n}}}{e^{\log x}}\right)}}{n} \]
        4. add-exp-log79.8%

          \[\leadsto \frac{\log \left(\frac{e^{\mathsf{log1p}\left(x\right) + 0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n}}}{\color{blue}{x}}\right)}{n} \]
      3. Applied egg-rr79.8%

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

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

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

      if 1.5e6 < x

      1. Initial program 61.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
      6. Step-by-step derivation
        1. div-inv97.7%

          \[\leadsto \frac{e^{\color{blue}{\log x \cdot \frac{1}{n}}}}{x \cdot n} \]
        2. pow-to-exp97.7%

          \[\leadsto \frac{\color{blue}{{x}^{\left(\frac{1}{n}\right)}}}{x \cdot n} \]
        3. *-un-lft-identity97.7%

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

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

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

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

    Alternative 2: 85.1% accurate, 0.3× speedup?

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

      1. Initial program 65.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 inf 84.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. mul-1-neg84.6%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
      6. Step-by-step derivation
        1. div-inv84.6%

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

          \[\leadsto \frac{\color{blue}{{x}^{\left(\frac{1}{n}\right)}}}{x \cdot n} \]
        3. *-un-lft-identity84.6%

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

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

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

      if -9.9999999999999997e-148 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999991e-6

      1. Initial program 27.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 85.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. Simplified85.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}} \]

        if 1.99999999999999991e-6 < (/.f64 #s(literal 1 binary64) n)

        1. Initial program 53.3%

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-147}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-6}:\\ \;\;\;\;\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{else}:\\ \;\;\;\;e^{\log \left(e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\right)}\\ \end{array} \]
      7. Add Preprocessing

      Alternative 3: 85.0% accurate, 0.4× speedup?

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

        1. Initial program 65.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 inf 84.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. mul-1-neg84.6%

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
        6. Step-by-step derivation
          1. div-inv84.6%

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

            \[\leadsto \frac{\color{blue}{{x}^{\left(\frac{1}{n}\right)}}}{x \cdot n} \]
          3. *-un-lft-identity84.6%

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

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

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

        if -9.9999999999999997e-148 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000002e-14

        1. Initial program 28.0%

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

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

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

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

        if 5.0000000000000002e-14 < (/.f64 #s(literal 1 binary64) n)

        1. Initial program 49.2%

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

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

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

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

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

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

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

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

      Alternative 4: 85.0% accurate, 0.7× speedup?

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

        1. Initial program 65.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 inf 84.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. mul-1-neg84.6%

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
        6. Step-by-step derivation
          1. div-inv84.6%

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

            \[\leadsto \frac{\color{blue}{{x}^{\left(\frac{1}{n}\right)}}}{x \cdot n} \]
          3. *-un-lft-identity84.6%

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

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

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

        if -9.9999999999999997e-148 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000002e-14

        1. Initial program 28.0%

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

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

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

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

        if 5.0000000000000002e-14 < (/.f64 #s(literal 1 binary64) n)

        1. Initial program 49.2%

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

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

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

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

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

      Alternative 5: 81.4% accurate, 0.9× speedup?

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

        1. Initial program 65.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 inf 84.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. mul-1-neg84.6%

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
        6. Step-by-step derivation
          1. div-inv84.6%

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

            \[\leadsto \frac{\color{blue}{{x}^{\left(\frac{1}{n}\right)}}}{x \cdot n} \]
          3. *-un-lft-identity84.6%

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

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

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

        if -9.9999999999999997e-148 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999991e-6

        1. Initial program 27.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 85.1%

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

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

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

        if 1.99999999999999991e-6 < (/.f64 #s(literal 1 binary64) n)

        1. Initial program 53.3%

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

          \[\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)} \]
      3. Recombined 3 regimes into one program.
      4. Final simplification83.9%

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

      Alternative 6: 70.7% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ t_1 := {x}^{\left(\frac{1}{n}\right)}\\ t_2 := 1 - t\_1\\ \mathbf{if}\;x \leq 4 \cdot 10^{-282}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{-270}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-214}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.75 \cdot 10^{-199}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{-78}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{-70}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{x}}{n}\right)\right)\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{-12}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{t\_1}{n}\\ \end{array} \end{array} \]
      (FPCore (x n)
       :precision binary64
       (let* ((t_0 (/ (log x) (- n))) (t_1 (pow x (/ 1.0 n))) (t_2 (- 1.0 t_1)))
         (if (<= x 4e-282)
           t_0
           (if (<= x 1.45e-270)
             t_2
             (if (<= x 5.5e-214)
               t_0
               (if (<= x 1.75e-199)
                 t_2
                 (if (<= x 1.2e-78)
                   t_0
                   (if (<= x 1.9e-70)
                     (log1p (expm1 (/ (/ 1.0 x) n)))
                     (if (<= x 5.6e-12) t_0 (* (/ 1.0 x) (/ t_1 n)))))))))))
      double code(double x, double n) {
      	double t_0 = log(x) / -n;
      	double t_1 = pow(x, (1.0 / n));
      	double t_2 = 1.0 - t_1;
      	double tmp;
      	if (x <= 4e-282) {
      		tmp = t_0;
      	} else if (x <= 1.45e-270) {
      		tmp = t_2;
      	} else if (x <= 5.5e-214) {
      		tmp = t_0;
      	} else if (x <= 1.75e-199) {
      		tmp = t_2;
      	} else if (x <= 1.2e-78) {
      		tmp = t_0;
      	} else if (x <= 1.9e-70) {
      		tmp = log1p(expm1(((1.0 / x) / n)));
      	} else if (x <= 5.6e-12) {
      		tmp = t_0;
      	} else {
      		tmp = (1.0 / x) * (t_1 / n);
      	}
      	return tmp;
      }
      
      public static double code(double x, double n) {
      	double t_0 = Math.log(x) / -n;
      	double t_1 = Math.pow(x, (1.0 / n));
      	double t_2 = 1.0 - t_1;
      	double tmp;
      	if (x <= 4e-282) {
      		tmp = t_0;
      	} else if (x <= 1.45e-270) {
      		tmp = t_2;
      	} else if (x <= 5.5e-214) {
      		tmp = t_0;
      	} else if (x <= 1.75e-199) {
      		tmp = t_2;
      	} else if (x <= 1.2e-78) {
      		tmp = t_0;
      	} else if (x <= 1.9e-70) {
      		tmp = Math.log1p(Math.expm1(((1.0 / x) / n)));
      	} else if (x <= 5.6e-12) {
      		tmp = t_0;
      	} else {
      		tmp = (1.0 / x) * (t_1 / n);
      	}
      	return tmp;
      }
      
      def code(x, n):
      	t_0 = math.log(x) / -n
      	t_1 = math.pow(x, (1.0 / n))
      	t_2 = 1.0 - t_1
      	tmp = 0
      	if x <= 4e-282:
      		tmp = t_0
      	elif x <= 1.45e-270:
      		tmp = t_2
      	elif x <= 5.5e-214:
      		tmp = t_0
      	elif x <= 1.75e-199:
      		tmp = t_2
      	elif x <= 1.2e-78:
      		tmp = t_0
      	elif x <= 1.9e-70:
      		tmp = math.log1p(math.expm1(((1.0 / x) / n)))
      	elif x <= 5.6e-12:
      		tmp = t_0
      	else:
      		tmp = (1.0 / x) * (t_1 / n)
      	return tmp
      
      function code(x, n)
      	t_0 = Float64(log(x) / Float64(-n))
      	t_1 = x ^ Float64(1.0 / n)
      	t_2 = Float64(1.0 - t_1)
      	tmp = 0.0
      	if (x <= 4e-282)
      		tmp = t_0;
      	elseif (x <= 1.45e-270)
      		tmp = t_2;
      	elseif (x <= 5.5e-214)
      		tmp = t_0;
      	elseif (x <= 1.75e-199)
      		tmp = t_2;
      	elseif (x <= 1.2e-78)
      		tmp = t_0;
      	elseif (x <= 1.9e-70)
      		tmp = log1p(expm1(Float64(Float64(1.0 / x) / n)));
      	elseif (x <= 5.6e-12)
      		tmp = t_0;
      	else
      		tmp = Float64(Float64(1.0 / x) * Float64(t_1 / n));
      	end
      	return tmp
      end
      
      code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - t$95$1), $MachinePrecision]}, If[LessEqual[x, 4e-282], t$95$0, If[LessEqual[x, 1.45e-270], t$95$2, If[LessEqual[x, 5.5e-214], t$95$0, If[LessEqual[x, 1.75e-199], t$95$2, If[LessEqual[x, 1.2e-78], t$95$0, If[LessEqual[x, 1.9e-70], N[Log[1 + N[(Exp[N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 5.6e-12], t$95$0, N[(N[(1.0 / x), $MachinePrecision] * N[(t$95$1 / n), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \frac{\log x}{-n}\\
      t_1 := {x}^{\left(\frac{1}{n}\right)}\\
      t_2 := 1 - t\_1\\
      \mathbf{if}\;x \leq 4 \cdot 10^{-282}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq 1.45 \cdot 10^{-270}:\\
      \;\;\;\;t\_2\\
      
      \mathbf{elif}\;x \leq 5.5 \cdot 10^{-214}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq 1.75 \cdot 10^{-199}:\\
      \;\;\;\;t\_2\\
      
      \mathbf{elif}\;x \leq 1.2 \cdot 10^{-78}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq 1.9 \cdot 10^{-70}:\\
      \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{x}}{n}\right)\right)\\
      
      \mathbf{elif}\;x \leq 5.6 \cdot 10^{-12}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{1}{x} \cdot \frac{t\_1}{n}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if x < 4.0000000000000001e-282 or 1.44999999999999991e-270 < x < 5.50000000000000024e-214 or 1.7499999999999999e-199 < x < 1.2e-78 or 1.8999999999999999e-70 < x < 5.6000000000000004e-12

        1. Initial program 26.3%

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

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

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

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

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

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

        if 4.0000000000000001e-282 < x < 1.44999999999999991e-270 or 5.50000000000000024e-214 < x < 1.7499999999999999e-199

        1. Initial program 92.6%

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

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

        if 1.2e-78 < x < 1.8999999999999999e-70

        1. Initial program 71.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 67.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 5.6000000000000004e-12 < x

        1. Initial program 60.5%

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
        6. Step-by-step derivation
          1. div-inv93.7%

            \[\leadsto \frac{e^{\color{blue}{\log x \cdot \frac{1}{n}}}}{x \cdot n} \]
          2. pow-to-exp93.7%

            \[\leadsto \frac{\color{blue}{{x}^{\left(\frac{1}{n}\right)}}}{x \cdot n} \]
          3. *-un-lft-identity93.7%

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4 \cdot 10^{-282}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{-270}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-214}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.75 \cdot 10^{-199}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{-78}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{-70}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{x}}{n}\right)\right)\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{-12}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 7: 81.2% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{1}{x \cdot n}\\ \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-147}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{t\_0}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-6}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+131}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{t\_1 \cdot t\_1}\\ \end{array} \end{array} \]
      (FPCore (x n)
       :precision binary64
       (let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ 1.0 (* x n))))
         (if (<= (/ 1.0 n) -1e-147)
           (* (/ 1.0 x) (/ t_0 n))
           (if (<= (/ 1.0 n) 2e-6)
             (/ (- (log1p x) (log x)) n)
             (if (<= (/ 1.0 n) 5e+131)
               (- (+ 1.0 (/ x n)) t_0)
               (sqrt (* t_1 t_1)))))))
      double code(double x, double n) {
      	double t_0 = pow(x, (1.0 / n));
      	double t_1 = 1.0 / (x * n);
      	double tmp;
      	if ((1.0 / n) <= -1e-147) {
      		tmp = (1.0 / x) * (t_0 / n);
      	} else if ((1.0 / n) <= 2e-6) {
      		tmp = (log1p(x) - log(x)) / n;
      	} else if ((1.0 / n) <= 5e+131) {
      		tmp = (1.0 + (x / n)) - t_0;
      	} else {
      		tmp = sqrt((t_1 * t_1));
      	}
      	return tmp;
      }
      
      public static double code(double x, double n) {
      	double t_0 = Math.pow(x, (1.0 / n));
      	double t_1 = 1.0 / (x * n);
      	double tmp;
      	if ((1.0 / n) <= -1e-147) {
      		tmp = (1.0 / x) * (t_0 / n);
      	} else if ((1.0 / n) <= 2e-6) {
      		tmp = (Math.log1p(x) - Math.log(x)) / n;
      	} else if ((1.0 / n) <= 5e+131) {
      		tmp = (1.0 + (x / n)) - t_0;
      	} else {
      		tmp = Math.sqrt((t_1 * t_1));
      	}
      	return tmp;
      }
      
      def code(x, n):
      	t_0 = math.pow(x, (1.0 / n))
      	t_1 = 1.0 / (x * n)
      	tmp = 0
      	if (1.0 / n) <= -1e-147:
      		tmp = (1.0 / x) * (t_0 / n)
      	elif (1.0 / n) <= 2e-6:
      		tmp = (math.log1p(x) - math.log(x)) / n
      	elif (1.0 / n) <= 5e+131:
      		tmp = (1.0 + (x / n)) - t_0
      	else:
      		tmp = math.sqrt((t_1 * t_1))
      	return tmp
      
      function code(x, n)
      	t_0 = x ^ Float64(1.0 / n)
      	t_1 = Float64(1.0 / Float64(x * n))
      	tmp = 0.0
      	if (Float64(1.0 / n) <= -1e-147)
      		tmp = Float64(Float64(1.0 / x) * Float64(t_0 / n));
      	elseif (Float64(1.0 / n) <= 2e-6)
      		tmp = Float64(Float64(log1p(x) - log(x)) / n);
      	elseif (Float64(1.0 / n) <= 5e+131)
      		tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0);
      	else
      		tmp = sqrt(Float64(t_1 * t_1));
      	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[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-147], N[(N[(1.0 / x), $MachinePrecision] * N[(t$95$0 / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-6], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+131], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[Sqrt[N[(t$95$1 * t$95$1), $MachinePrecision]], $MachinePrecision]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := {x}^{\left(\frac{1}{n}\right)}\\
      t_1 := \frac{1}{x \cdot n}\\
      \mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-147}:\\
      \;\;\;\;\frac{1}{x} \cdot \frac{t\_0}{n}\\
      
      \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-6}:\\
      \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
      
      \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+131}:\\
      \;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
      
      \mathbf{else}:\\
      \;\;\;\;\sqrt{t\_1 \cdot t\_1}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if (/.f64 #s(literal 1 binary64) n) < -9.9999999999999997e-148

        1. Initial program 65.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 inf 84.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. mul-1-neg84.6%

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
        6. Step-by-step derivation
          1. div-inv84.6%

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

            \[\leadsto \frac{\color{blue}{{x}^{\left(\frac{1}{n}\right)}}}{x \cdot n} \]
          3. *-un-lft-identity84.6%

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

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

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

        if -9.9999999999999997e-148 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999991e-6

        1. Initial program 27.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 85.1%

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

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

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

        if 1.99999999999999991e-6 < (/.f64 #s(literal 1 binary64) n) < 4.99999999999999995e131

        1. Initial program 78.3%

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

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

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

        1. Initial program 32.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 0.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. mul-1-neg0.6%

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{1}{x \cdot n}} \]
        9. Step-by-step derivation
          1. add-sqr-sqrt39.4%

            \[\leadsto \color{blue}{\sqrt{\frac{1}{x \cdot n}} \cdot \sqrt{\frac{1}{x \cdot n}}} \]
          2. sqrt-unprod77.2%

            \[\leadsto \color{blue}{\sqrt{\frac{1}{x \cdot n} \cdot \frac{1}{x \cdot n}}} \]
          3. inv-pow77.2%

            \[\leadsto \sqrt{\color{blue}{{\left(x \cdot n\right)}^{-1}} \cdot \frac{1}{x \cdot n}} \]
          4. inv-pow77.2%

            \[\leadsto \sqrt{{\left(x \cdot n\right)}^{-1} \cdot \color{blue}{{\left(x \cdot n\right)}^{-1}}} \]
          5. pow-prod-up77.2%

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

            \[\leadsto \sqrt{{\left(x \cdot n\right)}^{\color{blue}{-2}}} \]
        10. Applied egg-rr77.2%

          \[\leadsto \color{blue}{\sqrt{{\left(x \cdot n\right)}^{-2}}} \]
        11. Step-by-step derivation
          1. metadata-eval77.2%

            \[\leadsto \sqrt{{\left(x \cdot n\right)}^{\color{blue}{\left(-1 + -1\right)}}} \]
          2. pow-prod-up77.2%

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

            \[\leadsto \sqrt{\color{blue}{\frac{1}{x \cdot n}} \cdot {\left(x \cdot n\right)}^{-1}} \]
          4. inv-pow77.2%

            \[\leadsto \sqrt{\frac{1}{x \cdot n} \cdot \color{blue}{\frac{1}{x \cdot n}}} \]
        12. Applied egg-rr77.2%

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

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

      Alternative 8: 70.7% accurate, 1.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ t_1 := {x}^{\left(\frac{1}{n}\right)}\\ t_2 := 1 - t\_1\\ \mathbf{if}\;x \leq 4.1 \cdot 10^{-282}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{-271}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-214}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{-199}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-12}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{t\_1}{n}\\ \end{array} \end{array} \]
      (FPCore (x n)
       :precision binary64
       (let* ((t_0 (/ (log x) (- n))) (t_1 (pow x (/ 1.0 n))) (t_2 (- 1.0 t_1)))
         (if (<= x 4.1e-282)
           t_0
           (if (<= x 4.8e-271)
             t_2
             (if (<= x 5.5e-214)
               t_0
               (if (<= x 1.9e-199)
                 t_2
                 (if (<= x 5.5e-12) t_0 (* (/ 1.0 x) (/ t_1 n)))))))))
      double code(double x, double n) {
      	double t_0 = log(x) / -n;
      	double t_1 = pow(x, (1.0 / n));
      	double t_2 = 1.0 - t_1;
      	double tmp;
      	if (x <= 4.1e-282) {
      		tmp = t_0;
      	} else if (x <= 4.8e-271) {
      		tmp = t_2;
      	} else if (x <= 5.5e-214) {
      		tmp = t_0;
      	} else if (x <= 1.9e-199) {
      		tmp = t_2;
      	} else if (x <= 5.5e-12) {
      		tmp = t_0;
      	} else {
      		tmp = (1.0 / x) * (t_1 / n);
      	}
      	return tmp;
      }
      
      real(8) function code(x, n)
          real(8), intent (in) :: x
          real(8), intent (in) :: n
          real(8) :: t_0
          real(8) :: t_1
          real(8) :: t_2
          real(8) :: tmp
          t_0 = log(x) / -n
          t_1 = x ** (1.0d0 / n)
          t_2 = 1.0d0 - t_1
          if (x <= 4.1d-282) then
              tmp = t_0
          else if (x <= 4.8d-271) then
              tmp = t_2
          else if (x <= 5.5d-214) then
              tmp = t_0
          else if (x <= 1.9d-199) then
              tmp = t_2
          else if (x <= 5.5d-12) then
              tmp = t_0
          else
              tmp = (1.0d0 / x) * (t_1 / n)
          end if
          code = tmp
      end function
      
      public static double code(double x, double n) {
      	double t_0 = Math.log(x) / -n;
      	double t_1 = Math.pow(x, (1.0 / n));
      	double t_2 = 1.0 - t_1;
      	double tmp;
      	if (x <= 4.1e-282) {
      		tmp = t_0;
      	} else if (x <= 4.8e-271) {
      		tmp = t_2;
      	} else if (x <= 5.5e-214) {
      		tmp = t_0;
      	} else if (x <= 1.9e-199) {
      		tmp = t_2;
      	} else if (x <= 5.5e-12) {
      		tmp = t_0;
      	} else {
      		tmp = (1.0 / x) * (t_1 / n);
      	}
      	return tmp;
      }
      
      def code(x, n):
      	t_0 = math.log(x) / -n
      	t_1 = math.pow(x, (1.0 / n))
      	t_2 = 1.0 - t_1
      	tmp = 0
      	if x <= 4.1e-282:
      		tmp = t_0
      	elif x <= 4.8e-271:
      		tmp = t_2
      	elif x <= 5.5e-214:
      		tmp = t_0
      	elif x <= 1.9e-199:
      		tmp = t_2
      	elif x <= 5.5e-12:
      		tmp = t_0
      	else:
      		tmp = (1.0 / x) * (t_1 / n)
      	return tmp
      
      function code(x, n)
      	t_0 = Float64(log(x) / Float64(-n))
      	t_1 = x ^ Float64(1.0 / n)
      	t_2 = Float64(1.0 - t_1)
      	tmp = 0.0
      	if (x <= 4.1e-282)
      		tmp = t_0;
      	elseif (x <= 4.8e-271)
      		tmp = t_2;
      	elseif (x <= 5.5e-214)
      		tmp = t_0;
      	elseif (x <= 1.9e-199)
      		tmp = t_2;
      	elseif (x <= 5.5e-12)
      		tmp = t_0;
      	else
      		tmp = Float64(Float64(1.0 / x) * Float64(t_1 / n));
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, n)
      	t_0 = log(x) / -n;
      	t_1 = x ^ (1.0 / n);
      	t_2 = 1.0 - t_1;
      	tmp = 0.0;
      	if (x <= 4.1e-282)
      		tmp = t_0;
      	elseif (x <= 4.8e-271)
      		tmp = t_2;
      	elseif (x <= 5.5e-214)
      		tmp = t_0;
      	elseif (x <= 1.9e-199)
      		tmp = t_2;
      	elseif (x <= 5.5e-12)
      		tmp = t_0;
      	else
      		tmp = (1.0 / x) * (t_1 / n);
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - t$95$1), $MachinePrecision]}, If[LessEqual[x, 4.1e-282], t$95$0, If[LessEqual[x, 4.8e-271], t$95$2, If[LessEqual[x, 5.5e-214], t$95$0, If[LessEqual[x, 1.9e-199], t$95$2, If[LessEqual[x, 5.5e-12], t$95$0, N[(N[(1.0 / x), $MachinePrecision] * N[(t$95$1 / n), $MachinePrecision]), $MachinePrecision]]]]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \frac{\log x}{-n}\\
      t_1 := {x}^{\left(\frac{1}{n}\right)}\\
      t_2 := 1 - t\_1\\
      \mathbf{if}\;x \leq 4.1 \cdot 10^{-282}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq 4.8 \cdot 10^{-271}:\\
      \;\;\;\;t\_2\\
      
      \mathbf{elif}\;x \leq 5.5 \cdot 10^{-214}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq 1.9 \cdot 10^{-199}:\\
      \;\;\;\;t\_2\\
      
      \mathbf{elif}\;x \leq 5.5 \cdot 10^{-12}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{1}{x} \cdot \frac{t\_1}{n}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if x < 4.09999999999999977e-282 or 4.8000000000000005e-271 < x < 5.50000000000000024e-214 or 1.8999999999999999e-199 < x < 5.5000000000000004e-12

        1. Initial program 29.3%

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

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

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

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

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

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

        if 4.09999999999999977e-282 < x < 4.8000000000000005e-271 or 5.50000000000000024e-214 < x < 1.8999999999999999e-199

        1. Initial program 92.6%

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

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

        if 5.5000000000000004e-12 < x

        1. Initial program 60.5%

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
        6. Step-by-step derivation
          1. div-inv93.7%

            \[\leadsto \frac{e^{\color{blue}{\log x \cdot \frac{1}{n}}}}{x \cdot n} \]
          2. pow-to-exp93.7%

            \[\leadsto \frac{\color{blue}{{x}^{\left(\frac{1}{n}\right)}}}{x \cdot n} \]
          3. *-un-lft-identity93.7%

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4.1 \cdot 10^{-282}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{-271}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-214}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{-199}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-12}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 9: 70.6% accurate, 1.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ t_1 := 1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;x \leq 1.25 \cdot 10^{-282}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 8.4 \cdot 10^{-271}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-215}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-197}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 1.72 \cdot 10^{-12}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\ \end{array} \end{array} \]
      (FPCore (x n)
       :precision binary64
       (let* ((t_0 (/ (log x) (- n))) (t_1 (- 1.0 (pow x (/ 1.0 n)))))
         (if (<= x 1.25e-282)
           t_0
           (if (<= x 8.4e-271)
             t_1
             (if (<= x 3.2e-215)
               t_0
               (if (<= x 9.5e-197)
                 t_1
                 (if (<= x 1.72e-12) t_0 (/ (pow x (+ (/ 1.0 n) -1.0)) n))))))))
      double code(double x, double n) {
      	double t_0 = log(x) / -n;
      	double t_1 = 1.0 - pow(x, (1.0 / n));
      	double tmp;
      	if (x <= 1.25e-282) {
      		tmp = t_0;
      	} else if (x <= 8.4e-271) {
      		tmp = t_1;
      	} else if (x <= 3.2e-215) {
      		tmp = t_0;
      	} else if (x <= 9.5e-197) {
      		tmp = t_1;
      	} else if (x <= 1.72e-12) {
      		tmp = t_0;
      	} else {
      		tmp = pow(x, ((1.0 / n) + -1.0)) / n;
      	}
      	return tmp;
      }
      
      real(8) function code(x, n)
          real(8), intent (in) :: x
          real(8), intent (in) :: n
          real(8) :: t_0
          real(8) :: t_1
          real(8) :: tmp
          t_0 = log(x) / -n
          t_1 = 1.0d0 - (x ** (1.0d0 / n))
          if (x <= 1.25d-282) then
              tmp = t_0
          else if (x <= 8.4d-271) then
              tmp = t_1
          else if (x <= 3.2d-215) then
              tmp = t_0
          else if (x <= 9.5d-197) then
              tmp = t_1
          else if (x <= 1.72d-12) then
              tmp = t_0
          else
              tmp = (x ** ((1.0d0 / n) + (-1.0d0))) / n
          end if
          code = tmp
      end function
      
      public static double code(double x, double n) {
      	double t_0 = Math.log(x) / -n;
      	double t_1 = 1.0 - Math.pow(x, (1.0 / n));
      	double tmp;
      	if (x <= 1.25e-282) {
      		tmp = t_0;
      	} else if (x <= 8.4e-271) {
      		tmp = t_1;
      	} else if (x <= 3.2e-215) {
      		tmp = t_0;
      	} else if (x <= 9.5e-197) {
      		tmp = t_1;
      	} else if (x <= 1.72e-12) {
      		tmp = t_0;
      	} else {
      		tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
      	}
      	return tmp;
      }
      
      def code(x, n):
      	t_0 = math.log(x) / -n
      	t_1 = 1.0 - math.pow(x, (1.0 / n))
      	tmp = 0
      	if x <= 1.25e-282:
      		tmp = t_0
      	elif x <= 8.4e-271:
      		tmp = t_1
      	elif x <= 3.2e-215:
      		tmp = t_0
      	elif x <= 9.5e-197:
      		tmp = t_1
      	elif x <= 1.72e-12:
      		tmp = t_0
      	else:
      		tmp = math.pow(x, ((1.0 / n) + -1.0)) / n
      	return tmp
      
      function code(x, n)
      	t_0 = Float64(log(x) / Float64(-n))
      	t_1 = Float64(1.0 - (x ^ Float64(1.0 / n)))
      	tmp = 0.0
      	if (x <= 1.25e-282)
      		tmp = t_0;
      	elseif (x <= 8.4e-271)
      		tmp = t_1;
      	elseif (x <= 3.2e-215)
      		tmp = t_0;
      	elseif (x <= 9.5e-197)
      		tmp = t_1;
      	elseif (x <= 1.72e-12)
      		tmp = t_0;
      	else
      		tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n);
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, n)
      	t_0 = log(x) / -n;
      	t_1 = 1.0 - (x ^ (1.0 / n));
      	tmp = 0.0;
      	if (x <= 1.25e-282)
      		tmp = t_0;
      	elseif (x <= 8.4e-271)
      		tmp = t_1;
      	elseif (x <= 3.2e-215)
      		tmp = t_0;
      	elseif (x <= 9.5e-197)
      		tmp = t_1;
      	elseif (x <= 1.72e-12)
      		tmp = t_0;
      	else
      		tmp = (x ^ ((1.0 / n) + -1.0)) / n;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.25e-282], t$95$0, If[LessEqual[x, 8.4e-271], t$95$1, If[LessEqual[x, 3.2e-215], t$95$0, If[LessEqual[x, 9.5e-197], t$95$1, If[LessEqual[x, 1.72e-12], t$95$0, N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]]]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \frac{\log x}{-n}\\
      t_1 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
      \mathbf{if}\;x \leq 1.25 \cdot 10^{-282}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq 8.4 \cdot 10^{-271}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;x \leq 3.2 \cdot 10^{-215}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq 9.5 \cdot 10^{-197}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;x \leq 1.72 \cdot 10^{-12}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if x < 1.25e-282 or 8.4000000000000003e-271 < x < 3.2000000000000001e-215 or 9.5000000000000003e-197 < x < 1.7199999999999999e-12

        1. Initial program 29.3%

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

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

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

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

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

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

        if 1.25e-282 < x < 8.4000000000000003e-271 or 3.2000000000000001e-215 < x < 9.5000000000000003e-197

        1. Initial program 92.6%

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

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

        if 1.7199999999999999e-12 < x

        1. Initial program 60.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.25 \cdot 10^{-282}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 8.4 \cdot 10^{-271}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-215}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-197}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 1.72 \cdot 10^{-12}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 10: 56.2% accurate, 1.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ t_1 := 1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;x \leq 1.75 \cdot 10^{-282}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 6.2 \cdot 10^{-271}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 3.65 \cdot 10^{-214}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.76 \cdot 10^{-199}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 0.00145:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{n}\\ \end{array} \end{array} \]
      (FPCore (x n)
       :precision binary64
       (let* ((t_0 (/ (log x) (- n))) (t_1 (- 1.0 (pow x (/ 1.0 n)))))
         (if (<= x 1.75e-282)
           t_0
           (if (<= x 6.2e-271)
             t_1
             (if (<= x 3.65e-214)
               t_0
               (if (<= x 1.76e-199) t_1 (if (<= x 0.00145) t_0 (/ (/ 1.0 x) n))))))))
      double code(double x, double n) {
      	double t_0 = log(x) / -n;
      	double t_1 = 1.0 - pow(x, (1.0 / n));
      	double tmp;
      	if (x <= 1.75e-282) {
      		tmp = t_0;
      	} else if (x <= 6.2e-271) {
      		tmp = t_1;
      	} else if (x <= 3.65e-214) {
      		tmp = t_0;
      	} else if (x <= 1.76e-199) {
      		tmp = t_1;
      	} else if (x <= 0.00145) {
      		tmp = t_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) :: t_0
          real(8) :: t_1
          real(8) :: tmp
          t_0 = log(x) / -n
          t_1 = 1.0d0 - (x ** (1.0d0 / n))
          if (x <= 1.75d-282) then
              tmp = t_0
          else if (x <= 6.2d-271) then
              tmp = t_1
          else if (x <= 3.65d-214) then
              tmp = t_0
          else if (x <= 1.76d-199) then
              tmp = t_1
          else if (x <= 0.00145d0) then
              tmp = t_0
          else
              tmp = (1.0d0 / x) / n
          end if
          code = tmp
      end function
      
      public static double code(double x, double n) {
      	double t_0 = Math.log(x) / -n;
      	double t_1 = 1.0 - Math.pow(x, (1.0 / n));
      	double tmp;
      	if (x <= 1.75e-282) {
      		tmp = t_0;
      	} else if (x <= 6.2e-271) {
      		tmp = t_1;
      	} else if (x <= 3.65e-214) {
      		tmp = t_0;
      	} else if (x <= 1.76e-199) {
      		tmp = t_1;
      	} else if (x <= 0.00145) {
      		tmp = t_0;
      	} else {
      		tmp = (1.0 / x) / n;
      	}
      	return tmp;
      }
      
      def code(x, n):
      	t_0 = math.log(x) / -n
      	t_1 = 1.0 - math.pow(x, (1.0 / n))
      	tmp = 0
      	if x <= 1.75e-282:
      		tmp = t_0
      	elif x <= 6.2e-271:
      		tmp = t_1
      	elif x <= 3.65e-214:
      		tmp = t_0
      	elif x <= 1.76e-199:
      		tmp = t_1
      	elif x <= 0.00145:
      		tmp = t_0
      	else:
      		tmp = (1.0 / x) / n
      	return tmp
      
      function code(x, n)
      	t_0 = Float64(log(x) / Float64(-n))
      	t_1 = Float64(1.0 - (x ^ Float64(1.0 / n)))
      	tmp = 0.0
      	if (x <= 1.75e-282)
      		tmp = t_0;
      	elseif (x <= 6.2e-271)
      		tmp = t_1;
      	elseif (x <= 3.65e-214)
      		tmp = t_0;
      	elseif (x <= 1.76e-199)
      		tmp = t_1;
      	elseif (x <= 0.00145)
      		tmp = t_0;
      	else
      		tmp = Float64(Float64(1.0 / x) / n);
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, n)
      	t_0 = log(x) / -n;
      	t_1 = 1.0 - (x ^ (1.0 / n));
      	tmp = 0.0;
      	if (x <= 1.75e-282)
      		tmp = t_0;
      	elseif (x <= 6.2e-271)
      		tmp = t_1;
      	elseif (x <= 3.65e-214)
      		tmp = t_0;
      	elseif (x <= 1.76e-199)
      		tmp = t_1;
      	elseif (x <= 0.00145)
      		tmp = t_0;
      	else
      		tmp = (1.0 / x) / n;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.75e-282], t$95$0, If[LessEqual[x, 6.2e-271], t$95$1, If[LessEqual[x, 3.65e-214], t$95$0, If[LessEqual[x, 1.76e-199], t$95$1, If[LessEqual[x, 0.00145], t$95$0, N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \frac{\log x}{-n}\\
      t_1 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
      \mathbf{if}\;x \leq 1.75 \cdot 10^{-282}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq 6.2 \cdot 10^{-271}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;x \leq 3.65 \cdot 10^{-214}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq 1.76 \cdot 10^{-199}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;x \leq 0.00145:\\
      \;\;\;\;t\_0\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\frac{1}{x}}{n}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if x < 1.75000000000000003e-282 or 6.1999999999999998e-271 < x < 3.65000000000000015e-214 or 1.76000000000000011e-199 < x < 0.00145

        1. Initial program 30.1%

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

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

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

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

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

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

        if 1.75000000000000003e-282 < x < 6.1999999999999998e-271 or 3.65000000000000015e-214 < x < 1.76000000000000011e-199

        1. Initial program 92.6%

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

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

        if 0.00145 < x

        1. Initial program 60.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 95.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. mul-1-neg95.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.75 \cdot 10^{-282}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 6.2 \cdot 10^{-271}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 3.65 \cdot 10^{-214}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.76 \cdot 10^{-199}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.00145:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{n}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 11: 56.6% accurate, 1.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.00145:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{n}\\ \end{array} \end{array} \]
      (FPCore (x n)
       :precision binary64
       (if (<= x 0.00145) (/ (log x) (- n)) (/ (/ 1.0 x) n)))
      double code(double x, double n) {
      	double tmp;
      	if (x <= 0.00145) {
      		tmp = log(x) / -n;
      	} 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 (x <= 0.00145d0) then
              tmp = log(x) / -n
          else
              tmp = (1.0d0 / x) / n
          end if
          code = tmp
      end function
      
      public static double code(double x, double n) {
      	double tmp;
      	if (x <= 0.00145) {
      		tmp = Math.log(x) / -n;
      	} else {
      		tmp = (1.0 / x) / n;
      	}
      	return tmp;
      }
      
      def code(x, n):
      	tmp = 0
      	if x <= 0.00145:
      		tmp = math.log(x) / -n
      	else:
      		tmp = (1.0 / x) / n
      	return tmp
      
      function code(x, n)
      	tmp = 0.0
      	if (x <= 0.00145)
      		tmp = Float64(log(x) / Float64(-n));
      	else
      		tmp = Float64(Float64(1.0 / x) / n);
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, n)
      	tmp = 0.0;
      	if (x <= 0.00145)
      		tmp = log(x) / -n;
      	else
      		tmp = (1.0 / x) / n;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, n_] := If[LessEqual[x, 0.00145], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;x \leq 0.00145:\\
      \;\;\;\;\frac{\log x}{-n}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\frac{1}{x}}{n}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if x < 0.00145

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

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

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

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

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

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

        if 0.00145 < x

        1. Initial program 60.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 95.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. mul-1-neg95.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 12: 39.9% accurate, 42.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 13: 40.3% 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 45.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 53.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{1 \cdot \frac{\frac{1}{x}}{n}} \]
      11. Final simplification38.2%

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

      Reproduce

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