2nthrt (problem 3.4.6)

Percentage Accurate: 53.0% → 91.8%
Time: 1.6min
Alternatives: 18
Speedup: 1.7×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 18 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.0% 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: 91.8% accurate, 0.2× speedup?

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

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

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


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

    1. Initial program 43.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 75.8%

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

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

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

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

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

    if 3.8e5 < x

    1. Initial program 69.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 inf 98.4%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 86.5% accurate, 0.2× speedup?

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

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

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


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

    1. Initial program 42.9%

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

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

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

    if 0.022499999999999999 < x

    1. Initial program 69.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 inf 97.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. associate-/r*98.2%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 86.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.014:\\ \;\;\;\;\frac{\frac{-0.16666666666666666 \cdot \frac{{\log x}^{3}}{n} + {\log x}^{2} \cdot -0.5}{n} - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= x 0.014)
   (/
    (-
     (/
      (+
       (* -0.16666666666666666 (/ (pow (log x) 3.0) n))
       (* (pow (log x) 2.0) -0.5))
      n)
     (log x))
    n)
   (/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
	double tmp;
	if (x <= 0.014) {
		tmp = ((((-0.16666666666666666 * (pow(log(x), 3.0) / n)) + (pow(log(x), 2.0) * -0.5)) / n) - log(x)) / n;
	} else {
		tmp = (pow(x, (1.0 / n)) / n) / x;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: tmp
    if (x <= 0.014d0) then
        tmp = (((((-0.16666666666666666d0) * ((log(x) ** 3.0d0) / n)) + ((log(x) ** 2.0d0) * (-0.5d0))) / n) - log(x)) / n
    else
        tmp = ((x ** (1.0d0 / n)) / n) / x
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double tmp;
	if (x <= 0.014) {
		tmp = ((((-0.16666666666666666 * (Math.pow(Math.log(x), 3.0) / n)) + (Math.pow(Math.log(x), 2.0) * -0.5)) / n) - Math.log(x)) / n;
	} else {
		tmp = (Math.pow(x, (1.0 / n)) / n) / x;
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if x <= 0.014:
		tmp = ((((-0.16666666666666666 * (math.pow(math.log(x), 3.0) / n)) + (math.pow(math.log(x), 2.0) * -0.5)) / n) - math.log(x)) / n
	else:
		tmp = (math.pow(x, (1.0 / n)) / n) / x
	return tmp
function code(x, n)
	tmp = 0.0
	if (x <= 0.014)
		tmp = Float64(Float64(Float64(Float64(Float64(-0.16666666666666666 * Float64((log(x) ^ 3.0) / n)) + Float64((log(x) ^ 2.0) * -0.5)) / n) - log(x)) / n);
	else
		tmp = Float64(Float64((x ^ Float64(1.0 / n)) / n) / x);
	end
	return tmp
end
function tmp_2 = code(x, n)
	tmp = 0.0;
	if (x <= 0.014)
		tmp = ((((-0.16666666666666666 * ((log(x) ^ 3.0) / n)) + ((log(x) ^ 2.0) * -0.5)) / n) - log(x)) / n;
	else
		tmp = ((x ^ (1.0 / n)) / n) / x;
	end
	tmp_2 = tmp;
end
code[x_, n_] := If[LessEqual[x, 0.014], N[(N[(N[(N[(N[(-0.16666666666666666 * N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.014:\\
\;\;\;\;\frac{\frac{-0.16666666666666666 \cdot \frac{{\log x}^{3}}{n} + {\log x}^{2} \cdot -0.5}{n} - \log x}{n}\\

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


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

    1. Initial program 42.9%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{-0.16666666666666666 \cdot \frac{{\log x}^{3}}{n} - 0.5 \cdot {\log x}^{2}}{n} - -1 \cdot \log x}{n}} \]
    7. Step-by-step derivation
      1. mul-1-neg76.5%

        \[\leadsto \color{blue}{-\frac{-1 \cdot \frac{-0.16666666666666666 \cdot \frac{{\log x}^{3}}{n} - 0.5 \cdot {\log x}^{2}}{n} - -1 \cdot \log x}{n}} \]
    8. Simplified76.5%

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

    if 0.0140000000000000003 < x

    1. Initial program 69.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 inf 97.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. associate-/r*98.2%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 86.3% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-14}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{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) < -2.00000000000000002e-35

    1. Initial program 92.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 inf 97.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. associate-/r*97.6%

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 35.2%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 48.9%

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

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

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

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

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

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

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

      \[\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. Add Preprocessing

Alternative 5: 86.3% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 92.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 inf 97.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. associate-/r*97.6%

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

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

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

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

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

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

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

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

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

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

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

    if -2.00000000000000002e-35 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000007e-10

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

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

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

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

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

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

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

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

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

    if 2.00000000000000007e-10 < (/.f64 #s(literal 1 binary64) n)

    1. Initial program 50.0%

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

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

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

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

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

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

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

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

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

Alternative 6: 68.2% accurate, 1.6× speedup?

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

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

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

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

\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+162}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{n}{x}}{{n}^{2}}\\


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\log \left(\frac{x + 1}{x}\right)}}{n} \]
    10. Taylor expanded in x around inf 67.8%

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

    if -2e98 < (/.f64 #s(literal 1 binary64) n) < -1e11 or 2.00000000000000007e-10 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e162

    1. Initial program 83.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 72.3%

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

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

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

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

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

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

    if -1e11 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000007e-10

    1. Initial program 34.7%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 24.7%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\mathsf{log1p}\left(x\right) - \log x\right) \cdot \frac{1}{n}} \]
    8. Step-by-step derivation
      1. div-inv13.0%

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

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

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

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) \cdot n - n \cdot \log x}{\color{blue}{{n}^{2}}} \]
    9. Applied egg-rr94.6%

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

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

        \[\leadsto \frac{\color{blue}{n \cdot \left(\mathsf{log1p}\left(x\right) - \log x\right)}}{{n}^{2}} \]
    11. Simplified94.6%

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

      \[\leadsto \frac{\color{blue}{\frac{n}{x}}}{{n}^{2}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification74.8%

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

Alternative 7: 82.2% accurate, 1.6× speedup?

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

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

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

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

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


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

    1. Initial program 92.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 inf 97.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. associate-/r*97.6%

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 35.2%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 72.5%

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

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

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

    1. Initial program 28.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 0.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. associate-/r*1.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 82.5% accurate, 1.6× speedup?

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

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\frac{n}{x}}{{n}^{2}}\\


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

    1. Initial program 92.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 inf 97.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. associate-/r*97.6%

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 35.2%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 66.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 64.9%

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

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

    1. Initial program 24.7%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\mathsf{log1p}\left(x\right) - \log x\right) \cdot \frac{1}{n}} \]
    8. Step-by-step derivation
      1. div-inv13.0%

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

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

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

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) \cdot n - n \cdot \log x}{\color{blue}{{n}^{2}}} \]
    9. Applied egg-rr94.6%

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

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

        \[\leadsto \frac{\color{blue}{n \cdot \left(\mathsf{log1p}\left(x\right) - \log x\right)}}{{n}^{2}} \]
    11. Simplified94.6%

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

      \[\leadsto \frac{\color{blue}{\frac{n}{x}}}{{n}^{2}} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 9: 59.0% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ t_1 := \frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} + \frac{-0.5}{n}}{x}}{x}\\ \mathbf{if}\;x \leq 1.2 \cdot 10^{-161}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 5.4 \cdot 10^{-139}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-131}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-74}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{+151}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{n}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (/ (log x) (- n)))
        (t_1
         (/
          (+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* x n)) (/ -0.5 n)) x))
          x)))
   (if (<= x 1.2e-161)
     t_0
     (if (<= x 5.4e-139)
       t_1
       (if (<= x 7e-131)
         t_0
         (if (<= x 9e-74)
           t_1
           (if (<= x 0.88)
             (/ (- x (log x)) n)
             (if (<= x 2.1e+151)
               (/
                (/
                 (+
                  1.0
                  (/
                   (- (/ (- 0.3333333333333333 (* 0.25 (/ 1.0 x))) x) 0.5)
                   x))
                 x)
                n)
               (/ 0.0 n)))))))))
