2nthrt (problem 3.4.6)

Percentage Accurate: 54.0% → 92.4%
Time: 41.3s
Alternatives: 16
Speedup: 1.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 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: 54.0% accurate, 1.0× speedup?

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

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

Alternative 1: 92.4% accurate, 0.2× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left(t\_0, \frac{\frac{-0.5}{n}}{x}, \frac{t\_0}{n}\right)}{x}\right)\right)\\


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

    1. Initial program 43.4%

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

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

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

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

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

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

    if 6 < x

    1. Initial program 62.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 81.9%

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

        \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}} \]
      2. Taylor expanded in n around inf 98.2%

        \[\leadsto \frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \color{blue}{\frac{-0.5}{n \cdot x}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x} \]
      3. Step-by-step derivation
        1. *-commutative98.2%

          \[\leadsto \frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{\color{blue}{x \cdot n}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x} \]
      4. Simplified98.2%

        \[\leadsto \frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \color{blue}{\frac{-0.5}{x \cdot n}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x} \]
      5. Step-by-step derivation
        1. expm1-log1p-u98.2%

          \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{x \cdot n}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)\right)} \]
        2. expm1-undefine63.0%

          \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{x \cdot n}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)} - 1} \]
      6. Applied egg-rr63.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{x \cdot n}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)} - 1} \]
      7. Step-by-step derivation
        1. expm1-define98.2%

          \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{x \cdot n}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)\right)} \]
        2. *-commutative98.2%

          \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{\color{blue}{n \cdot x}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)\right) \]
        3. associate-/r*98.2%

          \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \color{blue}{\frac{\frac{-0.5}{n}}{x}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)\right) \]
      8. Simplified98.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\frac{-0.5}{n}}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)\right)} \]
    5. Recombined 2 regimes into one program.
    6. Add Preprocessing

    Alternative 2: 87.4% accurate, 0.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;x \leq 4:\\ \;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + \frac{0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right)}{n}}{n}\right) - 2 \cdot \log \left(\sqrt{x}\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left(t\_0, \frac{\frac{-0.5}{n}}{x}, \frac{t\_0}{n}\right)}{x}\right)\right)\\ \end{array} \end{array} \]
    (FPCore (x n)
     :precision binary64
     (let* ((t_0 (pow x (/ 1.0 n))))
       (if (<= x 4.0)
         (/
          (-
           (+
            (log1p x)
            (/
             (+
              (* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0)))
              (/
               (* 0.16666666666666666 (- (pow (log1p x) 3.0) (pow (log x) 3.0)))
               n))
             n))
           (* 2.0 (log (sqrt x))))
          n)
         (expm1 (log1p (/ (fma t_0 (/ (/ -0.5 n) x) (/ t_0 n)) x))))))
    double code(double x, double n) {
    	double t_0 = pow(x, (1.0 / n));
    	double tmp;
    	if (x <= 4.0) {
    		tmp = ((log1p(x) + (((0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) + ((0.16666666666666666 * (pow(log1p(x), 3.0) - pow(log(x), 3.0))) / n)) / n)) - (2.0 * log(sqrt(x)))) / n;
    	} else {
    		tmp = expm1(log1p((fma(t_0, ((-0.5 / n) / x), (t_0 / n)) / x)));
    	}
    	return tmp;
    }
    
    function code(x, n)
    	t_0 = x ^ Float64(1.0 / n)
    	tmp = 0.0
    	if (x <= 4.0)
    		tmp = Float64(Float64(Float64(log1p(x) + Float64(Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) + Float64(Float64(0.16666666666666666 * Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0))) / n)) / n)) - Float64(2.0 * log(sqrt(x)))) / n);
    	else
    		tmp = expm1(log1p(Float64(fma(t_0, Float64(Float64(-0.5 / n) / x), Float64(t_0 / n)) / x)));
    	end
    	return tmp
    end
    
    code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 4.0], N[(N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.16666666666666666 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[(2.0 * N[Log[N[Sqrt[x], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(Exp[N[Log[1 + N[(N[(t$95$0 * N[(N[(-0.5 / n), $MachinePrecision] / x), $MachinePrecision] + N[(t$95$0 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := {x}^{\left(\frac{1}{n}\right)}\\
    \mathbf{if}\;x \leq 4:\\
    \;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + \frac{0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right)}{n}}{n}\right) - 2 \cdot \log \left(\sqrt{x}\right)}{n}\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left(t\_0, \frac{\frac{-0.5}{n}}{x}, \frac{t\_0}{n}\right)}{x}\right)\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 4

      1. Initial program 43.4%

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

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

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

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

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

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

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

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

      if 4 < x

      1. Initial program 62.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 81.9%

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

          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}} \]
        2. Taylor expanded in n around inf 98.2%

          \[\leadsto \frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \color{blue}{\frac{-0.5}{n \cdot x}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x} \]
        3. Step-by-step derivation
          1. *-commutative98.2%

            \[\leadsto \frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{\color{blue}{x \cdot n}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x} \]
        4. Simplified98.2%

          \[\leadsto \frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \color{blue}{\frac{-0.5}{x \cdot n}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x} \]
        5. Step-by-step derivation
          1. expm1-log1p-u98.2%

            \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{x \cdot n}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)\right)} \]
          2. expm1-undefine63.0%

            \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{x \cdot n}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)} - 1} \]
        6. Applied egg-rr63.0%

          \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{x \cdot n}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)} - 1} \]
        7. Step-by-step derivation
          1. expm1-define98.2%

            \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{x \cdot n}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)\right)} \]
          2. *-commutative98.2%

            \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{\color{blue}{n \cdot x}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)\right) \]
          3. associate-/r*98.2%

            \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \color{blue}{\frac{\frac{-0.5}{n}}{x}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)\right) \]
        8. Simplified98.2%

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

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

      Alternative 3: 87.4% accurate, 0.2× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;x \leq 7.2:\\ \;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{\frac{0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right)}{n} + 0.5 \cdot \left({\left(x \cdot \left(x \cdot \left(x \cdot \left(0.3333333333333333 + x \cdot -0.25\right) - 0.5\right) + 1\right)\right)}^{2} - {\log x}^{2}\right)}{n}\right) - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left(t\_0, \frac{\frac{-0.5}{n}}{x}, \frac{t\_0}{n}\right)}{x}\right)\right)\\ \end{array} \end{array} \]
      (FPCore (x n)
       :precision binary64
       (let* ((t_0 (pow x (/ 1.0 n))))
         (if (<= x 7.2)
           (/
            (-
             (+
              (log1p x)
              (/
               (+
                (/
                 (* 0.16666666666666666 (- (pow (log1p x) 3.0) (pow (log x) 3.0)))
                 n)
                (*
                 0.5
                 (-
                  (pow
                   (*
                    x
                    (+ (* x (- (* x (+ 0.3333333333333333 (* x -0.25))) 0.5)) 1.0))
                   2.0)
                  (pow (log x) 2.0))))
               n))
             (log x))
            n)
           (expm1 (log1p (/ (fma t_0 (/ (/ -0.5 n) x) (/ t_0 n)) x))))))
      double code(double x, double n) {
      	double t_0 = pow(x, (1.0 / n));
      	double tmp;
      	if (x <= 7.2) {
      		tmp = ((log1p(x) + ((((0.16666666666666666 * (pow(log1p(x), 3.0) - pow(log(x), 3.0))) / n) + (0.5 * (pow((x * ((x * ((x * (0.3333333333333333 + (x * -0.25))) - 0.5)) + 1.0)), 2.0) - pow(log(x), 2.0)))) / n)) - log(x)) / n;
      	} else {
      		tmp = expm1(log1p((fma(t_0, ((-0.5 / n) / x), (t_0 / n)) / x)));
      	}
      	return tmp;
      }
      
      function code(x, n)
      	t_0 = x ^ Float64(1.0 / n)
      	tmp = 0.0
      	if (x <= 7.2)
      		tmp = Float64(Float64(Float64(log1p(x) + Float64(Float64(Float64(Float64(0.16666666666666666 * Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0))) / n) + Float64(0.5 * Float64((Float64(x * Float64(Float64(x * Float64(Float64(x * Float64(0.3333333333333333 + Float64(x * -0.25))) - 0.5)) + 1.0)) ^ 2.0) - (log(x) ^ 2.0)))) / n)) - log(x)) / n);
      	else
      		tmp = expm1(log1p(Float64(fma(t_0, Float64(Float64(-0.5 / n) / x), Float64(t_0 / n)) / x)));
      	end
      	return tmp
      end
      
      code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 7.2], N[(N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(N[(N[(0.16666666666666666 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(0.5 * N[(N[Power[N[(x * N[(N[(x * N[(N[(x * N[(0.3333333333333333 + N[(x * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(Exp[N[Log[1 + N[(N[(t$95$0 * N[(N[(-0.5 / n), $MachinePrecision] / x), $MachinePrecision] + N[(t$95$0 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := {x}^{\left(\frac{1}{n}\right)}\\
      \mathbf{if}\;x \leq 7.2:\\
      \;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{\frac{0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right)}{n} + 0.5 \cdot \left({\left(x \cdot \left(x \cdot \left(x \cdot \left(0.3333333333333333 + x \cdot -0.25\right) - 0.5\right) + 1\right)\right)}^{2} - {\log x}^{2}\right)}{n}\right) - \log x}{n}\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left(t\_0, \frac{\frac{-0.5}{n}}{x}, \frac{t\_0}{n}\right)}{x}\right)\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if x < 7.20000000000000018

        1. Initial program 43.4%

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

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

          \[\leadsto \color{blue}{\frac{\log x - \left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + \frac{0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right)}{n}}{n}\right)}{-n}} \]
        5. Taylor expanded in x around 0 79.7%

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

        if 7.20000000000000018 < x

        1. Initial program 62.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 81.9%

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

            \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}} \]
          2. Taylor expanded in n around inf 98.2%

            \[\leadsto \frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \color{blue}{\frac{-0.5}{n \cdot x}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x} \]
          3. Step-by-step derivation
            1. *-commutative98.2%

              \[\leadsto \frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{\color{blue}{x \cdot n}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x} \]
          4. Simplified98.2%

            \[\leadsto \frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \color{blue}{\frac{-0.5}{x \cdot n}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x} \]
          5. Step-by-step derivation
            1. expm1-log1p-u98.2%

              \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{x \cdot n}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)\right)} \]
            2. expm1-undefine63.0%

              \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{x \cdot n}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)} - 1} \]
          6. Applied egg-rr63.0%

            \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{x \cdot n}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)} - 1} \]
          7. Step-by-step derivation
            1. expm1-define98.2%

              \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{x \cdot n}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)\right)} \]
            2. *-commutative98.2%

              \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{\color{blue}{n \cdot x}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)\right) \]
            3. associate-/r*98.2%

              \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \color{blue}{\frac{\frac{-0.5}{n}}{x}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)\right) \]
          8. Simplified98.2%

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

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

        Alternative 4: 86.9% accurate, 0.4× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;x \leq 1:\\ \;\;\;\;\frac{\frac{-0.16666666666666666 \cdot \frac{{\log x}^{3}}{n} + {\log x}^{2} \cdot -0.5}{n} - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left(t\_0, \frac{\frac{-0.5}{n}}{x}, \frac{t\_0}{n}\right)}{x}\right)\right)\\ \end{array} \end{array} \]
        (FPCore (x n)
         :precision binary64
         (let* ((t_0 (pow x (/ 1.0 n))))
           (if (<= x 1.0)
             (/
              (-
               (/
                (+
                 (* -0.16666666666666666 (/ (pow (log x) 3.0) n))
                 (* (pow (log x) 2.0) -0.5))
                n)
               (log x))
              n)
             (expm1 (log1p (/ (fma t_0 (/ (/ -0.5 n) x) (/ t_0 n)) x))))))
        double code(double x, double n) {
        	double t_0 = pow(x, (1.0 / n));
        	double tmp;
        	if (x <= 1.0) {
        		tmp = ((((-0.16666666666666666 * (pow(log(x), 3.0) / n)) + (pow(log(x), 2.0) * -0.5)) / n) - log(x)) / n;
        	} else {
        		tmp = expm1(log1p((fma(t_0, ((-0.5 / n) / x), (t_0 / n)) / x)));
        	}
        	return tmp;
        }
        
        function code(x, n)
        	t_0 = x ^ Float64(1.0 / n)
        	tmp = 0.0
        	if (x <= 1.0)
        		tmp = Float64(Float64(Float64(Float64(Float64(-0.16666666666666666 * Float64((log(x) ^ 3.0) / n)) + Float64((log(x) ^ 2.0) * -0.5)) / n) - log(x)) / n);
        	else
        		tmp = expm1(log1p(Float64(fma(t_0, Float64(Float64(-0.5 / n) / x), Float64(t_0 / n)) / x)));
        	end
        	return tmp
        end
        
        code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1.0], N[(N[(N[(N[(N[(-0.16666666666666666 * N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(Exp[N[Log[1 + N[(N[(t$95$0 * N[(N[(-0.5 / n), $MachinePrecision] / x), $MachinePrecision] + N[(t$95$0 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := {x}^{\left(\frac{1}{n}\right)}\\
        \mathbf{if}\;x \leq 1:\\
        \;\;\;\;\frac{\frac{-0.16666666666666666 \cdot \frac{{\log x}^{3}}{n} + {\log x}^{2} \cdot -0.5}{n} - \log x}{n}\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left(t\_0, \frac{\frac{-0.5}{n}}{x}, \frac{t\_0}{n}\right)}{x}\right)\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if x < 1

          1. Initial program 43.4%

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

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

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

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

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

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

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

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

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

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

          if 1 < x

          1. Initial program 62.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 81.9%

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

              \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}} \]
            2. Taylor expanded in n around inf 98.2%

              \[\leadsto \frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \color{blue}{\frac{-0.5}{n \cdot x}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x} \]
            3. Step-by-step derivation
              1. *-commutative98.2%

                \[\leadsto \frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{\color{blue}{x \cdot n}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x} \]
            4. Simplified98.2%

              \[\leadsto \frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \color{blue}{\frac{-0.5}{x \cdot n}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x} \]
            5. Step-by-step derivation
              1. expm1-log1p-u98.2%

                \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{x \cdot n}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)\right)} \]
              2. expm1-undefine63.0%

                \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{x \cdot n}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)} - 1} \]
            6. Applied egg-rr63.0%

              \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{x \cdot n}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)} - 1} \]
            7. Step-by-step derivation
              1. expm1-define98.2%

                \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{x \cdot n}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)\right)} \]
              2. *-commutative98.2%

                \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{-0.5}{\color{blue}{n \cdot x}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)\right) \]
              3. associate-/r*98.2%

                \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \color{blue}{\frac{\frac{-0.5}{n}}{x}}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}\right)\right) \]
            8. Simplified98.2%

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

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

          Alternative 5: 85.1% accurate, 0.7× speedup?

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

            1. Initial program 71.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            1. Initial program 33.8%

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

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

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

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

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

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

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

              \[\leadsto \frac{\color{blue}{2 \cdot \log \left(\sqrt{x}\right)} - \left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + \frac{0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right)}{n}}{n}\right)}{-n} \]
            9. Taylor expanded in n around inf 79.7%

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

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

            1. Initial program 58.9%

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

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

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

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

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

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

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

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

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

          Alternative 6: 85.1% accurate, 0.7× speedup?

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

            1. Initial program 71.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            1. Initial program 33.8%

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

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

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

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

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

            1. Initial program 58.9%

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

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

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

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

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

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

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

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

          Alternative 7: 81.9% accurate, 0.9× speedup?

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

            1. Initial program 71.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            1. Initial program 33.8%

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

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

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

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

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

            1. Initial program 58.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 82.4%

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

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

          Alternative 8: 81.9% accurate, 0.9× speedup?

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

            1. Initial program 71.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            1. Initial program 33.8%

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

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

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

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

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

            1. Initial program 83.6%

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

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

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

            1. Initial program 30.8%

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

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

                \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}} \]
              2. Taylor expanded in n around inf 0.2%

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

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

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

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

                \[\leadsto \color{blue}{\frac{1 - \frac{0.5}{x}}{x \cdot n}} \]
              5. Step-by-step derivation
                1. add-cbrt-cube0.1%

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

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

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

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

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

            Alternative 9: 81.9% accurate, 0.9× speedup?

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

              1. Initial program 71.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              1. Initial program 33.8%

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

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

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

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

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

              1. Initial program 83.6%

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

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

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

              1. Initial program 30.8%

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

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

                  \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}} \]
                2. Taylor expanded in n around inf 0.2%

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

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

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

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

                  \[\leadsto \color{blue}{\frac{1 - \frac{0.5}{x}}{x \cdot n}} \]
                5. Taylor expanded in x around inf 50.0%

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

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

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

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

              Alternative 10: 70.6% accurate, 1.7× speedup?

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

                1. Initial program 31.4%

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

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

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

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

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

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

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

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

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

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

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

                if 8.200000000000001e-291 < x < 1.4000000000000001e-221

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

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

                if 7.00000000000000035e-16 < x

                1. Initial program 63.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 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. log-rec93.6%

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 8.2 \cdot 10^{-291}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-221}:\\ \;\;\;\;\left(\frac{x}{n} + 1\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-16}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{x \cdot n}\\ \end{array} \]
              5. Add Preprocessing

              Alternative 11: 70.4% accurate, 1.7× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ t_1 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;x \leq 5.5 \cdot 10^{-291}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-222}:\\ \;\;\;\;1 - t\_1\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{-18}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_1}{x \cdot n}\\ \end{array} \end{array} \]
              (FPCore (x n)
               :precision binary64
               (let* ((t_0 (/ (log x) (- n))) (t_1 (pow x (/ 1.0 n))))
                 (if (<= x 5.5e-291)
                   t_0
                   (if (<= x 2.6e-222)
                     (- 1.0 t_1)
                     (if (<= x 1.2e-18) t_0 (/ t_1 (* x n)))))))
              double code(double x, double n) {
              	double t_0 = log(x) / -n;
              	double t_1 = pow(x, (1.0 / n));
              	double tmp;
              	if (x <= 5.5e-291) {
              		tmp = t_0;
              	} else if (x <= 2.6e-222) {
              		tmp = 1.0 - t_1;
              	} else if (x <= 1.2e-18) {
              		tmp = t_0;
              	} else {
              		tmp = t_1 / (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) :: t_1
                  real(8) :: tmp
                  t_0 = log(x) / -n
                  t_1 = x ** (1.0d0 / n)
                  if (x <= 5.5d-291) then
                      tmp = t_0
                  else if (x <= 2.6d-222) then
                      tmp = 1.0d0 - t_1
                  else if (x <= 1.2d-18) then
                      tmp = t_0
                  else
                      tmp = t_1 / (x * n)
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double n) {
              	double t_0 = Math.log(x) / -n;
              	double t_1 = Math.pow(x, (1.0 / n));
              	double tmp;
              	if (x <= 5.5e-291) {
              		tmp = t_0;
              	} else if (x <= 2.6e-222) {
              		tmp = 1.0 - t_1;
              	} else if (x <= 1.2e-18) {
              		tmp = t_0;
              	} else {
              		tmp = t_1 / (x * n);
              	}
              	return tmp;
              }
              
              def code(x, n):
              	t_0 = math.log(x) / -n
              	t_1 = math.pow(x, (1.0 / n))
              	tmp = 0
              	if x <= 5.5e-291:
              		tmp = t_0
              	elif x <= 2.6e-222:
              		tmp = 1.0 - t_1
              	elif x <= 1.2e-18:
              		tmp = t_0
              	else:
              		tmp = t_1 / (x * n)
              	return tmp
              
              function code(x, n)
              	t_0 = Float64(log(x) / Float64(-n))
              	t_1 = x ^ Float64(1.0 / n)
              	tmp = 0.0
              	if (x <= 5.5e-291)
              		tmp = t_0;
              	elseif (x <= 2.6e-222)
              		tmp = Float64(1.0 - t_1);
              	elseif (x <= 1.2e-18)
              		tmp = t_0;
              	else
              		tmp = Float64(t_1 / Float64(x * n));
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, n)
              	t_0 = log(x) / -n;
              	t_1 = x ^ (1.0 / n);
              	tmp = 0.0;
              	if (x <= 5.5e-291)
              		tmp = t_0;
              	elseif (x <= 2.6e-222)
              		tmp = 1.0 - t_1;
              	elseif (x <= 1.2e-18)
              		tmp = t_0;
              	else
              		tmp = t_1 / (x * n);
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 5.5e-291], t$95$0, If[LessEqual[x, 2.6e-222], N[(1.0 - t$95$1), $MachinePrecision], If[LessEqual[x, 1.2e-18], t$95$0, N[(t$95$1 / N[(x * n), $MachinePrecision]), $MachinePrecision]]]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \frac{\log x}{-n}\\
              t_1 := {x}^{\left(\frac{1}{n}\right)}\\
              \mathbf{if}\;x \leq 5.5 \cdot 10^{-291}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;x \leq 2.6 \cdot 10^{-222}:\\
              \;\;\;\;1 - t\_1\\
              
              \mathbf{elif}\;x \leq 1.2 \cdot 10^{-18}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{t\_1}{x \cdot n}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if x < 5.5000000000000002e-291 or 2.5999999999999998e-222 < x < 1.19999999999999997e-18

                1. Initial program 31.4%

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

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

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

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

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

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

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

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

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

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

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

                if 5.5000000000000002e-291 < x < 2.5999999999999998e-222

                1. Initial program 75.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 75.3%

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

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

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

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

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

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

                if 1.19999999999999997e-18 < x

                1. Initial program 63.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 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. log-rec93.6%

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5.5 \cdot 10^{-291}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-222}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{-18}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{x \cdot n}\\ \end{array} \]
              5. Add Preprocessing

              Alternative 12: 59.7% accurate, 1.8× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ \mathbf{if}\;x \leq 7 \cdot 10^{-291}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-222}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.68:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{+218}:\\ \;\;\;\;\frac{\frac{\frac{-0.5}{x} + 1}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.5}{n}}{x \cdot x}\\ \end{array} \end{array} \]
              (FPCore (x n)
               :precision binary64
               (let* ((t_0 (/ (log x) (- n))))
                 (if (<= x 7e-291)
                   t_0
                   (if (<= x 2.6e-222)
                     (- 1.0 (pow x (/ 1.0 n)))
                     (if (<= x 0.68)
                       t_0
                       (if (<= x 2.3e+218)
                         (/ (/ (+ (/ -0.5 x) 1.0) x) n)
                         (/ (/ -0.5 n) (* x x))))))))
              double code(double x, double n) {
              	double t_0 = log(x) / -n;
              	double tmp;
              	if (x <= 7e-291) {
              		tmp = t_0;
              	} else if (x <= 2.6e-222) {
              		tmp = 1.0 - pow(x, (1.0 / n));
              	} else if (x <= 0.68) {
              		tmp = t_0;
              	} else if (x <= 2.3e+218) {
              		tmp = (((-0.5 / x) + 1.0) / x) / n;
              	} else {
              		tmp = (-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 <= 7d-291) then
                      tmp = t_0
                  else if (x <= 2.6d-222) then
                      tmp = 1.0d0 - (x ** (1.0d0 / n))
                  else if (x <= 0.68d0) then
                      tmp = t_0
                  else if (x <= 2.3d+218) then
                      tmp = ((((-0.5d0) / x) + 1.0d0) / x) / n
                  else
                      tmp = ((-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 <= 7e-291) {
              		tmp = t_0;
              	} else if (x <= 2.6e-222) {
              		tmp = 1.0 - Math.pow(x, (1.0 / n));
              	} else if (x <= 0.68) {
              		tmp = t_0;
              	} else if (x <= 2.3e+218) {
              		tmp = (((-0.5 / x) + 1.0) / x) / n;
              	} else {
              		tmp = (-0.5 / n) / (x * x);
              	}
              	return tmp;
              }
              
              def code(x, n):
              	t_0 = math.log(x) / -n
              	tmp = 0
              	if x <= 7e-291:
              		tmp = t_0
              	elif x <= 2.6e-222:
              		tmp = 1.0 - math.pow(x, (1.0 / n))
              	elif x <= 0.68:
              		tmp = t_0
              	elif x <= 2.3e+218:
              		tmp = (((-0.5 / x) + 1.0) / x) / n
              	else:
              		tmp = (-0.5 / n) / (x * x)
              	return tmp
              
              function code(x, n)
              	t_0 = Float64(log(x) / Float64(-n))
              	tmp = 0.0
              	if (x <= 7e-291)
              		tmp = t_0;
              	elseif (x <= 2.6e-222)
              		tmp = Float64(1.0 - (x ^ Float64(1.0 / n)));
              	elseif (x <= 0.68)
              		tmp = t_0;
              	elseif (x <= 2.3e+218)
              		tmp = Float64(Float64(Float64(Float64(-0.5 / x) + 1.0) / x) / n);
              	else
              		tmp = Float64(Float64(-0.5 / n) / Float64(x * x));
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, n)
              	t_0 = log(x) / -n;
              	tmp = 0.0;
              	if (x <= 7e-291)
              		tmp = t_0;
              	elseif (x <= 2.6e-222)
              		tmp = 1.0 - (x ^ (1.0 / n));
              	elseif (x <= 0.68)
              		tmp = t_0;
              	elseif (x <= 2.3e+218)
              		tmp = (((-0.5 / x) + 1.0) / x) / n;
              	else
              		tmp = (-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, 7e-291], t$95$0, If[LessEqual[x, 2.6e-222], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.68], t$95$0, If[LessEqual[x, 2.3e+218], N[(N[(N[(N[(-0.5 / x), $MachinePrecision] + 1.0), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], N[(N[(-0.5 / n), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]]]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \frac{\log x}{-n}\\
              \mathbf{if}\;x \leq 7 \cdot 10^{-291}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;x \leq 2.6 \cdot 10^{-222}:\\
              \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
              
              \mathbf{elif}\;x \leq 0.68:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;x \leq 2.3 \cdot 10^{+218}:\\
              \;\;\;\;\frac{\frac{\frac{-0.5}{x} + 1}{x}}{n}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{\frac{-0.5}{n}}{x \cdot x}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 4 regimes
              2. if x < 6.99999999999999991e-291 or 2.5999999999999998e-222 < x < 0.680000000000000049

                1. Initial program 35.4%

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

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

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

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

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

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

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

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

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

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

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

                if 6.99999999999999991e-291 < x < 2.5999999999999998e-222

                1. Initial program 75.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 75.3%

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

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

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

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

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

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

                if 0.680000000000000049 < x < 2.3000000000000001e218

                1. Initial program 46.8%

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

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

                    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}} \]
                  2. Taylor expanded in n around inf 67.3%

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

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

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

                      \[\leadsto \frac{1 - \frac{0.5}{x}}{\color{blue}{x \cdot n}} \]
                  4. Simplified67.3%

                    \[\leadsto \color{blue}{\frac{1 - \frac{0.5}{x}}{x \cdot n}} \]
                  5. Taylor expanded in x around inf 68.0%

                    \[\leadsto \color{blue}{\frac{\frac{1}{n} - 0.5 \cdot \frac{1}{n \cdot x}}{x}} \]
                  6. Step-by-step derivation
                    1. cancel-sign-sub-inv68.0%

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

                      \[\leadsto \frac{\frac{1}{n} + \color{blue}{-0.5} \cdot \frac{1}{n \cdot x}}{x} \]
                    3. *-commutative68.0%

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

                      \[\leadsto \frac{\frac{1}{n} + \color{blue}{\frac{-0.5 \cdot 1}{x \cdot n}}}{x} \]
                    5. metadata-eval68.0%

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

                      \[\leadsto \frac{\frac{1}{n} + \color{blue}{\frac{\frac{-0.5}{x}}{n}}}{x} \]
                    7. metadata-eval68.0%

                      \[\leadsto \frac{\frac{1}{n} + \frac{\frac{\color{blue}{-0.5}}{x}}{n}}{x} \]
                    8. distribute-neg-frac68.0%

                      \[\leadsto \frac{\frac{1}{n} + \frac{\color{blue}{-\frac{0.5}{x}}}{n}}{x} \]
                    9. metadata-eval68.0%

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

                      \[\leadsto \frac{\frac{1}{n} + \frac{-\color{blue}{0.5 \cdot \frac{1}{x}}}{n}}{x} \]
                    11. distribute-frac-neg68.0%

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

                      \[\leadsto \frac{\color{blue}{\frac{1}{n} - \frac{0.5 \cdot \frac{1}{x}}{n}}}{x} \]
                    13. div-sub68.0%

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

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

                      \[\leadsto \frac{1 - \color{blue}{\frac{0.5 \cdot 1}{x}}}{n \cdot x} \]
                    16. metadata-eval67.3%

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

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

                      \[\leadsto \color{blue}{\frac{\frac{1 - \frac{0.5}{x}}{x}}{n}} \]
                  7. Simplified68.1%

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

                  if 2.3000000000000001e218 < x

                  1. Initial program 92.6%

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

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

                      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}} \]
                    2. Taylor expanded in n around inf 70.8%

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\frac{\frac{-0.5}{n}}{{x}^{2}}} \]
                    7. Simplified92.6%

                      \[\leadsto \color{blue}{\frac{\frac{-0.5}{n}}{{x}^{2}}} \]
                    8. Step-by-step derivation
                      1. unpow292.6%

                        \[\leadsto \frac{\frac{-0.5}{n}}{\color{blue}{x \cdot x}} \]
                    9. Applied egg-rr92.6%

                      \[\leadsto \frac{\frac{-0.5}{n}}{\color{blue}{x \cdot x}} \]
                  5. Recombined 4 regimes into one program.
                  6. Final simplification68.6%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 7 \cdot 10^{-291}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-222}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.68:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{+218}:\\ \;\;\;\;\frac{\frac{\frac{-0.5}{x} + 1}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.5}{n}}{x \cdot x}\\ \end{array} \]
                  7. Add Preprocessing

                  Alternative 13: 60.0% accurate, 1.9× speedup?

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

                    1. Initial program 43.4%

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

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

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

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

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

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

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

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

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

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

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

                    if 0.680000000000000049 < x < 1.90000000000000006e218

                    1. Initial program 46.8%

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

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

                        \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}} \]
                      2. Taylor expanded in n around inf 67.3%

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

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

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

                          \[\leadsto \frac{1 - \frac{0.5}{x}}{\color{blue}{x \cdot n}} \]
                      4. Simplified67.3%

                        \[\leadsto \color{blue}{\frac{1 - \frac{0.5}{x}}{x \cdot n}} \]
                      5. Taylor expanded in x around inf 68.0%

                        \[\leadsto \color{blue}{\frac{\frac{1}{n} - 0.5 \cdot \frac{1}{n \cdot x}}{x}} \]
                      6. Step-by-step derivation
                        1. cancel-sign-sub-inv68.0%

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

                          \[\leadsto \frac{\frac{1}{n} + \color{blue}{-0.5} \cdot \frac{1}{n \cdot x}}{x} \]
                        3. *-commutative68.0%

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

                          \[\leadsto \frac{\frac{1}{n} + \color{blue}{\frac{-0.5 \cdot 1}{x \cdot n}}}{x} \]
                        5. metadata-eval68.0%

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

                          \[\leadsto \frac{\frac{1}{n} + \color{blue}{\frac{\frac{-0.5}{x}}{n}}}{x} \]
                        7. metadata-eval68.0%

                          \[\leadsto \frac{\frac{1}{n} + \frac{\frac{\color{blue}{-0.5}}{x}}{n}}{x} \]
                        8. distribute-neg-frac68.0%

                          \[\leadsto \frac{\frac{1}{n} + \frac{\color{blue}{-\frac{0.5}{x}}}{n}}{x} \]
                        9. metadata-eval68.0%

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

                          \[\leadsto \frac{\frac{1}{n} + \frac{-\color{blue}{0.5 \cdot \frac{1}{x}}}{n}}{x} \]
                        11. distribute-frac-neg68.0%

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

                          \[\leadsto \frac{\color{blue}{\frac{1}{n} - \frac{0.5 \cdot \frac{1}{x}}{n}}}{x} \]
                        13. div-sub68.0%

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

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

                          \[\leadsto \frac{1 - \color{blue}{\frac{0.5 \cdot 1}{x}}}{n \cdot x} \]
                        16. metadata-eval67.3%

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

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

                          \[\leadsto \color{blue}{\frac{\frac{1 - \frac{0.5}{x}}{x}}{n}} \]
                      7. Simplified68.1%

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

                      if 1.90000000000000006e218 < x

                      1. Initial program 92.6%

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

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

                          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}} \]
                        2. Taylor expanded in n around inf 70.8%

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

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

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

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

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

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

                            \[\leadsto \color{blue}{\frac{\frac{-0.5}{n}}{{x}^{2}}} \]
                        7. Simplified92.6%

                          \[\leadsto \color{blue}{\frac{\frac{-0.5}{n}}{{x}^{2}}} \]
                        8. Step-by-step derivation
                          1. unpow292.6%

                            \[\leadsto \frac{\frac{-0.5}{n}}{\color{blue}{x \cdot x}} \]
                        9. Applied egg-rr92.6%

                          \[\leadsto \frac{\frac{-0.5}{n}}{\color{blue}{x \cdot x}} \]
                      5. Recombined 3 regimes into one program.
                      6. Final simplification63.9%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.68:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{+218}:\\ \;\;\;\;\frac{\frac{\frac{-0.5}{x} + 1}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.5}{n}}{x \cdot x}\\ \end{array} \]
                      7. Add Preprocessing

                      Alternative 14: 43.9% accurate, 17.6× speedup?

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

                        1. Initial program 44.6%

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

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

                            \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}} \]
                          2. Taylor expanded in n around inf 24.6%

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

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

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

                              \[\leadsto \frac{1 - \frac{0.5}{x}}{\color{blue}{x \cdot n}} \]
                          4. Simplified24.6%

                            \[\leadsto \color{blue}{\frac{1 - \frac{0.5}{x}}{x \cdot n}} \]
                          5. Taylor expanded in x around inf 38.6%

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

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

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

                          if 2.00000000000000017e218 < x

                          1. Initial program 92.6%

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

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

                              \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}} \]
                            2. Taylor expanded in n around inf 70.8%

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

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

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

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

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

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

                                \[\leadsto \color{blue}{\frac{\frac{-0.5}{n}}{{x}^{2}}} \]
                            7. Simplified92.6%

                              \[\leadsto \color{blue}{\frac{\frac{-0.5}{n}}{{x}^{2}}} \]
                            8. Step-by-step derivation
                              1. unpow292.6%

                                \[\leadsto \frac{\frac{-0.5}{n}}{\color{blue}{x \cdot x}} \]
                            9. Applied egg-rr92.6%

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

                          Alternative 15: 40.6% accurate, 42.2× speedup?

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

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

                              \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}} \]
                            2. Taylor expanded in n around inf 31.7%

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

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

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

                                \[\leadsto \frac{1 - \frac{0.5}{x}}{\color{blue}{x \cdot n}} \]
                            4. Simplified31.7%

                              \[\leadsto \color{blue}{\frac{1 - \frac{0.5}{x}}{x \cdot n}} \]
                            5. Taylor expanded in x around inf 43.5%

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

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

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

                            Alternative 16: 40.2% accurate, 42.2× speedup?

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

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

                                \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({x}^{\left(\frac{1}{n}\right)}, \frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x}, \frac{{x}^{\left(\frac{1}{n}\right)}}{n}\right)}{x}} \]
                              2. Taylor expanded in n around inf 31.7%

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

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

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

                                  \[\leadsto \frac{1 - \frac{0.5}{x}}{\color{blue}{x \cdot n}} \]
                              4. Simplified31.7%

                                \[\leadsto \color{blue}{\frac{1 - \frac{0.5}{x}}{x \cdot n}} \]
                              5. Taylor expanded in x around inf 43.5%

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

                              Reproduce

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