2nthrt (problem 3.4.6)

Percentage Accurate: 53.9% → 86.0%
Time: 42.6s
Alternatives: 21
Speedup: 7.5×

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 21 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.9% accurate, 1.0× speedup?

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

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

Alternative 1: 86.0% accurate, 0.1× speedup?

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

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

\mathbf{elif}\;n \leq 310000:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -2e5

    1. Initial program 36.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 88.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{\left(-1 \cdot \log \left(1 + x\right) + -1 \cdot \frac{\left(-1 \cdot \frac{\left(-1 \cdot \frac{0.041666666666666664 \cdot {\log \left(1 + x\right)}^{4} - 0.041666666666666664 \cdot {\log x}^{4}}{n} + -0.16666666666666666 \cdot {\log \left(1 + x\right)}^{3}\right) - -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. Simplified88.1%

      \[\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) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \frac{-0.041666666666666664 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{n}\right)}{-n}} \]

    if -2e5 < n < 3.1e5

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

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

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

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

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

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

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

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

    if 3.1e5 < n

    1. Initial program 30.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 78.3%

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

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

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

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

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

Alternative 2: 86.0% accurate, 0.2× speedup?

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

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

\mathbf{elif}\;n \leq 310000:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -6.5e5

    1. Initial program 36.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 88.1%

      \[\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. Simplified88.1%

      \[\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 -6.5e5 < n < 3.1e5

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

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

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

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

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

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

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

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

    if 3.1e5 < n

    1. Initial program 30.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 78.3%

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

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

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

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

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

Alternative 3: 85.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-6}:\\ \;\;\;\;{\left(\sqrt[3]{1 - t\_0}\right)}^{3}\\ \mathbf{elif}\;t\_1 \leq 0:\\ \;\;\;\;\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))) (t_1 (- (pow (+ x 1.0) (/ 1.0 n)) t_0)))
   (if (<= t_1 -2e-6)
     (pow (cbrt (- 1.0 t_0)) 3.0)
     (if (<= t_1 0.0) (/ (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 t_1 = pow((x + 1.0), (1.0 / n)) - t_0;
	double tmp;
	if (t_1 <= -2e-6) {
		tmp = pow(cbrt((1.0 - t_0)), 3.0);
	} else if (t_1 <= 0.0) {
		tmp = log(((x + 1.0) / x)) / n;
	} else {
		tmp = exp((x / n)) - t_0;
	}
	return tmp;
}
public static double code(double x, double n) {
	double t_0 = Math.pow(x, (1.0 / n));
	double t_1 = Math.pow((x + 1.0), (1.0 / n)) - t_0;
	double tmp;
	if (t_1 <= -2e-6) {
		tmp = Math.pow(Math.cbrt((1.0 - t_0)), 3.0);
	} else if (t_1 <= 0.0) {
		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)
	t_1 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0)
	tmp = 0.0
	if (t_1 <= -2e-6)
		tmp = cbrt(Float64(1.0 - t_0)) ^ 3.0;
	elseif (t_1 <= 0.0)
		tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n);
	else
		tmp = Float64(exp(Float64(x / n)) - t_0);
	end
	return tmp
end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-6], N[Power[N[Power[N[(1.0 - t$95$0), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision], If[LessEqual[t$95$1, 0.0], 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)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-6}:\\
\;\;\;\;{\left(\sqrt[3]{1 - t\_0}\right)}^{3}\\

\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\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 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -1.99999999999999991e-6

    1. Initial program 98.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 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n)))

    1. Initial program 59.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 0 59.6%

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

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

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

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

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

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

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

Alternative 4: 86.0% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;n \leq 310000:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -3.5e6

    1. Initial program 36.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 87.8%

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

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

      if -3.5e6 < n < 3.1e5

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

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

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

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

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

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

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

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

      if 3.1e5 < n

      1. Initial program 30.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 78.3%

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

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

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

          \[\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} \]
    5. Recombined 3 regimes into one program.
    6. Add Preprocessing

    Alternative 5: 85.2% 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^{-8}:\\ \;\;\;\;e^{\frac{x}{n}} - t\_0\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-32}:\\ \;\;\;\;\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-8)
         (- (exp (/ x n)) t_0)
         (if (<= (/ 1.0 n) 5e-32)
           (/ (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-8) {
    		tmp = exp((x / n)) - t_0;
    	} else if ((1.0 / n) <= 5e-32) {
    		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-8) {
    		tmp = Math.exp((x / n)) - t_0;
    	} else if ((1.0 / n) <= 5e-32) {
    		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-8:
    		tmp = math.exp((x / n)) - t_0
    	elif (1.0 / n) <= 5e-32:
    		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-8)
    		tmp = Float64(exp(Float64(x / n)) - t_0);
    	elseif (Float64(1.0 / n) <= 5e-32)
    		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-8], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-32], 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^{-8}:\\
    \;\;\;\;e^{\frac{x}{n}} - t\_0\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-32}:\\
    \;\;\;\;\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) < -2e-8

      1. Initial program 98.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 98.0%

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

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

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

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

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

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

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

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

      1. Initial program 32.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 83.1%

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

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

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

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

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

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

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

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

      if 5e-32 < (/.f64 #s(literal 1 binary64) n)

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

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

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

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

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

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

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

    Alternative 6: 82.1% accurate, 0.9× speedup?

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

      1. Initial program 98.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{1}{n} \cdot \frac{\color{blue}{e^{1 \cdot \frac{\log x}{n}}}}{x} \]
        5. *-un-lft-identity99.9%

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

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

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

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

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

      1. Initial program 33.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 81.5%

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

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

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

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

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

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

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

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

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

      1. Initial program 90.8%

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \log \left({\left(\frac{e^{\color{blue}{\log \left(1 + x\right)}}}{x}\right)}^{\left(\frac{1}{n}\right)}\right) \]
        7. rem-exp-log80.6%

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

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

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

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

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

    Alternative 7: 85.9% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -17000000000 \lor \neg \left(n \leq 310000\right):\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \end{array} \end{array} \]
    (FPCore (x n)
     :precision binary64
     (if (or (<= n -17000000000.0) (not (<= n 310000.0)))
       (/ (log (/ (+ x 1.0) x)) n)
       (- (exp (/ x n)) (pow x (/ 1.0 n)))))
    double code(double x, double n) {
    	double tmp;
    	if ((n <= -17000000000.0) || !(n <= 310000.0)) {
    		tmp = log(((x + 1.0) / x)) / n;
    	} else {
    		tmp = exp((x / n)) - pow(x, (1.0 / n));
    	}
    	return tmp;
    }
    
    real(8) function code(x, n)
        real(8), intent (in) :: x
        real(8), intent (in) :: n
        real(8) :: tmp
        if ((n <= (-17000000000.0d0)) .or. (.not. (n <= 310000.0d0))) then
            tmp = log(((x + 1.0d0) / x)) / n
        else
            tmp = exp((x / n)) - (x ** (1.0d0 / n))
        end if
        code = tmp
    end function
    
    public static double code(double x, double n) {
    	double tmp;
    	if ((n <= -17000000000.0) || !(n <= 310000.0)) {
    		tmp = Math.log(((x + 1.0) / x)) / n;
    	} else {
    		tmp = Math.exp((x / n)) - Math.pow(x, (1.0 / n));
    	}
    	return tmp;
    }
    
    def code(x, n):
    	tmp = 0
    	if (n <= -17000000000.0) or not (n <= 310000.0):
    		tmp = math.log(((x + 1.0) / x)) / n
    	else:
    		tmp = math.exp((x / n)) - math.pow(x, (1.0 / n))
    	return tmp
    
    function code(x, n)
    	tmp = 0.0
    	if ((n <= -17000000000.0) || !(n <= 310000.0))
    		tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n);
    	else
    		tmp = Float64(exp(Float64(x / n)) - (x ^ Float64(1.0 / n)));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, n)
    	tmp = 0.0;
    	if ((n <= -17000000000.0) || ~((n <= 310000.0)))
    		tmp = log(((x + 1.0) / x)) / n;
    	else
    		tmp = exp((x / n)) - (x ^ (1.0 / n));
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, n_] := If[Or[LessEqual[n, -17000000000.0], N[Not[LessEqual[n, 310000.0]], $MachinePrecision]], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;n \leq -17000000000 \lor \neg \left(n \leq 310000\right):\\
    \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
    
    \mathbf{else}:\\
    \;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if n < -1.7e10 or 3.1e5 < n

      1. Initial program 32.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 82.5%

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

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

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

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

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

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

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

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

      if -1.7e10 < n < 3.1e5

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -17000000000 \lor \neg \left(n \leq 310000\right):\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 8: 82.1% accurate, 1.6× speedup?

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

      1. Initial program 98.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{1}{n} \cdot \frac{\color{blue}{e^{1 \cdot \frac{\log x}{n}}}}{x} \]
        5. *-un-lft-identity99.9%

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

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

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

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

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

      1. Initial program 33.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 81.5%

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

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

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

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

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

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

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

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

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

      1. Initial program 90.8%

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

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

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

      1. Initial program 24.0%

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{e^{\color{blue}{\sqrt{\frac{\log x}{n} \cdot \frac{\log x}{n}}}}}{x \cdot n} \]
        3. sqr-neg80.6%

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

          \[\leadsto \frac{e^{\sqrt{\color{blue}{\frac{-\log x}{n}} \cdot \left(-\frac{\log x}{n}\right)}}}{x \cdot n} \]
        5. distribute-frac-neg80.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{{x}^{\left(-\frac{1}{n}\right)}}}{x \cdot n} \]
        9. distribute-neg-frac80.6%

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

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

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

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

    Alternative 9: 82.1% accurate, 1.6× speedup?

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

      1. Initial program 98.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{1}{n} \cdot \frac{\color{blue}{e^{1 \cdot \frac{\log x}{n}}}}{x} \]
        5. *-un-lft-identity99.9%

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

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

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

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

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

      1. Initial program 33.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 81.5%

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

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

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

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

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

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

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

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

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

      1. Initial program 90.8%

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

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

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

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

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

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

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

      1. Initial program 24.0%

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{e^{\color{blue}{\sqrt{\frac{\log x}{n} \cdot \frac{\log x}{n}}}}}{x \cdot n} \]
        3. sqr-neg80.6%

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

          \[\leadsto \frac{e^{\sqrt{\color{blue}{\frac{-\log x}{n}} \cdot \left(-\frac{\log x}{n}\right)}}}{x \cdot n} \]
        5. distribute-frac-neg80.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{{x}^{\left(-\frac{1}{n}\right)}}}{x \cdot n} \]
        9. distribute-neg-frac80.6%

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

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

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

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

    Alternative 10: 82.1% accurate, 1.6× speedup?

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

      1. Initial program 98.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      1. Initial program 33.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 81.5%

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

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

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

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

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

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

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

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

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

      1. Initial program 90.8%

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

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

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

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

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

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

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

      1. Initial program 24.0%

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{e^{\color{blue}{\sqrt{\frac{\log x}{n} \cdot \frac{\log x}{n}}}}}{x \cdot n} \]
        3. sqr-neg80.6%

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

          \[\leadsto \frac{e^{\sqrt{\color{blue}{\frac{-\log x}{n}} \cdot \left(-\frac{\log x}{n}\right)}}}{x \cdot n} \]
        5. distribute-frac-neg80.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{{x}^{\left(-\frac{1}{n}\right)}}}{x \cdot n} \]
        9. distribute-neg-frac80.6%

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

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

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

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

    Alternative 11: 73.4% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -500:\\ \;\;\;\;\frac{\frac{x \cdot \frac{\frac{\frac{0.25}{x} + -0.3333333333333333}{x} + -0.5}{x} - x}{x \cdot x}}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-6}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{+115}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{\left(\frac{-1}{n}\right)}}{n \cdot x}\\ \end{array} \end{array} \]
    (FPCore (x n)
     :precision binary64
     (if (<= (/ 1.0 n) -500.0)
       (/
        (/
         (- (* x (/ (+ (/ (+ (/ 0.25 x) -0.3333333333333333) x) -0.5) x)) x)
         (* x x))
        n)
       (if (<= (/ 1.0 n) 5e-6)
         (/ (log (/ (+ x 1.0) x)) n)
         (if (<= (/ 1.0 n) 1e+115)
           (- 1.0 (pow x (/ 1.0 n)))
           (/ (pow x (/ -1.0 n)) (* n x))))))
    double code(double x, double n) {
    	double tmp;
    	if ((1.0 / n) <= -500.0) {
    		tmp = (((x * (((((0.25 / x) + -0.3333333333333333) / x) + -0.5) / x)) - x) / (x * x)) / n;
    	} else if ((1.0 / n) <= 5e-6) {
    		tmp = log(((x + 1.0) / x)) / n;
    	} else if ((1.0 / n) <= 1e+115) {
    		tmp = 1.0 - pow(x, (1.0 / 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 ((1.0d0 / n) <= (-500.0d0)) then
            tmp = (((x * (((((0.25d0 / x) + (-0.3333333333333333d0)) / x) + (-0.5d0)) / x)) - x) / (x * x)) / n
        else if ((1.0d0 / n) <= 5d-6) then
            tmp = log(((x + 1.0d0) / x)) / n
        else if ((1.0d0 / n) <= 1d+115) then
            tmp = 1.0d0 - (x ** (1.0d0 / 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 ((1.0 / n) <= -500.0) {
    		tmp = (((x * (((((0.25 / x) + -0.3333333333333333) / x) + -0.5) / x)) - x) / (x * x)) / n;
    	} else if ((1.0 / n) <= 5e-6) {
    		tmp = Math.log(((x + 1.0) / x)) / n;
    	} else if ((1.0 / n) <= 1e+115) {
    		tmp = 1.0 - Math.pow(x, (1.0 / n));
    	} else {
    		tmp = Math.pow(x, (-1.0 / n)) / (n * x);
    	}
    	return tmp;
    }
    
    def code(x, n):
    	tmp = 0
    	if (1.0 / n) <= -500.0:
    		tmp = (((x * (((((0.25 / x) + -0.3333333333333333) / x) + -0.5) / x)) - x) / (x * x)) / n
    	elif (1.0 / n) <= 5e-6:
    		tmp = math.log(((x + 1.0) / x)) / n
    	elif (1.0 / n) <= 1e+115:
    		tmp = 1.0 - math.pow(x, (1.0 / n))
    	else:
    		tmp = math.pow(x, (-1.0 / n)) / (n * x)
    	return tmp
    
    function code(x, n)
    	tmp = 0.0
    	if (Float64(1.0 / n) <= -500.0)
    		tmp = Float64(Float64(Float64(Float64(x * Float64(Float64(Float64(Float64(Float64(0.25 / x) + -0.3333333333333333) / x) + -0.5) / x)) - x) / Float64(x * x)) / n);
    	elseif (Float64(1.0 / n) <= 5e-6)
    		tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n);
    	elseif (Float64(1.0 / n) <= 1e+115)
    		tmp = Float64(1.0 - (x ^ Float64(1.0 / n)));
    	else
    		tmp = Float64((x ^ Float64(-1.0 / n)) / Float64(n * x));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, n)
    	tmp = 0.0;
    	if ((1.0 / n) <= -500.0)
    		tmp = (((x * (((((0.25 / x) + -0.3333333333333333) / x) + -0.5) / x)) - x) / (x * x)) / n;
    	elseif ((1.0 / n) <= 5e-6)
    		tmp = log(((x + 1.0) / x)) / n;
    	elseif ((1.0 / n) <= 1e+115)
    		tmp = 1.0 - (x ^ (1.0 / n));
    	else
    		tmp = (x ^ (-1.0 / n)) / (n * x);
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -500.0], N[(N[(N[(N[(x * N[(N[(N[(N[(N[(0.25 / x), $MachinePrecision] + -0.3333333333333333), $MachinePrecision] / x), $MachinePrecision] + -0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-6], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+115], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[x, N[(-1.0 / n), $MachinePrecision]], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\frac{1}{n} \leq -500:\\
    \;\;\;\;\frac{\frac{x \cdot \frac{\frac{\frac{0.25}{x} + -0.3333333333333333}{x} + -0.5}{x} - x}{x \cdot x}}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-6}:\\
    \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 10^{+115}:\\
    \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{{x}^{\left(\frac{-1}{n}\right)}}{n \cdot x}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if (/.f64 #s(literal 1 binary64) n) < -500

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

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

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

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

        \[\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} \]
      7. Applied egg-rr71.3%

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

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

      1. Initial program 33.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 81.0%

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

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

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

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

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

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

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

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

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

      1. Initial program 90.8%

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

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

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

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

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

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

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

      1. Initial program 24.0%

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{e^{\color{blue}{\sqrt{\frac{\log x}{n} \cdot \frac{\log x}{n}}}}}{x \cdot n} \]
        3. sqr-neg80.6%

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

          \[\leadsto \frac{e^{\sqrt{\color{blue}{\frac{-\log x}{n}} \cdot \left(-\frac{\log x}{n}\right)}}}{x \cdot n} \]
        5. distribute-frac-neg80.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{{x}^{\left(-\frac{1}{n}\right)}}}{x \cdot n} \]
        9. distribute-neg-frac80.6%

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

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

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

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

    Alternative 12: 72.9% accurate, 1.7× speedup?

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

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

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

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

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

        \[\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} \]
      7. Applied egg-rr71.3%

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

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

      1. Initial program 33.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 81.0%

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

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

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

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

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

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

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

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

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

      1. Initial program 90.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 13: 59.5% accurate, 1.8× speedup?

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

      1. Initial program 45.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 56.3%

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

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

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

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

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

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

      if 1.84999999999999989e-140 < x < 9.8000000000000006e-99

      1. Initial program 59.6%

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

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

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

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

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

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

        \[\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. Simplified73.2%

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

        if 9.8000000000000006e-99 < x < 0.880000000000000004

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

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

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

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

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

        if 0.880000000000000004 < x < 5.8000000000000005e74

        1. Initial program 33.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 39.1%

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

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

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

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

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

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

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

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

          \[\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} \]
        11. Simplified79.4%

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

        if 5.8000000000000005e74 < x

        1. Initial program 82.0%

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

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.85 \cdot 10^{-140}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 9.8 \cdot 10^{-99}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{+74}:\\ \;\;\;\;\frac{\frac{1 + \frac{-0.5 + \frac{0.3333333333333333 + \frac{-0.25}{x}}{x}}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      12. Add Preprocessing

      Alternative 14: 59.2% accurate, 1.8× speedup?

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

        1. Initial program 41.5%

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

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

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

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

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

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

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

        if 4.0000000000000002e-141 < x < 1.41999999999999999e-98

        1. Initial program 59.6%

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

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

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

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

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

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

          \[\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. Simplified73.2%

            \[\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.1000000000000001e75

          1. Initial program 33.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 39.1%

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

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

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

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

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

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

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

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

            \[\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} \]
          11. Simplified79.4%

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

          if 3.1000000000000001e75 < x

          1. Initial program 82.0%

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

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

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

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

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

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4 \cdot 10^{-141}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.42 \cdot 10^{-98}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.7:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 3.1 \cdot 10^{+75}:\\ \;\;\;\;\frac{\frac{1 + \frac{-0.5 + \frac{0.3333333333333333 + \frac{-0.25}{x}}{x}}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
        12. Add Preprocessing

        Alternative 15: 53.9% accurate, 7.5× speedup?

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

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

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

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

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

            \[\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} \]
          7. Applied egg-rr70.5%

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

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

          1. Initial program 40.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 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. Step-by-step derivation
            1. expm1-log1p-u63.3%

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{\frac{1 + \left(\frac{0.3333333333333333 \cdot \frac{1}{x}}{x} - \frac{\color{blue}{0.5}}{x}\right)}{x}}{n} \]
            8. div-sub45.7%

              \[\leadsto \frac{\frac{1 + \color{blue}{\frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x}}}{x}}{n} \]
            9. sub-neg45.7%

              \[\leadsto \frac{\frac{1 + \frac{\color{blue}{0.3333333333333333 \cdot \frac{1}{x} + \left(-0.5\right)}}{x}}{x}}{n} \]
            10. metadata-eval45.7%

              \[\leadsto \frac{\frac{1 + \frac{0.3333333333333333 \cdot \frac{1}{x} + \color{blue}{-0.5}}{x}}{x}}{n} \]
            11. +-commutative45.7%

              \[\leadsto \frac{\frac{1 + \frac{\color{blue}{-0.5 + 0.3333333333333333 \cdot \frac{1}{x}}}{x}}{x}}{n} \]
            12. associate-*r/45.7%

              \[\leadsto \frac{\frac{1 + \frac{-0.5 + \color{blue}{\frac{0.3333333333333333 \cdot 1}{x}}}{x}}{x}}{n} \]
            13. metadata-eval45.7%

              \[\leadsto \frac{\frac{1 + \frac{-0.5 + \frac{\color{blue}{0.3333333333333333}}{x}}{x}}{x}}{n} \]
          10. Simplified45.7%

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

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

        Alternative 16: 47.3% accurate, 11.7× speedup?

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

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

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

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

          \[\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} \]
        7. Step-by-step derivation
          1. fma-neg27.0%

            \[\leadsto \frac{-1 \cdot \frac{\color{blue}{\mathsf{fma}\left(-1, \frac{-1 \cdot \frac{0.25 \cdot \frac{1}{x} - 0.3333333333333333}{x} - 0.5}{x}, -1\right)}}{x}}{n} \]
        8. Applied egg-rr46.7%

          \[\leadsto \frac{-1 \cdot \frac{\color{blue}{\mathsf{fma}\left(-1, \frac{\frac{\frac{0.25}{x} + -0.3333333333333333}{x} + -0.5}{x}, -1\right)}}{x}}{n} \]
        9. Step-by-step derivation
          1. fma-undefine46.7%

            \[\leadsto \frac{-1 \cdot \frac{\color{blue}{-1 \cdot \frac{\frac{\frac{0.25}{x} + -0.3333333333333333}{x} + -0.5}{x} + -1}}{x}}{n} \]
          2. metadata-eval46.7%

            \[\leadsto \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{\frac{0.25}{x} + -0.3333333333333333}{x} + -0.5}{x} + \color{blue}{-1 \cdot 1}}{x}}{n} \]
          3. distribute-lft-in46.7%

            \[\leadsto \frac{-1 \cdot \frac{\color{blue}{-1 \cdot \left(\frac{\frac{\frac{0.25}{x} + -0.3333333333333333}{x} + -0.5}{x} + 1\right)}}{x}}{n} \]
          4. +-commutative46.7%

            \[\leadsto \frac{-1 \cdot \frac{-1 \cdot \color{blue}{\left(1 + \frac{\frac{\frac{0.25}{x} + -0.3333333333333333}{x} + -0.5}{x}\right)}}{x}}{n} \]
          5. distribute-lft-in46.7%

            \[\leadsto \frac{-1 \cdot \frac{\color{blue}{-1 \cdot 1 + -1 \cdot \frac{\frac{\frac{0.25}{x} + -0.3333333333333333}{x} + -0.5}{x}}}{x}}{n} \]
          6. metadata-eval46.7%

            \[\leadsto \frac{-1 \cdot \frac{\color{blue}{-1} + -1 \cdot \frac{\frac{\frac{0.25}{x} + -0.3333333333333333}{x} + -0.5}{x}}{x}}{n} \]
          7. associate-*r/46.7%

            \[\leadsto \frac{-1 \cdot \frac{-1 + \color{blue}{\frac{-1 \cdot \left(\frac{\frac{0.25}{x} + -0.3333333333333333}{x} + -0.5\right)}{x}}}{x}}{n} \]
        10. Simplified46.7%

          \[\leadsto \frac{-1 \cdot \frac{\color{blue}{-1 + \frac{0.5 + \frac{0.3333333333333333 + \frac{-0.25}{x}}{x}}{x}}}{x}}{n} \]
        11. Final simplification46.7%

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

        Alternative 17: 46.7% accurate, 16.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\frac{1 + \left(\frac{0.3333333333333333 \cdot \frac{1}{x}}{x} - \frac{\color{blue}{0.5}}{x}\right)}{x}}{n} \]
          8. div-sub46.4%

            \[\leadsto \frac{\frac{1 + \color{blue}{\frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x}}}{x}}{n} \]
          9. sub-neg46.4%

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

            \[\leadsto \frac{\frac{1 + \frac{0.3333333333333333 \cdot \frac{1}{x} + \color{blue}{-0.5}}{x}}{x}}{n} \]
          11. +-commutative46.4%

            \[\leadsto \frac{\frac{1 + \frac{\color{blue}{-0.5 + 0.3333333333333333 \cdot \frac{1}{x}}}{x}}{x}}{n} \]
          12. associate-*r/46.4%

            \[\leadsto \frac{\frac{1 + \frac{-0.5 + \color{blue}{\frac{0.3333333333333333 \cdot 1}{x}}}{x}}{x}}{n} \]
          13. metadata-eval46.4%

            \[\leadsto \frac{\frac{1 + \frac{-0.5 + \frac{\color{blue}{0.3333333333333333}}{x}}{x}}{x}}{n} \]
        10. Simplified46.4%

          \[\leadsto \frac{\color{blue}{\frac{1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{x}}}{n} \]
        11. Add Preprocessing

        Alternative 18: 41.1% accurate, 42.2× speedup?

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

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

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

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

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

        Alternative 19: 41.1% 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 54.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 59.4%

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

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

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

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

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

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

        Alternative 20: 40.6% accurate, 42.2× speedup?

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

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

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

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

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

        Alternative 21: 4.5% accurate, 70.3× speedup?

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

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

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

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

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

            \[\leadsto \color{blue}{1 \cdot \frac{1}{n \cdot x}} \]
          2. *-commutative37.7%

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

            \[\leadsto 1 \cdot \color{blue}{\frac{\frac{1}{x}}{n}} \]
          4. rem-exp-log38.0%

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

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

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

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

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

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

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

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

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

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

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

        Reproduce

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