double code(double x, double n) {
	double t_0 = log(x) / -n;
	double t_1 = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x;
	double tmp;
	if (x <= 1.2e-161) {
		tmp = t_0;
	} else if (x <= 5.4e-139) {
		tmp = t_1;
	} else if (x <= 7e-131) {
		tmp = t_0;
	} else if (x <= 9e-74) {
		tmp = t_1;
	} else if (x <= 0.88) {
		tmp = (x - log(x)) / n;
	} else if (x <= 2.1e+151) {
		tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n;
	} else {
		tmp = 0.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 / n) + (((0.3333333333333333d0 / (x * n)) + ((-0.5d0) / n)) / x)) / x
    if (x <= 1.2d-161) then
        tmp = t_0
    else if (x <= 5.4d-139) then
        tmp = t_1
    else if (x <= 7d-131) then
        tmp = t_0
    else if (x <= 9d-74) then
        tmp = t_1
    else if (x <= 0.88d0) then
        tmp = (x - log(x)) / n
    else if (x <= 2.1d+151) then
        tmp = ((1.0d0 + ((((0.3333333333333333d0 - (0.25d0 * (1.0d0 / x))) / x) - 0.5d0) / x)) / x) / n
    else
        tmp = 0.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 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x;
	double tmp;
	if (x <= 1.2e-161) {
		tmp = t_0;
	} else if (x <= 5.4e-139) {
		tmp = t_1;
	} else if (x <= 7e-131) {
		tmp = t_0;
	} else if (x <= 9e-74) {
		tmp = t_1;
	} else if (x <= 0.88) {
		tmp = (x - Math.log(x)) / n;
	} else if (x <= 2.1e+151) {
		tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n;
	} else {
		tmp = 0.0 / n;
	}
	return tmp;
}
def code(x, n):
	t_0 = math.log(x) / -n
	t_1 = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x
	tmp = 0
	if x <= 1.2e-161:
		tmp = t_0
	elif x <= 5.4e-139:
		tmp = t_1
	elif x <= 7e-131:
		tmp = t_0
	elif x <= 9e-74:
		tmp = t_1
	elif x <= 0.88:
		tmp = (x - math.log(x)) / n
	elif x <= 2.1e+151:
		tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n
	else:
		tmp = 0.0 / n
	return tmp
