2nthrt (problem 3.4.6)

Percentage Accurate: 53.5% → 84.6%
Time: 42.9s
Alternatives: 17
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 17 alternatives:

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

Initial Program: 53.5% accurate, 1.0× speedup?

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

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

Alternative 1: 84.6% accurate, 0.1× speedup?

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

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

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

\mathbf{elif}\;n \leq 2.1 \cdot 10^{+95}:\\
\;\;\;\;\frac{{\left({x}^{\left(\frac{0.5}{n}\right)}\right)}^{2}}{n \cdot x}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{t\_0 - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \frac{-0.041666666666666664 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{n}\right) - \left(\log \left({\left(\sqrt[3]{x}\right)}^{2}\right) + \log \left(\sqrt[3]{x}\right)\right)}{n}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if n < -3.1e7

    1. Initial program 42.5%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in n around inf 93.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. Simplified93.7%

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

      if -3.1e7 < n < 8.5e6

      1. Initial program 88.4%

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

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

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

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

      if 8.5e6 < n < 2.1e95

      1. Initial program 8.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 inf 61.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-neg61.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{{\left({x}^{\left(\frac{\frac{1}{n}}{2}\right)}\right)}^{2}}}{x \cdot n} \]
      8. Taylor expanded in n around 0 61.5%

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

      if 2.1e95 < n

      1. Initial program 21.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 80.7%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(\log \left({\left(\sqrt[3]{x}\right)}^{2}\right) + \log \left(\sqrt[3]{x}\right)\right)} - \left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \frac{-0.041666666666666664 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{n}\right)}{-n} \]
    5. Recombined 4 regimes into one program.
    6. Final simplification90.2%

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

    Alternative 2: 85.6% accurate, 0.3× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -100:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-97}:\\ \;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(\frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right)}{n} - \log x\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\frac{{\left({x}^{\left(\frac{0.5}{n}\right)}\right)}^{2}}{n \cdot x}\\ \mathbf{else}:\\ \;\;\;\;e^{{\left(\sqrt[3]{\log \left(e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\right)}\right)}^{3}}\\ \end{array} \end{array} \]
    (FPCore (x n)
     :precision binary64
     (if (<= (/ 1.0 n) -100.0)
       (/ (pow x (+ (/ 1.0 n) -1.0)) n)
       (if (<= (/ 1.0 n) 2e-97)
         (/
          (+
           (log1p x)
           (- (/ (* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0))) n) (log x)))
          n)
         (if (<= (/ 1.0 n) 2e-7)
           (/ (pow (pow x (/ 0.5 n)) 2.0) (* n x))
           (exp
            (pow (cbrt (log (- (exp (/ (log1p x) n)) (pow x (/ 1.0 n))))) 3.0))))))
    double code(double x, double n) {
    	double tmp;
    	if ((1.0 / n) <= -100.0) {
    		tmp = pow(x, ((1.0 / n) + -1.0)) / n;
    	} else if ((1.0 / n) <= 2e-97) {
    		tmp = (log1p(x) + (((0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) / n) - log(x))) / n;
    	} else if ((1.0 / n) <= 2e-7) {
    		tmp = pow(pow(x, (0.5 / n)), 2.0) / (n * x);
    	} else {
    		tmp = exp(pow(cbrt(log((exp((log1p(x) / n)) - pow(x, (1.0 / n))))), 3.0));
    	}
    	return tmp;
    }
    
    public static double code(double x, double n) {
    	double tmp;
    	if ((1.0 / n) <= -100.0) {
    		tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
    	} else if ((1.0 / n) <= 2e-97) {
    		tmp = (Math.log1p(x) + (((0.5 * (Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0))) / n) - Math.log(x))) / n;
    	} else if ((1.0 / n) <= 2e-7) {
    		tmp = Math.pow(Math.pow(x, (0.5 / n)), 2.0) / (n * x);
    	} else {
    		tmp = Math.exp(Math.pow(Math.cbrt(Math.log((Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n))))), 3.0));
    	}
    	return tmp;
    }
    
    function code(x, n)
    	tmp = 0.0
    	if (Float64(1.0 / n) <= -100.0)
    		tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n);
    	elseif (Float64(1.0 / n) <= 2e-97)
    		tmp = Float64(Float64(log1p(x) + Float64(Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) / n) - log(x))) / n);
    	elseif (Float64(1.0 / n) <= 2e-7)
    		tmp = Float64(((x ^ Float64(0.5 / n)) ^ 2.0) / Float64(n * x));
    	else
    		tmp = exp((cbrt(log(Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))))) ^ 3.0));
    	end
    	return tmp
    end
    
    code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -100.0], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-97], 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), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-7], N[(N[Power[N[Power[x, N[(0.5 / n), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], N[Exp[N[Power[N[Power[N[Log[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\frac{1}{n} \leq -100:\\
    \;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-97}:\\
    \;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(\frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right)}{n} - \log x\right)}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-7}:\\
    \;\;\;\;\frac{{\left({x}^{\left(\frac{0.5}{n}\right)}\right)}^{2}}{n \cdot x}\\
    
    \mathbf{else}:\\
    \;\;\;\;e^{{\left(\sqrt[3]{\log \left(e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\right)}\right)}^{3}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if (/.f64 #s(literal 1 binary64) n) < -100

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      1. Initial program 33.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 88.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. Simplified88.2%

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

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

        1. Initial program 8.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 inf 61.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-neg61.4%

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{{\left({x}^{\left(\frac{\frac{1}{n}}{2}\right)}\right)}^{2}}}{x \cdot n} \]
        8. Taylor expanded in n around 0 61.5%

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

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

        1. Initial program 68.4%

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

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

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

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

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

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

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

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

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

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

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

      Alternative 3: 85.5% accurate, 0.3× speedup?

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

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        1. Initial program 33.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 88.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. Simplified88.2%

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

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

          1. Initial program 8.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 inf 61.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-neg61.4%

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\color{blue}{{\left({x}^{\left(\frac{\frac{1}{n}}{2}\right)}\right)}^{2}}}{x \cdot n} \]
          8. Taylor expanded in n around 0 61.5%

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

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

          1. Initial program 68.4%

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

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

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

              \[\leadsto {\color{blue}{\left({\left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\right)}^{3}\right)}}^{0.3333333333333333} \]
            4. pow-to-exp68.4%

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

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

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

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

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

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

        Alternative 4: 85.9% accurate, 0.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -15000000000:\\ \;\;\;\;\frac{-1}{n} \cdot \left(\log x - \mathsf{log1p}\left(x\right)\right)\\ \mathbf{elif}\;n \leq 115000:\\ \;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;n \leq 5.8 \cdot 10^{+94}:\\ \;\;\;\;\frac{{\left({x}^{\left(\frac{0.5}{n}\right)}\right)}^{2}}{n \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \end{array} \end{array} \]
        (FPCore (x n)
         :precision binary64
         (if (<= n -15000000000.0)
           (* (/ -1.0 n) (- (log x) (log1p x)))
           (if (<= n 115000.0)
             (- (exp (/ (log1p x) n)) (pow x (/ 1.0 n)))
             (if (<= n 5.8e+94)
               (/ (pow (pow x (/ 0.5 n)) 2.0) (* n x))
               (/ (log (/ (+ x 1.0) x)) n)))))
        double code(double x, double n) {
        	double tmp;
        	if (n <= -15000000000.0) {
        		tmp = (-1.0 / n) * (log(x) - log1p(x));
        	} else if (n <= 115000.0) {
        		tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
        	} else if (n <= 5.8e+94) {
        		tmp = pow(pow(x, (0.5 / n)), 2.0) / (n * x);
        	} else {
        		tmp = log(((x + 1.0) / x)) / n;
        	}
        	return tmp;
        }
        
        public static double code(double x, double n) {
        	double tmp;
        	if (n <= -15000000000.0) {
        		tmp = (-1.0 / n) * (Math.log(x) - Math.log1p(x));
        	} else if (n <= 115000.0) {
        		tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
        	} else if (n <= 5.8e+94) {
        		tmp = Math.pow(Math.pow(x, (0.5 / n)), 2.0) / (n * x);
        	} else {
        		tmp = Math.log(((x + 1.0) / x)) / n;
        	}
        	return tmp;
        }
        
        def code(x, n):
        	tmp = 0
        	if n <= -15000000000.0:
        		tmp = (-1.0 / n) * (math.log(x) - math.log1p(x))
        	elif n <= 115000.0:
        		tmp = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n))
        	elif n <= 5.8e+94:
        		tmp = math.pow(math.pow(x, (0.5 / n)), 2.0) / (n * x)
        	else:
        		tmp = math.log(((x + 1.0) / x)) / n
        	return tmp
        
        function code(x, n)
        	tmp = 0.0
        	if (n <= -15000000000.0)
        		tmp = Float64(Float64(-1.0 / n) * Float64(log(x) - log1p(x)));
        	elseif (n <= 115000.0)
        		tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n)));
        	elseif (n <= 5.8e+94)
        		tmp = Float64(((x ^ Float64(0.5 / n)) ^ 2.0) / Float64(n * x));
        	else
        		tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n);
        	end
        	return tmp
        end
        
        code[x_, n_] := If[LessEqual[n, -15000000000.0], N[(N[(-1.0 / n), $MachinePrecision] * N[(N[Log[x], $MachinePrecision] - N[Log[1 + x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 115000.0], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.8e+94], N[(N[Power[N[Power[x, N[(0.5 / n), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;n \leq -15000000000:\\
        \;\;\;\;\frac{-1}{n} \cdot \left(\log x - \mathsf{log1p}\left(x\right)\right)\\
        
        \mathbf{elif}\;n \leq 115000:\\
        \;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
        
        \mathbf{elif}\;n \leq 5.8 \cdot 10^{+94}:\\
        \;\;\;\;\frac{{\left({x}^{\left(\frac{0.5}{n}\right)}\right)}^{2}}{n \cdot x}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 4 regimes
        2. if n < -1.5e10

          1. Initial program 42.5%

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

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

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

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

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

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

          if -1.5e10 < n < 115000

          1. Initial program 88.4%

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

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

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

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

          if 115000 < n < 5.7999999999999997e94

          1. Initial program 8.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 inf 61.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-neg61.4%

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\color{blue}{{\left({x}^{\left(\frac{\frac{1}{n}}{2}\right)}\right)}^{2}}}{x \cdot n} \]
          8. Taylor expanded in n around 0 61.5%

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

          if 5.7999999999999997e94 < n

          1. Initial program 21.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 80.7%

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

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

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

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

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

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

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

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

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

        Alternative 5: 81.1% accurate, 0.9× speedup?

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

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          1. Initial program 8.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 inf 61.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-neg61.4%

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\color{blue}{{\left({x}^{\left(\frac{\frac{1}{n}}{2}\right)}\right)}^{2}}}{x \cdot n} \]
          8. Taylor expanded in n around 0 61.5%

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

          if 1.9999999999999999e-7 < (/.f64 #s(literal 1 binary64) n) < 4.99999999999999981e225

          1. Initial program 83.4%

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

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

          1. Initial program 20.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 6: 80.5% accurate, 0.9× speedup?

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

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          1. Initial program 10.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\color{blue}{{\left({x}^{\left(\frac{\frac{1}{n}}{2}\right)}\right)}^{2}}}{x \cdot n} \]
          8. Taylor expanded in n around 0 60.2%

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

          if 1e-3 < (/.f64 #s(literal 1 binary64) n) < 4.00000000000000023e232

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

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

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

          1. Initial program 12.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 7: 80.5% accurate, 1.5× speedup?

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

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          1. Initial program 10.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 1e-3 < (/.f64 #s(literal 1 binary64) n) < 4.00000000000000023e232

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

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

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

          1. Initial program 12.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 8: 66.0% accurate, 1.6× speedup?

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

          1. Initial program 94.4%

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

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

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

          1. Initial program 39.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 86.6%

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

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

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

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

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

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

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

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

          if 2.00000000000000007e-97 < (/.f64 #s(literal 1 binary64) n) < 1e-3 or 4.99999999999999981e225 < (/.f64 #s(literal 1 binary64) n)

          1. Initial program 13.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 44.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 9: 80.5% accurate, 1.6× speedup?

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

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          1. Initial program 10.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 1e-3 < (/.f64 #s(literal 1 binary64) n) < 4.99999999999999981e225

          1. Initial program 83.5%

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

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

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

          1. Initial program 20.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 10: 80.5% accurate, 1.6× speedup?

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

          1. Initial program 75.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 1e-3 < (/.f64 #s(literal 1 binary64) n) < 4.99999999999999981e225

          1. Initial program 83.5%

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

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

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

          1. Initial program 20.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 11: 58.9% accurate, 1.8× speedup?

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

          1. Initial program 54.4%

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

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

          if 2.00000000000000006e-161 < x < 0.849999999999999978

          1. Initial program 37.5%

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

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

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

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

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

          if 0.849999999999999978 < x < 2e103

          1. Initial program 41.5%

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

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

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

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

            \[\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. associate-*r/65.5%

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

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

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

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

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

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

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

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

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

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

          if 2e103 < x

          1. Initial program 79.8%

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

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

            \[\leadsto 1 - \color{blue}{1} \]
          5. Step-by-step derivation
            1. metadata-eval79.8%

              \[\leadsto \color{blue}{0} \]
          6. Applied egg-rr79.8%

            \[\leadsto \color{blue}{0} \]
        3. Recombined 4 regimes into one program.
        4. Final simplification64.5%

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

        Alternative 12: 60.4% accurate, 1.9× speedup?

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

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

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

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

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

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

          if 0.849999999999999978 < x < 1.31999999999999999e103

          1. Initial program 41.5%

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

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

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

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

            \[\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. associate-*r/65.5%

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

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

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

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

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

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

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

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

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

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

          if 1.31999999999999999e103 < x

          1. Initial program 79.8%

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

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

            \[\leadsto 1 - \color{blue}{1} \]
          5. Step-by-step derivation
            1. metadata-eval79.8%

              \[\leadsto \color{blue}{0} \]
          6. Applied egg-rr79.8%

            \[\leadsto \color{blue}{0} \]
        3. Recombined 3 regimes into one program.
        4. Final simplification61.9%

          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.85:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 1.32 \cdot 10^{+103}:\\ \;\;\;\;\frac{\frac{1}{n} - \frac{\frac{0.5}{n} - \frac{0.3333333333333333}{n \cdot x}}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
        5. Add Preprocessing

        Alternative 13: 60.2% accurate, 1.9× speedup?

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

          1. Initial program 45.1%

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

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

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

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

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

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

          if 0.57999999999999996 < x < 3.14999999999999985e103

          1. Initial program 41.5%

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

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

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

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

            \[\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. associate-*r/65.5%

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

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

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

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

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

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

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

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

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

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

          if 3.14999999999999985e103 < x

          1. Initial program 79.8%

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

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

            \[\leadsto 1 - \color{blue}{1} \]
          5. Step-by-step derivation
            1. metadata-eval79.8%

              \[\leadsto \color{blue}{0} \]
          6. Applied egg-rr79.8%

            \[\leadsto \color{blue}{0} \]
        3. Recombined 3 regimes into one program.
        4. Final simplification61.5%

          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.58:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{elif}\;x \leq 3.15 \cdot 10^{+103}:\\ \;\;\;\;\frac{\frac{1}{n} - \frac{\frac{0.5}{n} - \frac{0.3333333333333333}{n \cdot x}}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
        5. Add Preprocessing

        Alternative 14: 49.3% accurate, 9.6× speedup?

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

          1. Initial program 44.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 50.5%

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

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

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

            \[\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. associate-*r/32.0%

              \[\leadsto \color{blue}{\frac{-1 \cdot \left(-1 \cdot \frac{0.3333333333333333 \cdot \frac{1}{n \cdot x} - 0.5 \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}{x}} \]
            2. mul-1-neg32.0%

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

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

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

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

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

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

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

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

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

          if 2.64999999999999985e103 < x

          1. Initial program 79.8%

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

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

            \[\leadsto 1 - \color{blue}{1} \]
          5. Step-by-step derivation
            1. metadata-eval79.8%

              \[\leadsto \color{blue}{0} \]
          6. Applied egg-rr79.8%

            \[\leadsto \color{blue}{0} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification46.6%

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

        Alternative 15: 47.1% accurate, 17.6× speedup?

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

          1. Initial program 100.0%

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

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

            \[\leadsto 1 - \color{blue}{1} \]
          5. Step-by-step derivation
            1. metadata-eval52.9%

              \[\leadsto \color{blue}{0} \]
          6. Applied egg-rr52.9%

            \[\leadsto \color{blue}{0} \]

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{\frac{\frac{1}{n}}{x}} \]
          12. Simplified41.2%

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

        Alternative 16: 40.7% accurate, 21.1× speedup?

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

          1. Initial program 71.3%

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

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

            \[\leadsto 1 - \color{blue}{1} \]
          5. Step-by-step derivation
            1. metadata-eval47.3%

              \[\leadsto \color{blue}{0} \]
          6. Applied egg-rr47.3%

            \[\leadsto \color{blue}{0} \]

          if -4.40000000000000008e-268 < n

          1. Initial program 38.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 17: 31.5% accurate, 211.0× speedup?

        \[\begin{array}{l} \\ 0 \end{array} \]
        (FPCore (x n) :precision binary64 0.0)
        double code(double x, double n) {
        	return 0.0;
        }
        
        real(8) function code(x, n)
            real(8), intent (in) :: x
            real(8), intent (in) :: n
            code = 0.0d0
        end function
        
        public static double code(double x, double n) {
        	return 0.0;
        }
        
        def code(x, n):
        	return 0.0
        
        function code(x, n)
        	return 0.0
        end
        
        function tmp = code(x, n)
        	tmp = 0.0;
        end
        
        code[x_, n_] := 0.0
        
        \begin{array}{l}
        
        \\
        0
        \end{array}
        
        Derivation
        1. Initial program 55.3%

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

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

          \[\leadsto 1 - \color{blue}{1} \]
        5. Step-by-step derivation
          1. metadata-eval30.3%

            \[\leadsto \color{blue}{0} \]
        6. Applied egg-rr30.3%

          \[\leadsto \color{blue}{0} \]
        7. Add Preprocessing

        Reproduce

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