2nthrt (problem 3.4.6)

Percentage Accurate: 52.8% → 85.0%
Time: 40.5s
Alternatives: 23
Speedup: 1.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 23 alternatives:

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

Initial Program: 52.8% accurate, 1.0× speedup?

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

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

Alternative 1: 85.0% accurate, 0.1× speedup?

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

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

\mathbf{elif}\;\frac{1}{n} \leq 10:\\
\;\;\;\;\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) + -0.041666666666666664 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}}{n}}{n}}{n}\right) - \log x}{n}\\

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


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

    1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 36.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 83.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. Simplified83.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) + -0.041666666666666664 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}}{n}}{n}}{n}\right)}{-n}} \]

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

    1. Initial program 63.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 63.0%

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

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

Alternative 2: 85.0% accurate, 0.2× speedup?

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

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

\mathbf{elif}\;\frac{1}{n} \leq 10:\\
\;\;\;\;\frac{\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) - \log x}{n}\\

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


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

    1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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. Simplified83.0%

      \[\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 10 < (/.f64 #s(literal 1 binary64) n)

    1. Initial program 63.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 63.0%

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

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

Alternative 3: 85.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-94}:\\ \;\;\;\;\frac{t\_0}{n \cdot x}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-10}:\\ \;\;\;\;\frac{\log \left(\frac{\sqrt{e^{\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n}}} \cdot \left(1 + x\right)}{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) -4e-94)
     (/ t_0 (* n x))
     (if (<= (/ 1.0 n) 5e-10)
       (/
        (log
         (/
          (*
           (sqrt (exp (/ (- (pow (log1p x) 2.0) (pow (log x) 2.0)) n)))
           (+ 1.0 x))
          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) <= -4e-94) {
		tmp = t_0 / (n * x);
	} else if ((1.0 / n) <= 5e-10) {
		tmp = log(((sqrt(exp(((pow(log1p(x), 2.0) - pow(log(x), 2.0)) / n))) * (1.0 + x)) / 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) <= -4e-94) {
		tmp = t_0 / (n * x);
	} else if ((1.0 / n) <= 5e-10) {
		tmp = Math.log(((Math.sqrt(Math.exp(((Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0)) / n))) * (1.0 + x)) / 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) <= -4e-94:
		tmp = t_0 / (n * x)
	elif (1.0 / n) <= 5e-10:
		tmp = math.log(((math.sqrt(math.exp(((math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0)) / n))) * (1.0 + x)) / 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) <= -4e-94)
		tmp = Float64(t_0 / Float64(n * x));
	elseif (Float64(1.0 / n) <= 5e-10)
		tmp = Float64(log(Float64(Float64(sqrt(exp(Float64(Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)) / n))) * Float64(1.0 + x)) / 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], -4e-94], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-10], N[(N[Log[N[(N[(N[Sqrt[N[Exp[N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(1.0 + x), $MachinePrecision]), $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 -4 \cdot 10^{-94}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-10}:\\
\;\;\;\;\frac{\log \left(\frac{\sqrt{e^{\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n}}} \cdot \left(1 + x\right)}{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) < -3.9999999999999998e-94

    1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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. Simplified83.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      1. Initial program 61.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 61.0%

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

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

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

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

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

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

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

    Alternative 4: 85.2% accurate, 0.3× speedup?

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

      1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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. Simplified83.9%

          \[\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 5.00000000000000031e-10 < (/.f64 #s(literal 1 binary64) n)

        1. Initial program 61.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 61.0%

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-94}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-10}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \left(\log x + 0.5 \cdot \frac{{\log x}^{2} - {\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n}\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \end{array} \]
      7. 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 -4 \cdot 10^{-94}:\\ \;\;\;\;\frac{t\_0}{n \cdot x}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-12}:\\ \;\;\;\;\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) -4e-94)
           (/ t_0 (* n x))
           (if (<= (/ 1.0 n) 2e-12)
             (/ (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) <= -4e-94) {
      		tmp = t_0 / (n * x);
      	} else if ((1.0 / n) <= 2e-12) {
      		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) <= -4e-94) {
      		tmp = t_0 / (n * x);
      	} else if ((1.0 / n) <= 2e-12) {
      		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) <= -4e-94:
      		tmp = t_0 / (n * x)
      	elif (1.0 / n) <= 2e-12:
      		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) <= -4e-94)
      		tmp = Float64(t_0 / Float64(n * x));
      	elseif (Float64(1.0 / n) <= 2e-12)
      		tmp = Float64(log(Float64(x / Float64(1.0 + x))) / Float64(-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], -4e-94], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-12], N[(N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $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 -4 \cdot 10^{-94}:\\
      \;\;\;\;\frac{t\_0}{n \cdot x}\\
      
      \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-12}:\\
      \;\;\;\;\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) < -3.9999999999999998e-94

        1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -3.9999999999999998e-94 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n)

          1. Initial program 61.2%

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

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

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

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

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

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

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

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

        Alternative 6: 81.7% accurate, 0.9× speedup?

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

          1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

          if -3.9999999999999998e-94 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n)

            1. Initial program 61.2%

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

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

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

          Alternative 7: 82.0% accurate, 0.9× speedup?

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

            1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

            if -3.9999999999999998e-94 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e161

              1. Initial program 79.9%

                \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
              2. Add Preprocessing

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

              1. Initial program 31.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 5.6%

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

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

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

                \[\leadsto \frac{\color{blue}{x} - \log x}{n} \]
              7. Taylor expanded in x around inf 5.3%

                \[\leadsto \color{blue}{\frac{x}{n}} \]
              8. Step-by-step derivation
                1. log1p-expm1-u78.4%

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

                \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{n}\right)\right)} \]
            5. Recombined 4 regimes into one program.
            6. Final simplification85.4%

              \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-94}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-12}:\\ \;\;\;\;\frac{\log \left(\frac{x}{1 + x}\right)}{-n}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+161}:\\ \;\;\;\;{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{n}\right)\right)\\ \end{array} \]
            7. Add Preprocessing

            Alternative 8: 81.7% accurate, 0.9× speedup?

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

              1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

              if -3.9999999999999998e-94 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e161

                1. Initial program 79.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 76.5%

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

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

                1. Initial program 31.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 5.6%

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

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

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

                  \[\leadsto \frac{\color{blue}{x} - \log x}{n} \]
                7. Taylor expanded in x around inf 5.3%

                  \[\leadsto \color{blue}{\frac{x}{n}} \]
                8. Step-by-step derivation
                  1. log1p-expm1-u78.4%

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

                  \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{n}\right)\right)} \]
              5. Recombined 4 regimes into one program.
              6. Final simplification85.0%

                \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-94}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-12}:\\ \;\;\;\;\frac{\log \left(\frac{x}{1 + x}\right)}{-n}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+161}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{n}\right)\right)\\ \end{array} \]
              7. Add Preprocessing

              Alternative 9: 81.3% accurate, 1.6× speedup?

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

                1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

                if -3.9999999999999998e-94 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e161

                  1. Initial program 79.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 76.5%

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

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

                  1. Initial program 31.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 5.6%

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

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

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

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

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

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

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

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

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

                Alternative 10: 81.2% accurate, 1.6× speedup?

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

                  1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

                  if -3.9999999999999998e-94 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e161

                    1. Initial program 79.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 76.2%

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

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

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

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

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

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

                    1. Initial program 31.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 5.6%

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

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

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

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

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

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

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

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

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

                  Alternative 11: 67.0% accurate, 1.7× speedup?

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

                    1. Initial program 49.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 73.8%

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

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

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

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

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

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

                    if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e161

                    1. Initial program 79.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 76.2%

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

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

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

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

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

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

                    1. Initial program 31.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 5.6%

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

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

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

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

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

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

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

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

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

                  Alternative 12: 59.2% accurate, 1.8× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 2.8 \cdot 10^{-204}:\\ \;\;\;\;\frac{-1}{\frac{n}{\log x}}\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{-143}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.92:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 1.46 \cdot 10^{+94}:\\ \;\;\;\;\frac{\frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \frac{0.25}{x}}{x}}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{n}\\ \end{array} \end{array} \]
                  (FPCore (x n)
                   :precision binary64
                   (if (<= x 2.8e-204)
                     (/ -1.0 (/ n (log x)))
                     (if (<= x 1.8e-143)
                       (- 1.0 (pow x (/ 1.0 n)))
                       (if (<= x 0.92)
                         (/ (- x (log x)) n)
                         (if (<= x 1.46e+94)
                           (/
                            (/ (- 1.0 (/ (- 0.5 (/ (- 0.3333333333333333 (/ 0.25 x)) x)) x)) x)
                            n)
                           (/ 0.0 n))))))
                  double code(double x, double n) {
                  	double tmp;
                  	if (x <= 2.8e-204) {
                  		tmp = -1.0 / (n / log(x));
                  	} else if (x <= 1.8e-143) {
                  		tmp = 1.0 - pow(x, (1.0 / n));
                  	} else if (x <= 0.92) {
                  		tmp = (x - log(x)) / n;
                  	} else if (x <= 1.46e+94) {
                  		tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n;
                  	} else {
                  		tmp = 0.0 / n;
                  	}
                  	return tmp;
                  }
                  
                  real(8) function code(x, n)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: n
                      real(8) :: tmp
                      if (x <= 2.8d-204) then
                          tmp = (-1.0d0) / (n / log(x))
                      else if (x <= 1.8d-143) then
                          tmp = 1.0d0 - (x ** (1.0d0 / n))
                      else if (x <= 0.92d0) then
                          tmp = (x - log(x)) / n
                      else if (x <= 1.46d+94) then
                          tmp = ((1.0d0 - ((0.5d0 - ((0.3333333333333333d0 - (0.25d0 / x)) / x)) / x)) / x) / n
                      else
                          tmp = 0.0d0 / n
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double x, double n) {
                  	double tmp;
                  	if (x <= 2.8e-204) {
                  		tmp = -1.0 / (n / Math.log(x));
                  	} else if (x <= 1.8e-143) {
                  		tmp = 1.0 - Math.pow(x, (1.0 / n));
                  	} else if (x <= 0.92) {
                  		tmp = (x - Math.log(x)) / n;
                  	} else if (x <= 1.46e+94) {
                  		tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n;
                  	} else {
                  		tmp = 0.0 / n;
                  	}
                  	return tmp;
                  }
                  
                  def code(x, n):
                  	tmp = 0
                  	if x <= 2.8e-204:
                  		tmp = -1.0 / (n / math.log(x))
                  	elif x <= 1.8e-143:
                  		tmp = 1.0 - math.pow(x, (1.0 / n))
                  	elif x <= 0.92:
                  		tmp = (x - math.log(x)) / n
                  	elif x <= 1.46e+94:
                  		tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n
                  	else:
                  		tmp = 0.0 / n
                  	return tmp
                  
                  function code(x, n)
                  	tmp = 0.0
                  	if (x <= 2.8e-204)
                  		tmp = Float64(-1.0 / Float64(n / log(x)));
                  	elseif (x <= 1.8e-143)
                  		tmp = Float64(1.0 - (x ^ Float64(1.0 / n)));
                  	elseif (x <= 0.92)
                  		tmp = Float64(Float64(x - log(x)) / n);
                  	elseif (x <= 1.46e+94)
                  		tmp = Float64(Float64(Float64(1.0 - Float64(Float64(0.5 - Float64(Float64(0.3333333333333333 - Float64(0.25 / x)) / x)) / x)) / x) / n);
                  	else
                  		tmp = Float64(0.0 / n);
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(x, n)
                  	tmp = 0.0;
                  	if (x <= 2.8e-204)
                  		tmp = -1.0 / (n / log(x));
                  	elseif (x <= 1.8e-143)
                  		tmp = 1.0 - (x ^ (1.0 / n));
                  	elseif (x <= 0.92)
                  		tmp = (x - log(x)) / n;
                  	elseif (x <= 1.46e+94)
                  		tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n;
                  	else
                  		tmp = 0.0 / n;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[x_, n_] := If[LessEqual[x, 2.8e-204], N[(-1.0 / N[(n / N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.8e-143], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.92], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 1.46e+94], 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], N[(0.0 / n), $MachinePrecision]]]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;x \leq 2.8 \cdot 10^{-204}:\\
                  \;\;\;\;\frac{-1}{\frac{n}{\log x}}\\
                  
                  \mathbf{elif}\;x \leq 1.8 \cdot 10^{-143}:\\
                  \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
                  
                  \mathbf{elif}\;x \leq 0.92:\\
                  \;\;\;\;\frac{x - \log x}{n}\\
                  
                  \mathbf{elif}\;x \leq 1.46 \cdot 10^{+94}:\\
                  \;\;\;\;\frac{\frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \frac{0.25}{x}}{x}}{x}}{x}}{n}\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\frac{0}{n}\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 5 regimes
                  2. if x < 2.8e-204

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \frac{1}{\frac{\color{blue}{-n}}{\log x}} \]
                    12. Simplified58.9%

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

                    if 2.8e-204 < x < 1.7999999999999999e-143

                    1. Initial program 66.6%

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

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

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

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

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

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

                    if 1.7999999999999999e-143 < x < 0.92000000000000004

                    1. Initial program 21.1%

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

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

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

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

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

                    if 0.92000000000000004 < x < 1.46000000000000005e94

                    1. Initial program 38.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 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. Taylor expanded in x around -inf 68.8%

                      \[\leadsto \frac{\color{blue}{-1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{0.25 \cdot \frac{1}{x} - 0.3333333333333333}{x} - 0.5}{x} - 1}{x}}}{n} \]
                    7. Taylor expanded in x around -inf 68.8%

                      \[\leadsto \frac{-1 \cdot \color{blue}{\left(-1 \cdot \frac{1 + -1 \cdot \frac{0.5 + -1 \cdot \frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}}{x}}{x}\right)}}{n} \]
                    8. Step-by-step derivation
                      1. mul-1-neg68.8%

                        \[\leadsto \frac{-1 \cdot \color{blue}{\left(-\frac{1 + -1 \cdot \frac{0.5 + -1 \cdot \frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}}{x}}{x}\right)}}{n} \]
                      2. distribute-neg-frac268.8%

                        \[\leadsto \frac{-1 \cdot \color{blue}{\frac{1 + -1 \cdot \frac{0.5 + -1 \cdot \frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}}{x}}{-x}}}{n} \]
                      3. mul-1-neg68.8%

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

                        \[\leadsto \frac{-1 \cdot \frac{\color{blue}{1 - \frac{0.5 + -1 \cdot \frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}}{x}}}{-x}}{n} \]
                      5. mul-1-neg68.8%

                        \[\leadsto \frac{-1 \cdot \frac{1 - \frac{0.5 + \color{blue}{\left(-\frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}\right)}}{x}}{-x}}{n} \]
                      6. unsub-neg68.8%

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

                        \[\leadsto \frac{-1 \cdot \frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \color{blue}{\frac{0.25 \cdot 1}{x}}}{x}}{x}}{-x}}{n} \]
                      8. metadata-eval68.8%

                        \[\leadsto \frac{-1 \cdot \frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \frac{\color{blue}{0.25}}{x}}{x}}{x}}{-x}}{n} \]
                    9. Simplified68.8%

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

                    if 1.46000000000000005e94 < x

                    1. Initial program 81.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 81.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.8 \cdot 10^{-204}:\\ \;\;\;\;\frac{-1}{\frac{n}{\log x}}\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{-143}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.92:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 1.46 \cdot 10^{+94}:\\ \;\;\;\;\frac{\frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \frac{0.25}{x}}{x}}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{n}\\ \end{array} \]
                    7. Add Preprocessing

                    Alternative 13: 59.2% accurate, 1.8× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 2.3 \cdot 10^{-204}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-143}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{+94}:\\ \;\;\;\;\frac{\frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \frac{0.25}{x}}{x}}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{n}\\ \end{array} \end{array} \]
                    (FPCore (x n)
                     :precision binary64
                     (if (<= x 2.3e-204)
                       (/ (log x) (- n))
                       (if (<= x 3.6e-143)
                         (- 1.0 (pow x (/ 1.0 n)))
                         (if (<= x 0.88)
                           (/ (- x (log x)) n)
                           (if (<= x 1.6e+94)
                             (/
                              (/ (- 1.0 (/ (- 0.5 (/ (- 0.3333333333333333 (/ 0.25 x)) x)) x)) x)
                              n)
                             (/ 0.0 n))))))
                    double code(double x, double n) {
                    	double tmp;
                    	if (x <= 2.3e-204) {
                    		tmp = log(x) / -n;
                    	} else if (x <= 3.6e-143) {
                    		tmp = 1.0 - pow(x, (1.0 / n));
                    	} else if (x <= 0.88) {
                    		tmp = (x - log(x)) / n;
                    	} else if (x <= 1.6e+94) {
                    		tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n;
                    	} else {
                    		tmp = 0.0 / n;
                    	}
                    	return tmp;
                    }
                    
                    real(8) function code(x, n)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: n
                        real(8) :: tmp
                        if (x <= 2.3d-204) then
                            tmp = log(x) / -n
                        else if (x <= 3.6d-143) then
                            tmp = 1.0d0 - (x ** (1.0d0 / n))
                        else if (x <= 0.88d0) then
                            tmp = (x - log(x)) / n
                        else if (x <= 1.6d+94) then
                            tmp = ((1.0d0 - ((0.5d0 - ((0.3333333333333333d0 - (0.25d0 / x)) / x)) / x)) / x) / n
                        else
                            tmp = 0.0d0 / n
                        end if
                        code = tmp
                    end function
                    
                    public static double code(double x, double n) {
                    	double tmp;
                    	if (x <= 2.3e-204) {
                    		tmp = Math.log(x) / -n;
                    	} else if (x <= 3.6e-143) {
                    		tmp = 1.0 - Math.pow(x, (1.0 / n));
                    	} else if (x <= 0.88) {
                    		tmp = (x - Math.log(x)) / n;
                    	} else if (x <= 1.6e+94) {
                    		tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n;
                    	} else {
                    		tmp = 0.0 / n;
                    	}
                    	return tmp;
                    }
                    
                    def code(x, n):
                    	tmp = 0
                    	if x <= 2.3e-204:
                    		tmp = math.log(x) / -n
                    	elif x <= 3.6e-143:
                    		tmp = 1.0 - math.pow(x, (1.0 / n))
                    	elif x <= 0.88:
                    		tmp = (x - math.log(x)) / n
                    	elif x <= 1.6e+94:
                    		tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n
                    	else:
                    		tmp = 0.0 / n
                    	return tmp
                    
                    function code(x, n)
                    	tmp = 0.0
                    	if (x <= 2.3e-204)
                    		tmp = Float64(log(x) / Float64(-n));
                    	elseif (x <= 3.6e-143)
                    		tmp = Float64(1.0 - (x ^ Float64(1.0 / n)));
                    	elseif (x <= 0.88)
                    		tmp = Float64(Float64(x - log(x)) / n);
                    	elseif (x <= 1.6e+94)
                    		tmp = Float64(Float64(Float64(1.0 - Float64(Float64(0.5 - Float64(Float64(0.3333333333333333 - Float64(0.25 / x)) / x)) / x)) / x) / n);
                    	else
                    		tmp = Float64(0.0 / n);
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(x, n)
                    	tmp = 0.0;
                    	if (x <= 2.3e-204)
                    		tmp = log(x) / -n;
                    	elseif (x <= 3.6e-143)
                    		tmp = 1.0 - (x ^ (1.0 / n));
                    	elseif (x <= 0.88)
                    		tmp = (x - log(x)) / n;
                    	elseif (x <= 1.6e+94)
                    		tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n;
                    	else
                    		tmp = 0.0 / n;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[x_, n_] := If[LessEqual[x, 2.3e-204], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 3.6e-143], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.88], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 1.6e+94], 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], N[(0.0 / n), $MachinePrecision]]]]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;x \leq 2.3 \cdot 10^{-204}:\\
                    \;\;\;\;\frac{\log x}{-n}\\
                    
                    \mathbf{elif}\;x \leq 3.6 \cdot 10^{-143}:\\
                    \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
                    
                    \mathbf{elif}\;x \leq 0.88:\\
                    \;\;\;\;\frac{x - \log x}{n}\\
                    
                    \mathbf{elif}\;x \leq 1.6 \cdot 10^{+94}:\\
                    \;\;\;\;\frac{\frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \frac{0.25}{x}}{x}}{x}}{x}}{n}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\frac{0}{n}\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 5 regimes
                    2. if x < 2.2999999999999999e-204

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

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

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

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

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

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

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

                      if 2.2999999999999999e-204 < x < 3.5999999999999998e-143

                      1. Initial program 66.6%

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

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

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

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

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

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

                      if 3.5999999999999998e-143 < x < 0.880000000000000004

                      1. Initial program 21.1%

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

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

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

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

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

                      if 0.880000000000000004 < x < 1.60000000000000007e94

                      1. Initial program 38.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 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. Taylor expanded in x around -inf 68.8%

                        \[\leadsto \frac{\color{blue}{-1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{0.25 \cdot \frac{1}{x} - 0.3333333333333333}{x} - 0.5}{x} - 1}{x}}}{n} \]
                      7. Taylor expanded in x around -inf 68.8%

                        \[\leadsto \frac{-1 \cdot \color{blue}{\left(-1 \cdot \frac{1 + -1 \cdot \frac{0.5 + -1 \cdot \frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}}{x}}{x}\right)}}{n} \]
                      8. Step-by-step derivation
                        1. mul-1-neg68.8%

                          \[\leadsto \frac{-1 \cdot \color{blue}{\left(-\frac{1 + -1 \cdot \frac{0.5 + -1 \cdot \frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}}{x}}{x}\right)}}{n} \]
                        2. distribute-neg-frac268.8%

                          \[\leadsto \frac{-1 \cdot \color{blue}{\frac{1 + -1 \cdot \frac{0.5 + -1 \cdot \frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}}{x}}{-x}}}{n} \]
                        3. mul-1-neg68.8%

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

                          \[\leadsto \frac{-1 \cdot \frac{\color{blue}{1 - \frac{0.5 + -1 \cdot \frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}}{x}}}{-x}}{n} \]
                        5. mul-1-neg68.8%

                          \[\leadsto \frac{-1 \cdot \frac{1 - \frac{0.5 + \color{blue}{\left(-\frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}\right)}}{x}}{-x}}{n} \]
                        6. unsub-neg68.8%

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

                          \[\leadsto \frac{-1 \cdot \frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \color{blue}{\frac{0.25 \cdot 1}{x}}}{x}}{x}}{-x}}{n} \]
                        8. metadata-eval68.8%

                          \[\leadsto \frac{-1 \cdot \frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \frac{\color{blue}{0.25}}{x}}{x}}{x}}{-x}}{n} \]
                      9. Simplified68.8%

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

                      if 1.60000000000000007e94 < x

                      1. Initial program 81.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 81.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.3 \cdot 10^{-204}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-143}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{+94}:\\ \;\;\;\;\frac{\frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \frac{0.25}{x}}{x}}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{n}\\ \end{array} \]
                      7. Add Preprocessing

                      Alternative 14: 66.8% accurate, 1.8× speedup?

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

                        1. Initial program 49.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 73.8%

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

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

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

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

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

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

                        if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e161

                        1. Initial program 79.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 76.2%

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

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

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

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

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

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

                        1. Initial program 31.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 0.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \frac{\color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x} - 1}{x}}}{n} \]
                          10. Step-by-step derivation
                            1. mul-1-neg66.5%

                              \[\leadsto \frac{\color{blue}{-\frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x} - 1}{x}}}{n} \]
                            2. distribute-neg-frac266.5%

                              \[\leadsto \frac{\color{blue}{\frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x} - 1}{-x}}}{n} \]
                            3. sub-neg66.5%

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

                              \[\leadsto \frac{\frac{\color{blue}{\frac{-1 \cdot \left(0.3333333333333333 \cdot \frac{1}{x} - 0.5\right)}{x}} + \left(-1\right)}{-x}}{n} \]
                            5. sub-neg66.5%

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

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

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

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

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

                              \[\leadsto \frac{\frac{\frac{\left(-\frac{\color{blue}{0.3333333333333333}}{x}\right) + -1 \cdot -0.5}{x} + \left(-1\right)}{-x}}{n} \]
                            11. distribute-neg-frac66.5%

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

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

                              \[\leadsto \frac{\frac{\frac{\frac{-0.3333333333333333}{x} + \color{blue}{0.5}}{x} + \left(-1\right)}{-x}}{n} \]
                            14. metadata-eval66.5%

                              \[\leadsto \frac{\frac{\frac{\frac{-0.3333333333333333}{x} + 0.5}{x} + \color{blue}{-1}}{-x}}{n} \]
                          11. Simplified66.5%

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

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

                        Alternative 15: 60.4% accurate, 1.9× speedup?

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

                          1. Initial program 38.6%

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

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

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

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

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

                          if 0.890000000000000013 < x < 1.60000000000000007e94

                          1. Initial program 38.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 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. Taylor expanded in x around -inf 68.8%

                            \[\leadsto \frac{\color{blue}{-1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{0.25 \cdot \frac{1}{x} - 0.3333333333333333}{x} - 0.5}{x} - 1}{x}}}{n} \]
                          7. Taylor expanded in x around -inf 68.8%

                            \[\leadsto \frac{-1 \cdot \color{blue}{\left(-1 \cdot \frac{1 + -1 \cdot \frac{0.5 + -1 \cdot \frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}}{x}}{x}\right)}}{n} \]
                          8. Step-by-step derivation
                            1. mul-1-neg68.8%

                              \[\leadsto \frac{-1 \cdot \color{blue}{\left(-\frac{1 + -1 \cdot \frac{0.5 + -1 \cdot \frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}}{x}}{x}\right)}}{n} \]
                            2. distribute-neg-frac268.8%

                              \[\leadsto \frac{-1 \cdot \color{blue}{\frac{1 + -1 \cdot \frac{0.5 + -1 \cdot \frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}}{x}}{-x}}}{n} \]
                            3. mul-1-neg68.8%

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

                              \[\leadsto \frac{-1 \cdot \frac{\color{blue}{1 - \frac{0.5 + -1 \cdot \frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}}{x}}}{-x}}{n} \]
                            5. mul-1-neg68.8%

                              \[\leadsto \frac{-1 \cdot \frac{1 - \frac{0.5 + \color{blue}{\left(-\frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}\right)}}{x}}{-x}}{n} \]
                            6. unsub-neg68.8%

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

                              \[\leadsto \frac{-1 \cdot \frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \color{blue}{\frac{0.25 \cdot 1}{x}}}{x}}{x}}{-x}}{n} \]
                            8. metadata-eval68.8%

                              \[\leadsto \frac{-1 \cdot \frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \frac{\color{blue}{0.25}}{x}}{x}}{x}}{-x}}{n} \]
                          9. Simplified68.8%

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

                          if 1.60000000000000007e94 < x

                          1. Initial program 81.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 81.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.89:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{+94}:\\ \;\;\;\;\frac{\frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \frac{0.25}{x}}{x}}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{n}\\ \end{array} \]
                          7. Add Preprocessing

                          Alternative 16: 60.2% accurate, 1.9× speedup?

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

                            1. Initial program 38.6%

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

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

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

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

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

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

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

                            if 0.69999999999999996 < x < 1.46000000000000005e94

                            1. Initial program 38.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 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. Taylor expanded in x around -inf 68.8%

                              \[\leadsto \frac{\color{blue}{-1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{0.25 \cdot \frac{1}{x} - 0.3333333333333333}{x} - 0.5}{x} - 1}{x}}}{n} \]
                            7. Taylor expanded in x around -inf 68.8%

                              \[\leadsto \frac{-1 \cdot \color{blue}{\left(-1 \cdot \frac{1 + -1 \cdot \frac{0.5 + -1 \cdot \frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}}{x}}{x}\right)}}{n} \]
                            8. Step-by-step derivation
                              1. mul-1-neg68.8%

                                \[\leadsto \frac{-1 \cdot \color{blue}{\left(-\frac{1 + -1 \cdot \frac{0.5 + -1 \cdot \frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}}{x}}{x}\right)}}{n} \]
                              2. distribute-neg-frac268.8%

                                \[\leadsto \frac{-1 \cdot \color{blue}{\frac{1 + -1 \cdot \frac{0.5 + -1 \cdot \frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}}{x}}{-x}}}{n} \]
                              3. mul-1-neg68.8%

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

                                \[\leadsto \frac{-1 \cdot \frac{\color{blue}{1 - \frac{0.5 + -1 \cdot \frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}}{x}}}{-x}}{n} \]
                              5. mul-1-neg68.8%

                                \[\leadsto \frac{-1 \cdot \frac{1 - \frac{0.5 + \color{blue}{\left(-\frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x}\right)}}{x}}{-x}}{n} \]
                              6. unsub-neg68.8%

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

                                \[\leadsto \frac{-1 \cdot \frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \color{blue}{\frac{0.25 \cdot 1}{x}}}{x}}{x}}{-x}}{n} \]
                              8. metadata-eval68.8%

                                \[\leadsto \frac{-1 \cdot \frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \frac{\color{blue}{0.25}}{x}}{x}}{x}}{-x}}{n} \]
                            9. Simplified68.8%

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

                            if 1.46000000000000005e94 < x

                            1. Initial program 81.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 81.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto \frac{\log \color{blue}{1}}{n} \]
                            5. Recombined 3 regimes into one program.
                            6. Final simplification66.0%

                              \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.7:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.46 \cdot 10^{+94}:\\ \;\;\;\;\frac{\frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \frac{0.25}{x}}{x}}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{n}\\ \end{array} \]
                            7. Add Preprocessing

                            Alternative 17: 48.5% accurate, 8.8× speedup?

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

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

                                \[\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. Simplified82.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
                                7. Step-by-step derivation
                                  1. mul-1-neg46.1%

                                    \[\leadsto \color{blue}{-\frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
                                  2. mul-1-neg46.1%

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

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

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

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

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

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

                                  \[\leadsto \color{blue}{-\frac{\left(-\frac{\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x}} \]
                              5. Recombined 2 regimes into one program.
                              6. Final simplification48.9%

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

                              Alternative 18: 47.0% accurate, 12.4× speedup?

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

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

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

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

                                \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
                              7. Step-by-step derivation
                                1. mul-1-neg44.8%

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

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

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

                                  \[\leadsto -\frac{\left(-\frac{\frac{\color{blue}{0.3333333333333333}}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x}\right) - \frac{1}{n}}{x} \]
                                5. *-commutative44.8%

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

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

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

                                \[\leadsto \color{blue}{-\frac{\left(-\frac{\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x}} \]
                              9. Final simplification44.8%

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

                              Alternative 19: 47.0% accurate, 15.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \frac{\color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x} - 1}{x}}}{n} \]
                                10. Step-by-step derivation
                                  1. mul-1-neg44.8%

                                    \[\leadsto \frac{\color{blue}{-\frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x} - 1}{x}}}{n} \]
                                  2. distribute-neg-frac244.8%

                                    \[\leadsto \frac{\color{blue}{\frac{-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x} - 1}{-x}}}{n} \]
                                  3. sub-neg44.8%

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

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

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

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

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

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

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

                                    \[\leadsto \frac{\frac{\frac{\left(-\frac{\color{blue}{0.3333333333333333}}{x}\right) + -1 \cdot -0.5}{x} + \left(-1\right)}{-x}}{n} \]
                                  11. distribute-neg-frac44.8%

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

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

                                    \[\leadsto \frac{\frac{\frac{\frac{-0.3333333333333333}{x} + \color{blue}{0.5}}{x} + \left(-1\right)}{-x}}{n} \]
                                  14. metadata-eval44.8%

                                    \[\leadsto \frac{\frac{\frac{\frac{-0.3333333333333333}{x} + 0.5}{x} + \color{blue}{-1}}{-x}}{n} \]
                                11. Simplified44.8%

                                  \[\leadsto \frac{\color{blue}{\frac{\frac{\frac{-0.3333333333333333}{x} + 0.5}{x} + -1}{-x}}}{n} \]
                                12. Final simplification44.8%

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

                                Alternative 20: 41.0% accurate, 30.1× speedup?

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

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

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

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

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

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

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

                                    \[\leadsto \color{blue}{\frac{\frac{1}{x}}{n}} \]
                                  2. div-inv39.6%

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

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

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

                                Alternative 21: 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 51.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 65.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  Alternative 22: 40.5% accurate, 42.2× speedup?

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

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

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

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

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

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

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

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

                                  Alternative 23: 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 51.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 62.5%

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

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

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

                                    \[\leadsto \frac{\color{blue}{x} - \log x}{n} \]
                                  7. Taylor expanded in x around inf 4.9%

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

                                  Reproduce

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