function code(x, n)
	t_0 = Float64(log(x) / Float64(-n))
	t_1 = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(x * n)) + Float64(-0.5 / n)) / x)) / x)
	tmp = 0.0
	if (x <= 1.2e-161)
		tmp = t_0;
	elseif (x <= 5.4e-139)
		tmp = t_1;
	elseif (x <= 7e-131)
		tmp = t_0;
	elseif (x <= 9e-74)
		tmp = t_1;
	elseif (x <= 0.88)
		tmp = Float64(Float64(x - log(x)) / n);
	elseif (x <= 2.1e+151)
		tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 - Float64(0.25 * Float64(1.0 / x))) / x) - 0.5) / x)) / x) / n);
	else
		tmp = Float64(0.0 / n);
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = log(x) / -n;
	t_1 = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x;
	tmp = 0.0;
	if (x <= 1.2e-161)
		tmp = t_0;
	elseif (x <= 5.4e-139)
		tmp = t_1;
	elseif (x <= 7e-131)
		tmp = t_0;
	elseif (x <= 9e-74)
		tmp = t_1;
	elseif (x <= 0.88)
		tmp = (x - log(x)) / n;
	elseif (x <= 2.1e+151)
		tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n;
	else
		tmp = 0.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[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[x, 1.2e-161], t$95$0, If[LessEqual[x, 5.4e-139], t$95$1, If[LessEqual[x, 7e-131], t$95$0, If[LessEqual[x, 9e-74], t$95$1, If[LessEqual[x, 0.88], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 2.1e+151], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 - N[(0.25 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
t_1 := \frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} + \frac{-0.5}{n}}{x}}{x}\\
\mathbf{if}\;x \leq 1.2 \cdot 10^{-161}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 5.4 \cdot 10^{-139}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 7 \cdot 10^{-131}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 9 \cdot 10^{-74}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \leq 2.1 \cdot 10^{+151}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x} - 0.5}{x}}{x}}{n}\\

