2nthrt (problem 3.4.6)

Percentage Accurate: 53.5% → 85.7%
Time: 59.3s
Alternatives: 16
Speedup: 1.8×

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 16 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: 85.7% accurate, 0.3× speedup?

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

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

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

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


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

    1. Initial program 84.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 93.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.00000000000000027e-68 < (/.f64 #s(literal 1 binary64) n) < 4.9999999999999999e-13

    1. Initial program 34.8%

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

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

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

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

      1. Initial program 67.5%

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

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

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

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

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

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

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

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

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

    Alternative 2: 85.8% accurate, 1.0× speedup?

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

      1. Initial program 84.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 93.6%

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

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

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

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

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

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

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

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

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

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

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

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

      if -4.00000000000000027e-68 < (/.f64 #s(literal 1 binary64) n) < 4.9999999999999999e-13

      1. Initial program 34.8%

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

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

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

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

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

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

      1. Initial program 67.5%

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

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

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

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

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

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

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

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

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

    Alternative 3: 82.1% accurate, 1.6× speedup?

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

      1. Initial program 84.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 93.6%

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

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

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

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

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

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

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

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

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

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

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

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

      if -4.00000000000000027e-68 < (/.f64 #s(literal 1 binary64) n) < 4.9999999999999999e-13

      1. Initial program 34.8%

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

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

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

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

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

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

      1. Initial program 78.9%

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

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

          \[\leadsto \left(1 + \frac{x}{n}\right) - e^{\frac{\color{blue}{\log x \cdot 1}}{n}} \]
        2. associate-/l*75.5%

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

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

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

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

      1. Initial program 27.3%

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

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

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

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

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

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

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

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

    Alternative 4: 81.1% accurate, 1.6× speedup?

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

      1. Initial program 84.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 93.6%

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

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

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

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

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

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

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

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

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

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

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

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

      if -4.00000000000000027e-68 < (/.f64 #s(literal 1 binary64) n) < 4.9999999999999999e-13

      1. Initial program 34.8%

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

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

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

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

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

      if 4.9999999999999999e-13 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000015e244

      1. Initial program 77.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 71.8%

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

          \[\leadsto \left(1 + \frac{x}{n}\right) - e^{\frac{\color{blue}{\log x \cdot 1}}{n}} \]
        2. associate-/l*71.8%

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

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

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

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

      1. Initial program 3.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 27.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 5: 62.1% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -9.8 \cdot 10^{+253}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;n \leq -4.6:\\ \;\;\;\;\frac{1}{n} \cdot \frac{1}{x}\\ \mathbf{elif}\;n \leq 2.05 \cdot 10^{-198}:\\ \;\;\;\;\frac{\frac{-0.25}{n}}{-{x}^{4}}\\ \mathbf{elif}\;n \leq 16200000000:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;n \leq 3.3 \cdot 10^{+93}:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\ \end{array} \end{array} \]
    (FPCore (x n)
     :precision binary64
     (if (<= n -9.8e+253)
       (/ (log x) (- n))
       (if (<= n -4.6)
         (* (/ 1.0 n) (/ 1.0 x))
         (if (<= n 2.05e-198)
           (/ (/ -0.25 n) (- (pow x 4.0)))
           (if (<= n 16200000000.0)
             (- 1.0 (pow x (/ 1.0 n)))
             (if (<= n 3.3e+93)
               (/ (- x (log x)) n)
               (/
                (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* n x)) (/ 0.5 n)) x))
                x)))))))
    double code(double x, double n) {
    	double tmp;
    	if (n <= -9.8e+253) {
    		tmp = log(x) / -n;
    	} else if (n <= -4.6) {
    		tmp = (1.0 / n) * (1.0 / x);
    	} else if (n <= 2.05e-198) {
    		tmp = (-0.25 / n) / -pow(x, 4.0);
    	} else if (n <= 16200000000.0) {
    		tmp = 1.0 - pow(x, (1.0 / n));
    	} else if (n <= 3.3e+93) {
    		tmp = (x - log(x)) / n;
    	} else {
    		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
    	}
    	return tmp;
    }
    
    real(8) function code(x, n)
        real(8), intent (in) :: x
        real(8), intent (in) :: n
        real(8) :: tmp
        if (n <= (-9.8d+253)) then
            tmp = log(x) / -n
        else if (n <= (-4.6d0)) then
            tmp = (1.0d0 / n) * (1.0d0 / x)
        else if (n <= 2.05d-198) then
            tmp = ((-0.25d0) / n) / -(x ** 4.0d0)
        else if (n <= 16200000000.0d0) then
            tmp = 1.0d0 - (x ** (1.0d0 / n))
        else if (n <= 3.3d+93) then
            tmp = (x - log(x)) / n
        else
            tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) - (0.5d0 / n)) / x)) / x
        end if
        code = tmp
    end function
    
    public static double code(double x, double n) {
    	double tmp;
    	if (n <= -9.8e+253) {
    		tmp = Math.log(x) / -n;
    	} else if (n <= -4.6) {
    		tmp = (1.0 / n) * (1.0 / x);
    	} else if (n <= 2.05e-198) {
    		tmp = (-0.25 / n) / -Math.pow(x, 4.0);
    	} else if (n <= 16200000000.0) {
    		tmp = 1.0 - Math.pow(x, (1.0 / n));
    	} else if (n <= 3.3e+93) {
    		tmp = (x - Math.log(x)) / n;
    	} else {
    		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
    	}
    	return tmp;
    }
    
    def code(x, n):
    	tmp = 0
    	if n <= -9.8e+253:
    		tmp = math.log(x) / -n
    	elif n <= -4.6:
    		tmp = (1.0 / n) * (1.0 / x)
    	elif n <= 2.05e-198:
    		tmp = (-0.25 / n) / -math.pow(x, 4.0)
    	elif n <= 16200000000.0:
    		tmp = 1.0 - math.pow(x, (1.0 / n))
    	elif n <= 3.3e+93:
    		tmp = (x - math.log(x)) / n
    	else:
    		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x
    	return tmp
    
    function code(x, n)
    	tmp = 0.0
    	if (n <= -9.8e+253)
    		tmp = Float64(log(x) / Float64(-n));
    	elseif (n <= -4.6)
    		tmp = Float64(Float64(1.0 / n) * Float64(1.0 / x));
    	elseif (n <= 2.05e-198)
    		tmp = Float64(Float64(-0.25 / n) / Float64(-(x ^ 4.0)));
    	elseif (n <= 16200000000.0)
    		tmp = Float64(1.0 - (x ^ Float64(1.0 / n)));
    	elseif (n <= 3.3e+93)
    		tmp = Float64(Float64(x - log(x)) / n);
    	else
    		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) - Float64(0.5 / n)) / x)) / x);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, n)
    	tmp = 0.0;
    	if (n <= -9.8e+253)
    		tmp = log(x) / -n;
    	elseif (n <= -4.6)
    		tmp = (1.0 / n) * (1.0 / x);
    	elseif (n <= 2.05e-198)
    		tmp = (-0.25 / n) / -(x ^ 4.0);
    	elseif (n <= 16200000000.0)
    		tmp = 1.0 - (x ^ (1.0 / n));
    	elseif (n <= 3.3e+93)
    		tmp = (x - log(x)) / n;
    	else
    		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, n_] := If[LessEqual[n, -9.8e+253], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[n, -4.6], N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.05e-198], N[(N[(-0.25 / n), $MachinePrecision] / (-N[Power[x, 4.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[n, 16200000000.0], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.3e+93], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;n \leq -9.8 \cdot 10^{+253}:\\
    \;\;\;\;\frac{\log x}{-n}\\
    
    \mathbf{elif}\;n \leq -4.6:\\
    \;\;\;\;\frac{1}{n} \cdot \frac{1}{x}\\
    
    \mathbf{elif}\;n \leq 2.05 \cdot 10^{-198}:\\
    \;\;\;\;\frac{\frac{-0.25}{n}}{-{x}^{4}}\\
    
    \mathbf{elif}\;n \leq 16200000000:\\
    \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
    
    \mathbf{elif}\;n \leq 3.3 \cdot 10^{+93}:\\
    \;\;\;\;\frac{x - \log x}{n}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 6 regimes
    2. if n < -9.8000000000000002e253

      1. Initial program 29.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 99.5%

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

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

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

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

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

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

      if -9.8000000000000002e253 < n < -4.5999999999999996

      1. Initial program 33.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{x \cdot n}} \]
      9. Step-by-step derivation
        1. inv-pow57.8%

          \[\leadsto \color{blue}{{\left(x \cdot n\right)}^{-1}} \]
        2. unpow-prod-down60.4%

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

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

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

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

      if -4.5999999999999996 < n < 2.05000000000000006e-198

      1. Initial program 93.3%

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

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

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

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

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

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

        \[\leadsto \color{blue}{-\frac{\left(-\frac{\left(-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x}} \]
      9. Step-by-step derivation
        1. add-sqr-sqrt1.5%

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\sqrt{\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}} \cdot \sqrt{\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        2. sqrt-unprod46.6%

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\sqrt{\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x} \cdot \frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        3. sqr-neg46.6%

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

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\sqrt{-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}} \cdot \sqrt{-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        5. add-sqr-sqrt51.4%

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

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

          \[\leadsto -\frac{\left(-\frac{\left(-\left(0 - \frac{\color{blue}{\frac{\frac{0.25}{x}}{n}} - \frac{0.3333333333333333}{n}}{x}\right)\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        8. sub-div51.4%

          \[\leadsto -\frac{\left(-\frac{\left(-\left(0 - \frac{\color{blue}{\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}}{x}\right)\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      10. Applied egg-rr51.4%

        \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\left(0 - \frac{\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}{x}\right)}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      11. Step-by-step derivation
        1. neg-sub051.4%

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

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\frac{-\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}{x}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        3. distribute-neg-frac51.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\frac{\frac{\frac{-0.25}{x} + 0.3333333333333333}{n}}{x}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      13. Taylor expanded in x around 0 85.8%

        \[\leadsto -\color{blue}{\frac{-0.25}{n \cdot {x}^{4}}} \]
      14. Step-by-step derivation
        1. associate-/r*85.8%

          \[\leadsto -\color{blue}{\frac{\frac{-0.25}{n}}{{x}^{4}}} \]
      15. Simplified85.8%

        \[\leadsto -\color{blue}{\frac{\frac{-0.25}{n}}{{x}^{4}}} \]

      if 2.05000000000000006e-198 < n < 1.62e10

      1. Initial program 78.9%

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

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

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

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

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

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

      if 1.62e10 < n < 3.30000000000000009e93

      1. Initial program 6.7%

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

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

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

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

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

      if 3.30000000000000009e93 < n

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -9.8 \cdot 10^{+253}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;n \leq -4.6:\\ \;\;\;\;\frac{1}{n} \cdot \frac{1}{x}\\ \mathbf{elif}\;n \leq 2.05 \cdot 10^{-198}:\\ \;\;\;\;\frac{\frac{-0.25}{n}}{-{x}^{4}}\\ \mathbf{elif}\;n \leq 16200000000:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;n \leq 3.3 \cdot 10^{+93}:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 6: 76.7% accurate, 1.7× speedup?

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

      1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{-\frac{\left(-\frac{\left(-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x}} \]
      9. Step-by-step derivation
        1. add-sqr-sqrt1.7%

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\sqrt{\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}} \cdot \sqrt{\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        2. sqrt-unprod51.3%

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\sqrt{\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x} \cdot \frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        3. sqr-neg51.3%

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

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\sqrt{-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}} \cdot \sqrt{-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        5. add-sqr-sqrt48.9%

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\left(-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}\right)}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        6. neg-sub048.9%

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

          \[\leadsto -\frac{\left(-\frac{\left(-\left(0 - \frac{\color{blue}{\frac{\frac{0.25}{x}}{n}} - \frac{0.3333333333333333}{n}}{x}\right)\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        8. sub-div48.9%

          \[\leadsto -\frac{\left(-\frac{\left(-\left(0 - \frac{\color{blue}{\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}}{x}\right)\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      10. Applied egg-rr48.9%

        \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\left(0 - \frac{\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}{x}\right)}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      11. Step-by-step derivation
        1. neg-sub048.9%

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

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\frac{-\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}{x}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        3. distribute-neg-frac48.9%

          \[\leadsto -\frac{\left(-\frac{\left(-\frac{\color{blue}{\frac{-\left(\frac{0.25}{x} - 0.3333333333333333\right)}{n}}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        4. mul-1-neg48.9%

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto -\frac{\left(-\frac{\left(-\frac{\frac{\frac{-0.25}{x} + \color{blue}{0.3333333333333333}}{n}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      12. Simplified48.9%

        \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\frac{\frac{\frac{-0.25}{x} + 0.3333333333333333}{n}}{x}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      13. Taylor expanded in x around 0 86.7%

        \[\leadsto -\color{blue}{\frac{-0.25}{n \cdot {x}^{4}}} \]
      14. Step-by-step derivation
        1. associate-/r*86.7%

          \[\leadsto -\color{blue}{\frac{\frac{-0.25}{n}}{{x}^{4}}} \]
      15. Simplified86.7%

        \[\leadsto -\color{blue}{\frac{\frac{-0.25}{n}}{{x}^{4}}} \]

      if -20 < (/.f64 #s(literal 1 binary64) n) < 4.9999999999999999e-13

      1. Initial program 32.3%

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

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

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

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

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

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

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

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

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

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

      1. Initial program 78.9%

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

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

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

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

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

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

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

      1. Initial program 27.3%

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

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

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

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

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

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

        \[\leadsto \color{blue}{-\frac{\left(-\frac{\left(-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x}} \]
      9. Step-by-step derivation
        1. add-sqr-sqrt0.1%

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\sqrt{\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}} \cdot \sqrt{\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        2. sqrt-unprod0.1%

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\sqrt{\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x} \cdot \frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        3. sqr-neg0.1%

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

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\sqrt{-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}} \cdot \sqrt{-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        5. add-sqr-sqrt76.4%

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

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

          \[\leadsto -\frac{\left(-\frac{\left(-\left(0 - \frac{\color{blue}{\frac{\frac{0.25}{x}}{n}} - \frac{0.3333333333333333}{n}}{x}\right)\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        8. sub-div76.4%

          \[\leadsto -\frac{\left(-\frac{\left(-\left(0 - \frac{\color{blue}{\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}}{x}\right)\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      10. Applied egg-rr76.4%

        \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\left(0 - \frac{\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}{x}\right)}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      11. Step-by-step derivation
        1. neg-sub076.4%

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

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\frac{-\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}{x}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        3. distribute-neg-frac76.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\frac{\frac{\frac{-0.25}{x} + 0.3333333333333333}{n}}{x}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      13. Taylor expanded in x around 0 76.4%

        \[\leadsto -\frac{\left(-\frac{\left(-\frac{\color{blue}{\frac{-0.25}{n \cdot x}}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      14. Step-by-step derivation
        1. *-commutative76.4%

          \[\leadsto -\frac{\left(-\frac{\left(-\frac{\frac{-0.25}{\color{blue}{x \cdot n}}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      15. Simplified76.4%

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

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

    Alternative 7: 81.8% accurate, 1.7× speedup?

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

      1. Initial program 84.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 93.6%

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

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

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

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

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

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

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

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

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

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

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

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

      if -4.00000000000000027e-68 < (/.f64 #s(literal 1 binary64) n) < 4.9999999999999999e-13

      1. Initial program 34.8%

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

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

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

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

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

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

      1. Initial program 78.9%

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

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

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

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

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

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

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

      1. Initial program 27.3%

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

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

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

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

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

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

        \[\leadsto \color{blue}{-\frac{\left(-\frac{\left(-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x}} \]
      9. Step-by-step derivation
        1. add-sqr-sqrt0.1%

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\sqrt{\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}} \cdot \sqrt{\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        2. sqrt-unprod0.1%

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\sqrt{\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x} \cdot \frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        3. sqr-neg0.1%

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

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\sqrt{-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}} \cdot \sqrt{-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        5. add-sqr-sqrt76.4%

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

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

          \[\leadsto -\frac{\left(-\frac{\left(-\left(0 - \frac{\color{blue}{\frac{\frac{0.25}{x}}{n}} - \frac{0.3333333333333333}{n}}{x}\right)\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        8. sub-div76.4%

          \[\leadsto -\frac{\left(-\frac{\left(-\left(0 - \frac{\color{blue}{\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}}{x}\right)\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      10. Applied egg-rr76.4%

        \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\left(0 - \frac{\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}{x}\right)}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      11. Step-by-step derivation
        1. neg-sub076.4%

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

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\frac{-\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}{x}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        3. distribute-neg-frac76.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\frac{\frac{\frac{-0.25}{x} + 0.3333333333333333}{n}}{x}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      13. Taylor expanded in x around 0 76.4%

        \[\leadsto -\frac{\left(-\frac{\left(-\frac{\color{blue}{\frac{-0.25}{n \cdot x}}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      14. Step-by-step derivation
        1. *-commutative76.4%

          \[\leadsto -\frac{\left(-\frac{\left(-\frac{\frac{-0.25}{\color{blue}{x \cdot n}}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      15. Simplified76.4%

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

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

    Alternative 8: 56.6% accurate, 1.7× speedup?

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

      1. Initial program 68.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 68.3%

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

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

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

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

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

      if 3.89999999999999994e-184 < x < 2.5999999999999999e-89

      1. Initial program 40.5%

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

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

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

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

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

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

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

      if 2.5999999999999999e-89 < x < 2.40000000000000017e-84

      1. Initial program 80.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 4.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 2.40000000000000017e-84 < x < 0.900000000000000022

      1. Initial program 31.9%

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

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

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

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

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

      if 0.900000000000000022 < x

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 3.9 \cdot 10^{-184}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-89}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{-84}:\\ \;\;\;\;\frac{\frac{-1 + \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{-x}}{n}\\ \mathbf{elif}\;x \leq 0.9:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{\frac{0.3333333333333333 - \frac{0.25}{x}}{x}}{n} + \frac{-0.5}{n}}{x}}{x}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 9: 57.7% accurate, 1.8× speedup?

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

      1. Initial program 55.4%

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

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

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

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

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

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

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

      if 1.12e-89 < x < 2.40000000000000017e-84

      1. Initial program 80.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 4.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 2.40000000000000017e-84 < x < 0.900000000000000022

      1. Initial program 31.9%

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

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

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

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

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

      if 0.900000000000000022 < x

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

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

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

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

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

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

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

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

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

    Alternative 10: 57.5% accurate, 1.8× speedup?

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

      1. Initial program 48.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 51.6%

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

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

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

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

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

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

      if 1.7e-89 < x < 2.40000000000000017e-84

      1. Initial program 80.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 4.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 0.71999999999999997 < x

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

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

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

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

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

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

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

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

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

    Alternative 11: 47.0% accurate, 11.1× speedup?

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

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

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

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

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

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

      \[\leadsto \color{blue}{-\frac{\left(-\frac{\left(-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt22.9%

        \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\sqrt{\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}} \cdot \sqrt{\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      2. sqrt-unprod45.6%

        \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\sqrt{\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x} \cdot \frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      3. sqr-neg45.6%

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

        \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\sqrt{-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}} \cdot \sqrt{-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      5. add-sqr-sqrt48.9%

        \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\left(-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}\right)}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      6. neg-sub048.9%

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

        \[\leadsto -\frac{\left(-\frac{\left(-\left(0 - \frac{\color{blue}{\frac{\frac{0.25}{x}}{n}} - \frac{0.3333333333333333}{n}}{x}\right)\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      8. sub-div48.9%

        \[\leadsto -\frac{\left(-\frac{\left(-\left(0 - \frac{\color{blue}{\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}}{x}\right)\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
    10. Applied egg-rr48.9%

      \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\left(0 - \frac{\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}{x}\right)}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
    11. Step-by-step derivation
      1. neg-sub048.9%

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

        \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\frac{-\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}{x}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      3. distribute-neg-frac48.9%

        \[\leadsto -\frac{\left(-\frac{\left(-\frac{\color{blue}{\frac{-\left(\frac{0.25}{x} - 0.3333333333333333\right)}{n}}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      4. mul-1-neg48.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\frac{\left(-\frac{\left(-\frac{\frac{\frac{-0.25}{x} + \color{blue}{0.3333333333333333}}{n}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
    12. Simplified48.9%

      \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\frac{\frac{\frac{-0.25}{x} + 0.3333333333333333}{n}}{x}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
    13. Taylor expanded in n around -inf 48.9%

      \[\leadsto -\frac{\left(-\color{blue}{\frac{-1 \cdot \frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x} - 0.5}{n \cdot x}}\right) - \frac{1}{n}}{x} \]
    14. Step-by-step derivation
      1. Simplified48.9%

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

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

      Alternative 12: 47.0% accurate, 11.1× speedup?

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

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

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

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

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

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

        \[\leadsto \color{blue}{-\frac{\left(-\frac{\left(-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x}} \]
      9. Step-by-step derivation
        1. add-sqr-sqrt22.9%

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\sqrt{\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}} \cdot \sqrt{\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        2. sqrt-unprod45.6%

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\sqrt{\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x} \cdot \frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        3. sqr-neg45.6%

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

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\sqrt{-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}} \cdot \sqrt{-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        5. add-sqr-sqrt48.9%

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\left(-\frac{\frac{0.25}{x \cdot n} - \frac{0.3333333333333333}{n}}{x}\right)}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        6. neg-sub048.9%

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

          \[\leadsto -\frac{\left(-\frac{\left(-\left(0 - \frac{\color{blue}{\frac{\frac{0.25}{x}}{n}} - \frac{0.3333333333333333}{n}}{x}\right)\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        8. sub-div48.9%

          \[\leadsto -\frac{\left(-\frac{\left(-\left(0 - \frac{\color{blue}{\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}}{x}\right)\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      10. Applied egg-rr48.9%

        \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\left(0 - \frac{\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}{x}\right)}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      11. Step-by-step derivation
        1. neg-sub048.9%

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

          \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\frac{-\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}{x}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        3. distribute-neg-frac48.9%

          \[\leadsto -\frac{\left(-\frac{\left(-\frac{\color{blue}{\frac{-\left(\frac{0.25}{x} - 0.3333333333333333\right)}{n}}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
        4. mul-1-neg48.9%

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto -\frac{\left(-\frac{\left(-\frac{\frac{\frac{-0.25}{x} + \color{blue}{0.3333333333333333}}{n}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      12. Simplified48.9%

        \[\leadsto -\frac{\left(-\frac{\left(-\color{blue}{\frac{\frac{\frac{-0.25}{x} + 0.3333333333333333}{n}}{x}}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      13. Taylor expanded in x around 0 48.9%

        \[\leadsto -\frac{\left(-\frac{\left(-\frac{\color{blue}{\frac{-0.25}{n \cdot x}}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      14. Step-by-step derivation
        1. *-commutative48.9%

          \[\leadsto -\frac{\left(-\frac{\left(-\frac{\frac{-0.25}{\color{blue}{x \cdot n}}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      15. Simplified48.9%

        \[\leadsto -\frac{\left(-\frac{\left(-\frac{\color{blue}{\frac{-0.25}{x \cdot n}}}{x}\right) - \frac{0.5}{n}}{x}\right) - \frac{1}{n}}{x} \]
      16. Final simplification48.9%

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

      Alternative 13: 46.2% accurate, 12.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 14: 46.2% accurate, 15.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 15: 40.2% accurate, 42.2× speedup?

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

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

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

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

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

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

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

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

      Alternative 16: 40.7% accurate, 42.2× speedup?

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{\frac{1}{n}}{x}} \]
      11. Simplified40.7%

        \[\leadsto \color{blue}{\frac{\frac{1}{n}}{x}} \]
      12. Final simplification40.7%

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

      Reproduce

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