\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < 1.19999999999999999e-161 or 5.3999999999999997e-139 < x < 7.0000000000000004e-131

    1. Initial program 39.0%

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

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

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

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

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

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

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

    if 1.19999999999999999e-161 < x < 5.3999999999999997e-139 or 7.0000000000000004e-131 < x < 8.9999999999999998e-74

    1. Initial program 55.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 30.6%

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

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

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

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

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

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

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

      if 8.9999999999999998e-74 < x < 0.880000000000000004

      1. Initial program 39.5%

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

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

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

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

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

      if 0.880000000000000004 < x < 2.1000000000000001e151

      1. Initial program 46.9%

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

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

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

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

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

      if 2.1000000000000001e151 < x

      1. Initial program 90.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 90.3%

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\log \left(\frac{x + 1}{x}\right)}}{n} \]
      10. Taylor expanded in x around inf 90.3%

        \[\leadsto \frac{\log \color{blue}{1}}{n} \]
    10. Recombined 5 regimes into one program.
    11. Final simplification70.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.2 \cdot 10^{-161}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 5.4 \cdot 10^{-139}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} + \frac{-0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-131}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-74}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} + \frac{-0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{+151}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{n}\\ \end{array} \]
    12. Add Preprocessing

    Alternative 10: 58.7% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ t_1 := \frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} + \frac{-0.5}{n}}{x}}{x}\\ \mathbf{if}\;x \leq 1.15 \cdot 10^{-161}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{-139}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{-131}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 7.5 \cdot 10^{-74}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 0.7:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{+150}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{n}\\ \end{array} \end{array} \]
    (FPCore (x n)
     :precision binary64
     (let* ((t_0 (/ (log x) (- n)))
            (t_1
             (/
              (+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* x n)) (/ -0.5 n)) x))
              x)))
       (if (<= x 1.15e-161)
         t_0
         (if (<= x 4.2e-139)
           t_1
           (if (<= x 3.3e-131)
             t_0
             (if (<= x 7.5e-74)
               t_1
               (if (<= x 0.7)
                 t_0
                 (if (<= x 3.3e+150)
                   (/
                    (/
                     (+
                      1.0
                      (/
                       (- (/ (- 0.3333333333333333 (* 0.25 (/ 1.0 x))) x) 0.5)
                       x))
                     x)
                    n)
                   (/ 0.0 n)))))))))
    double code(double x, double n) {
    	double t_0 = log(x) / -n;
    	double t_1 = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x;
    	double tmp;
    	if (x <= 1.15e-161) {
    		tmp = t_0;
    	} else if (x <= 4.2e-139) {
    		tmp = t_1;
    	} else if (x <= 3.3e-131) {
    		tmp = t_0;
    	} else if (x <= 7.5e-74) {
    		tmp = t_1;
    	} else if (x <= 0.7) {
    		tmp = t_0;
    	} else if (x <= 3.3e+150) {
    		tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n;
    	} else {
    		tmp = 0.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 / n) + (((0.3333333333333333d0 / (x * n)) + ((-0.5d0) / n)) / x)) / x
        if (x <= 1.15d-161) then
            tmp = t_0
        else if (x <= 4.2d-139) then
            tmp = t_1
        else if (x <= 3.3d-131) then
            tmp = t_0
        else if (x <= 7.5d-74) then
            tmp = t_1
        else if (x <= 0.7d0) then
            tmp = t_0
        else if (x <= 3.3d+150) then
            tmp = ((1.0d0 + ((((0.3333333333333333d0 - (0.25d0 * (1.0d0 / x))) / x) - 0.5d0) / x)) / x) / n
        else
            tmp = 0.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 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x;
    	double tmp;
    	if (x <= 1.15e-161) {
    		tmp = t_0;
    	} else if (x <= 4.2e-139) {
    		tmp = t_1;
    	} else if (x <= 3.3e-131) {
    		tmp = t_0;
    	} else if (x <= 7.5e-74) {
    		tmp = t_1;
    	} else if (x <= 0.7) {
    		tmp = t_0;
    	} else if (x <= 3.3e+150) {
    		tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n;
    	} else {
    		tmp = 0.0 / n;
    	}
    	return tmp;
    }
    
    def code(x, n):
    	t_0 = math.log(x) / -n
    	t_1 = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x
    	tmp = 0
    	if x <= 1.15e-161:
    		tmp = t_0
    	elif x <= 4.2e-139:
    		tmp = t_1
    	elif x <= 3.3e-131:
    		tmp = t_0
    	elif x <= 7.5e-74:
    		tmp = t_1
    	elif x <= 0.7:
    		tmp = t_0
    	elif x <= 3.3e+150:
    		tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n
    	else:
    		tmp = 0.0 / n
    	return tmp
    
    function code(x, n)
    	t_0 = Float64(log(x) / Float64(-n))
    	t_1 = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(x * n)) + Float64(-0.5 / n)) / x)) / x)
    	tmp = 0.0
    	if (x <= 1.15e-161)
    		tmp = t_0;
    	elseif (x <= 4.2e-139)
    		tmp = t_1;
    	elseif (x <= 3.3e-131)
    		tmp = t_0;
    	elseif (x <= 7.5e-74)
    		tmp = t_1;
    	elseif (x <= 0.7)
    		tmp = t_0;
    	elseif (x <= 3.3e+150)
    		tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 - Float64(0.25 * Float64(1.0 / x))) / x) - 0.5) / x)) / x) / n);
    	else
    		tmp = Float64(0.0 / n);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, n)
    	t_0 = log(x) / -n;
    	t_1 = ((1.0 / n) + (((0.3333333333333333 / (x * n)) + (-0.5 / n)) / x)) / x;
    	tmp = 0.0;
    	if (x <= 1.15e-161)
    		tmp = t_0;
    	elseif (x <= 4.2e-139)
    		tmp = t_1;
    	elseif (x <= 3.3e-131)
    		tmp = t_0;
    	elseif (x <= 7.5e-74)
    		tmp = t_1;
    	elseif (x <= 0.7)
    		tmp = t_0;
    	elseif (x <= 3.3e+150)
    		tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n;
    	else
    		tmp = 0.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[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[x, 1.15e-161], t$95$0, If[LessEqual[x, 4.2e-139], t$95$1, If[LessEqual[x, 3.3e-131], t$95$0, If[LessEqual[x, 7.5e-74], t$95$1, If[LessEqual[x, 0.7], t$95$0, If[LessEqual[x, 3.3e+150], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 - N[(0.25 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{\log x}{-n}\\
    t_1 := \frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} + \frac{-0.5}{n}}{x}}{x}\\
    \mathbf{if}\;x \leq 1.15 \cdot 10^{-161}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;x \leq 4.2 \cdot 10^{-139}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;x \leq 3.3 \cdot 10^{-131}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;x \leq 7.5 \cdot 10^{-74}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;x \leq 0.7:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;x \leq 3.3 \cdot 10^{+150}:\\
    \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x} - 0.5}{x}}{x}}{n}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{0}{n}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if x < 1.15e-161 or 4.20000000000000016e-139 < x < 3.3000000000000002e-131 or 7.5e-74 < x < 0.69999999999999996

      1. Initial program 38.6%

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

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

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

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

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

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

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

      if 1.15e-161 < x < 4.20000000000000016e-139 or 3.3000000000000002e-131 < x < 7.5e-74

      1. Initial program 55.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 30.6%

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

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

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

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

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

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

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

        if 0.69999999999999996 < x < 3.29999999999999981e150

        1. Initial program 47.8%

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

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

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

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

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

        if 3.29999999999999981e150 < x

        1. Initial program 90.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 90.3%

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{\log \left(\frac{x + 1}{x}\right)}}{n} \]
        10. Taylor expanded in x around inf 90.3%

          \[\leadsto \frac{\log \color{blue}{1}}{n} \]
      10. Recombined 4 regimes into one program.
      11. Final simplification70.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.15 \cdot 10^{-161}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{-139}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} + \frac{-0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{-131}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 7.5 \cdot 10^{-74}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} + \frac{-0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.7:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{+150}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{n}\\ \end{array} \]
      12. Add Preprocessing

      Alternative 11: 82.4% accurate, 1.7× speedup?

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

        1. Initial program 92.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 inf 97.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. associate-/r*97.6%

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

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

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

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

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

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

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

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

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

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

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

        if -2.00000000000000002e-35 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000007e-10

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

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

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

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

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

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

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

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

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

        if 2.00000000000000007e-10 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e162

        1. Initial program 69.0%

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

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

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

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

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

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

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

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

        1. Initial program 24.7%

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

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

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

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

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

          \[\leadsto \color{blue}{\left(\mathsf{log1p}\left(x\right) - \log x\right) \cdot \frac{1}{n}} \]
        8. Step-by-step derivation
          1. div-inv13.0%

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

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

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

            \[\leadsto \frac{\mathsf{log1p}\left(x\right) \cdot n - n \cdot \log x}{\color{blue}{{n}^{2}}} \]
        9. Applied egg-rr94.6%

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

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

            \[\leadsto \frac{\color{blue}{n \cdot \left(\mathsf{log1p}\left(x\right) - \log x\right)}}{{n}^{2}} \]
        11. Simplified94.6%

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

          \[\leadsto \frac{\color{blue}{\frac{n}{x}}}{{n}^{2}} \]
      3. Recombined 4 regimes into one program.
      4. Add Preprocessing

      Alternative 12: 46.1% accurate, 8.8× speedup?

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

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{\log \left(\frac{x + 1}{x}\right)}}{n} \]
        10. Taylor expanded in x around inf 67.8%

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

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

        1. Initial program 44.2%

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

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

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

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

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

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

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

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

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

        Alternative 13: 47.5% accurate, 9.6× speedup?

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

          1. Initial program 48.6%

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

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

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

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

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

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

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

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

            if 7.80000000000000032e220 < x

            1. Initial program 92.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 92.3%

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

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

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

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

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

                \[\leadsto \frac{\frac{1}{n} - \frac{\color{blue}{0.5}}{n \cdot x}}{x} \]
              3. *-commutative60.2%

                \[\leadsto \frac{\frac{1}{n} - \frac{0.5}{\color{blue}{x \cdot n}}}{x} \]
            8. Simplified60.2%

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

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

                \[\leadsto \frac{\frac{-0.5}{\color{blue}{x \cdot n}}}{x} \]
            11. Simplified78.7%

              \[\leadsto \frac{\color{blue}{\frac{-0.5}{x \cdot n}}}{x} \]
          10. Recombined 2 regimes into one program.
          11. Add Preprocessing

          Alternative 14: 41.7% accurate, 17.6× speedup?

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

            1. Initial program 48.6%

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

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

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

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

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

            if 4.59999999999999993e220 < x

            1. Initial program 92.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 92.3%

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

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

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

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

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

                \[\leadsto \frac{\frac{1}{n} - \frac{\color{blue}{0.5}}{n \cdot x}}{x} \]
              3. *-commutative60.2%

                \[\leadsto \frac{\frac{1}{n} - \frac{0.5}{\color{blue}{x \cdot n}}}{x} \]
            8. Simplified60.2%

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

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

                \[\leadsto \frac{\frac{-0.5}{\color{blue}{x \cdot n}}}{x} \]
            11. Simplified78.7%

              \[\leadsto \frac{\color{blue}{\frac{-0.5}{x \cdot n}}}{x} \]
          3. Recombined 2 regimes into one program.
          4. Add Preprocessing

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

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

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

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

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

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

          Alternative 16: 39.9% accurate, 42.2× speedup?

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

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

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

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

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

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

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

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

          Alternative 17: 39.4% 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 55.6%

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

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

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

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

            \[\leadsto \color{blue}{\frac{1}{n \cdot x}} \]
          7. Final simplification42.5%

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

          Alternative 18: 4.6% accurate, 70.3× speedup?

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

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

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

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

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

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

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

              \[\leadsto {\color{blue}{\left(x \cdot n\right)}}^{-1} \]
            3. unpow-prod-down43.0%

              \[\leadsto \color{blue}{{x}^{-1} \cdot {n}^{-1}} \]
            4. inv-pow43.0%

              \[\leadsto \color{blue}{\frac{1}{x}} \cdot {n}^{-1} \]
            5. add-exp-log42.0%

              \[\leadsto \frac{1}{\color{blue}{e^{\log x}}} \cdot {n}^{-1} \]
            6. rec-exp42.0%

              \[\leadsto \color{blue}{e^{-\log x}} \cdot {n}^{-1} \]
            7. add-sqr-sqrt12.6%

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

              \[\leadsto e^{\color{blue}{\sqrt{\left(-\log x\right) \cdot \left(-\log x\right)}}} \cdot {n}^{-1} \]
            9. sqr-neg14.2%

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

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

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

              \[\leadsto \color{blue}{x} \cdot {n}^{-1} \]
            13. inv-pow4.6%

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

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

              \[\leadsto \color{blue}{\frac{x \cdot 1}{n}} \]
            2. *-rgt-identity4.6%

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

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

          Reproduce

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