2nthrt (problem 3.4.6)

Percentage Accurate: 53.3% → 85.2%
Time: 20.7s
Alternatives: 15
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 15 alternatives:

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

Initial Program: 53.3% accurate, 1.0× speedup?

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

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

Alternative 1: 85.2% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \log \left(1 + x\right)\\ t_1 := e^{\frac{\log x}{n}}\\ t_2 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-98}:\\ \;\;\;\;\frac{\frac{t_2}{n}}{x}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-46}:\\ \;\;\;\;\left(0.5 \cdot \frac{{t_0}^{2}}{{n}^{2}} + \left(0.041666666666666664 \cdot \frac{{t_0}^{4}}{{n}^{4}} + \left(\frac{t_0 - \log x}{n} - \frac{-0.16666666666666666 \cdot {t_0}^{3} - -0.16666666666666666 \cdot {\log x}^{3}}{{n}^{3}}\right)\right)\right) - \left(0.5 \cdot \frac{{\log x}^{2}}{{n}^{2}} + 0.041666666666666664 \cdot \frac{{\log x}^{4}}{{n}^{4}}\right)\\ \mathbf{elif}\;\frac{1}{n} \leq 0.5:\\ \;\;\;\;\frac{t_1 \cdot \left(\frac{0.5}{n \cdot n} + \frac{-0.5}{n}\right)}{x \cdot x} + \left(\left(\frac{t_1}{n \cdot x} + \frac{t_1}{\frac{{x}^{3}}{\frac{0.3333333333333333}{n} + \left(\frac{0.16666666666666666}{{n}^{3}} + \frac{\frac{-0.5}{n}}{n}\right)}}\right) + \frac{\left(\frac{0.041666666666666664}{{n}^{4}} + \frac{0.4583333333333333}{n \cdot n}\right) - \left(\frac{0.25}{{n}^{3}} + \frac{0.25}{n}\right)}{\frac{{x}^{4}}{t_1}}\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{x}{n}} - t_2\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (log (+ 1.0 x)))
        (t_1 (exp (/ (log x) n)))
        (t_2 (pow x (/ 1.0 n))))
   (if (<= (/ 1.0 n) -2e-98)
     (/ (/ t_2 n) x)
     (if (<= (/ 1.0 n) 5e-46)
       (-
        (+
         (* 0.5 (/ (pow t_0 2.0) (pow n 2.0)))
         (+
          (* 0.041666666666666664 (/ (pow t_0 4.0) (pow n 4.0)))
          (-
           (/ (- t_0 (log x)) n)
           (/
            (-
             (* -0.16666666666666666 (pow t_0 3.0))
             (* -0.16666666666666666 (pow (log x) 3.0)))
            (pow n 3.0)))))
        (+
         (* 0.5 (/ (pow (log x) 2.0) (pow n 2.0)))
         (* 0.041666666666666664 (/ (pow (log x) 4.0) (pow n 4.0)))))
       (if (<= (/ 1.0 n) 0.5)
         (+
          (/ (* t_1 (+ (/ 0.5 (* n n)) (/ -0.5 n))) (* x x))
          (+
           (+
            (/ t_1 (* n x))
            (/
             t_1
             (/
              (pow x 3.0)
              (+
               (/ 0.3333333333333333 n)
               (+ (/ 0.16666666666666666 (pow n 3.0)) (/ (/ -0.5 n) n))))))
           (/
            (-
             (+
              (/ 0.041666666666666664 (pow n 4.0))
              (/ 0.4583333333333333 (* n n)))
             (+ (/ 0.25 (pow n 3.0)) (/ 0.25 n)))
            (/ (pow x 4.0) t_1))))
         (- (exp (/ x n)) t_2))))))
double code(double x, double n) {
	double t_0 = log((1.0 + x));
	double t_1 = exp((log(x) / n));
	double t_2 = pow(x, (1.0 / n));
	double tmp;
	if ((1.0 / n) <= -2e-98) {
		tmp = (t_2 / n) / x;
	} else if ((1.0 / n) <= 5e-46) {
		tmp = ((0.5 * (pow(t_0, 2.0) / pow(n, 2.0))) + ((0.041666666666666664 * (pow(t_0, 4.0) / pow(n, 4.0))) + (((t_0 - log(x)) / n) - (((-0.16666666666666666 * pow(t_0, 3.0)) - (-0.16666666666666666 * pow(log(x), 3.0))) / pow(n, 3.0))))) - ((0.5 * (pow(log(x), 2.0) / pow(n, 2.0))) + (0.041666666666666664 * (pow(log(x), 4.0) / pow(n, 4.0))));
	} else if ((1.0 / n) <= 0.5) {
		tmp = ((t_1 * ((0.5 / (n * n)) + (-0.5 / n))) / (x * x)) + (((t_1 / (n * x)) + (t_1 / (pow(x, 3.0) / ((0.3333333333333333 / n) + ((0.16666666666666666 / pow(n, 3.0)) + ((-0.5 / n) / n)))))) + ((((0.041666666666666664 / pow(n, 4.0)) + (0.4583333333333333 / (n * n))) - ((0.25 / pow(n, 3.0)) + (0.25 / n))) / (pow(x, 4.0) / t_1)));
	} else {
		tmp = exp((x / n)) - t_2;
	}
	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) :: t_2
    real(8) :: tmp
    t_0 = log((1.0d0 + x))
    t_1 = exp((log(x) / n))
    t_2 = x ** (1.0d0 / n)
    if ((1.0d0 / n) <= (-2d-98)) then
        tmp = (t_2 / n) / x
    else if ((1.0d0 / n) <= 5d-46) then
        tmp = ((0.5d0 * ((t_0 ** 2.0d0) / (n ** 2.0d0))) + ((0.041666666666666664d0 * ((t_0 ** 4.0d0) / (n ** 4.0d0))) + (((t_0 - log(x)) / n) - ((((-0.16666666666666666d0) * (t_0 ** 3.0d0)) - ((-0.16666666666666666d0) * (log(x) ** 3.0d0))) / (n ** 3.0d0))))) - ((0.5d0 * ((log(x) ** 2.0d0) / (n ** 2.0d0))) + (0.041666666666666664d0 * ((log(x) ** 4.0d0) / (n ** 4.0d0))))
    else if ((1.0d0 / n) <= 0.5d0) then
        tmp = ((t_1 * ((0.5d0 / (n * n)) + ((-0.5d0) / n))) / (x * x)) + (((t_1 / (n * x)) + (t_1 / ((x ** 3.0d0) / ((0.3333333333333333d0 / n) + ((0.16666666666666666d0 / (n ** 3.0d0)) + (((-0.5d0) / n) / n)))))) + ((((0.041666666666666664d0 / (n ** 4.0d0)) + (0.4583333333333333d0 / (n * n))) - ((0.25d0 / (n ** 3.0d0)) + (0.25d0 / n))) / ((x ** 4.0d0) / t_1)))
    else
        tmp = exp((x / n)) - t_2
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double t_0 = Math.log((1.0 + x));
	double t_1 = Math.exp((Math.log(x) / n));
	double t_2 = Math.pow(x, (1.0 / n));
	double tmp;
	if ((1.0 / n) <= -2e-98) {
		tmp = (t_2 / n) / x;
	} else if ((1.0 / n) <= 5e-46) {
		tmp = ((0.5 * (Math.pow(t_0, 2.0) / Math.pow(n, 2.0))) + ((0.041666666666666664 * (Math.pow(t_0, 4.0) / Math.pow(n, 4.0))) + (((t_0 - Math.log(x)) / n) - (((-0.16666666666666666 * Math.pow(t_0, 3.0)) - (-0.16666666666666666 * Math.pow(Math.log(x), 3.0))) / Math.pow(n, 3.0))))) - ((0.5 * (Math.pow(Math.log(x), 2.0) / Math.pow(n, 2.0))) + (0.041666666666666664 * (Math.pow(Math.log(x), 4.0) / Math.pow(n, 4.0))));
	} else if ((1.0 / n) <= 0.5) {
		tmp = ((t_1 * ((0.5 / (n * n)) + (-0.5 / n))) / (x * x)) + (((t_1 / (n * x)) + (t_1 / (Math.pow(x, 3.0) / ((0.3333333333333333 / n) + ((0.16666666666666666 / Math.pow(n, 3.0)) + ((-0.5 / n) / n)))))) + ((((0.041666666666666664 / Math.pow(n, 4.0)) + (0.4583333333333333 / (n * n))) - ((0.25 / Math.pow(n, 3.0)) + (0.25 / n))) / (Math.pow(x, 4.0) / t_1)));
	} else {
		tmp = Math.exp((x / n)) - t_2;
	}
	return tmp;
}
def code(x, n):
	t_0 = math.log((1.0 + x))
	t_1 = math.exp((math.log(x) / n))
	t_2 = math.pow(x, (1.0 / n))
	tmp = 0
	if (1.0 / n) <= -2e-98:
		tmp = (t_2 / n) / x
	elif (1.0 / n) <= 5e-46:
		tmp = ((0.5 * (math.pow(t_0, 2.0) / math.pow(n, 2.0))) + ((0.041666666666666664 * (math.pow(t_0, 4.0) / math.pow(n, 4.0))) + (((t_0 - math.log(x)) / n) - (((-0.16666666666666666 * math.pow(t_0, 3.0)) - (-0.16666666666666666 * math.pow(math.log(x), 3.0))) / math.pow(n, 3.0))))) - ((0.5 * (math.pow(math.log(x), 2.0) / math.pow(n, 2.0))) + (0.041666666666666664 * (math.pow(math.log(x), 4.0) / math.pow(n, 4.0))))
	elif (1.0 / n) <= 0.5:
		tmp = ((t_1 * ((0.5 / (n * n)) + (-0.5 / n))) / (x * x)) + (((t_1 / (n * x)) + (t_1 / (math.pow(x, 3.0) / ((0.3333333333333333 / n) + ((0.16666666666666666 / math.pow(n, 3.0)) + ((-0.5 / n) / n)))))) + ((((0.041666666666666664 / math.pow(n, 4.0)) + (0.4583333333333333 / (n * n))) - ((0.25 / math.pow(n, 3.0)) + (0.25 / n))) / (math.pow(x, 4.0) / t_1)))
	else:
		tmp = math.exp((x / n)) - t_2
	return tmp
function code(x, n)
	t_0 = log(Float64(1.0 + x))
	t_1 = exp(Float64(log(x) / n))
	t_2 = x ^ Float64(1.0 / n)
	tmp = 0.0
	if (Float64(1.0 / n) <= -2e-98)
		tmp = Float64(Float64(t_2 / n) / x);
	elseif (Float64(1.0 / n) <= 5e-46)
		tmp = Float64(Float64(Float64(0.5 * Float64((t_0 ^ 2.0) / (n ^ 2.0))) + Float64(Float64(0.041666666666666664 * Float64((t_0 ^ 4.0) / (n ^ 4.0))) + Float64(Float64(Float64(t_0 - log(x)) / n) - Float64(Float64(Float64(-0.16666666666666666 * (t_0 ^ 3.0)) - Float64(-0.16666666666666666 * (log(x) ^ 3.0))) / (n ^ 3.0))))) - Float64(Float64(0.5 * Float64((log(x) ^ 2.0) / (n ^ 2.0))) + Float64(0.041666666666666664 * Float64((log(x) ^ 4.0) / (n ^ 4.0)))));
	elseif (Float64(1.0 / n) <= 0.5)
		tmp = Float64(Float64(Float64(t_1 * Float64(Float64(0.5 / Float64(n * n)) + Float64(-0.5 / n))) / Float64(x * x)) + Float64(Float64(Float64(t_1 / Float64(n * x)) + Float64(t_1 / Float64((x ^ 3.0) / Float64(Float64(0.3333333333333333 / n) + Float64(Float64(0.16666666666666666 / (n ^ 3.0)) + Float64(Float64(-0.5 / n) / n)))))) + Float64(Float64(Float64(Float64(0.041666666666666664 / (n ^ 4.0)) + Float64(0.4583333333333333 / Float64(n * n))) - Float64(Float64(0.25 / (n ^ 3.0)) + Float64(0.25 / n))) / Float64((x ^ 4.0) / t_1))));
	else
		tmp = Float64(exp(Float64(x / n)) - t_2);
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = log((1.0 + x));
	t_1 = exp((log(x) / n));
	t_2 = x ^ (1.0 / n);
	tmp = 0.0;
	if ((1.0 / n) <= -2e-98)
		tmp = (t_2 / n) / x;
	elseif ((1.0 / n) <= 5e-46)
		tmp = ((0.5 * ((t_0 ^ 2.0) / (n ^ 2.0))) + ((0.041666666666666664 * ((t_0 ^ 4.0) / (n ^ 4.0))) + (((t_0 - log(x)) / n) - (((-0.16666666666666666 * (t_0 ^ 3.0)) - (-0.16666666666666666 * (log(x) ^ 3.0))) / (n ^ 3.0))))) - ((0.5 * ((log(x) ^ 2.0) / (n ^ 2.0))) + (0.041666666666666664 * ((log(x) ^ 4.0) / (n ^ 4.0))));
	elseif ((1.0 / n) <= 0.5)
		tmp = ((t_1 * ((0.5 / (n * n)) + (-0.5 / n))) / (x * x)) + (((t_1 / (n * x)) + (t_1 / ((x ^ 3.0) / ((0.3333333333333333 / n) + ((0.16666666666666666 / (n ^ 3.0)) + ((-0.5 / n) / n)))))) + ((((0.041666666666666664 / (n ^ 4.0)) + (0.4583333333333333 / (n * n))) - ((0.25 / (n ^ 3.0)) + (0.25 / n))) / ((x ^ 4.0) / t_1)));
	else
		tmp = exp((x / n)) - t_2;
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[Log[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-98], N[(N[(t$95$2 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-46], N[(N[(N[(0.5 * N[(N[Power[t$95$0, 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.041666666666666664 * N[(N[Power[t$95$0, 4.0], $MachinePrecision] / N[Power[n, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$0 - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[(N[(N[(-0.16666666666666666 * N[Power[t$95$0, 3.0], $MachinePrecision]), $MachinePrecision] - N[(-0.16666666666666666 * N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(0.5 * N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.041666666666666664 * N[(N[Power[N[Log[x], $MachinePrecision], 4.0], $MachinePrecision] / N[Power[n, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.5], N[(N[(N[(t$95$1 * N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 / N[(N[Power[x, 3.0], $MachinePrecision] / N[(N[(0.3333333333333333 / n), $MachinePrecision] + N[(N[(0.16666666666666666 / N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 / n), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(0.041666666666666664 / N[Power[n, 4.0], $MachinePrecision]), $MachinePrecision] + N[(0.4583333333333333 / N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(0.25 / N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision] + N[(0.25 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x, 4.0], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$2), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \log \left(1 + x\right)\\
t_1 := e^{\frac{\log x}{n}}\\
t_2 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-98}:\\
\;\;\;\;\frac{\frac{t_2}{n}}{x}\\

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-46}:\\
\;\;\;\;\left(0.5 \cdot \frac{{t_0}^{2}}{{n}^{2}} + \left(0.041666666666666664 \cdot \frac{{t_0}^{4}}{{n}^{4}} + \left(\frac{t_0 - \log x}{n} - \frac{-0.16666666666666666 \cdot {t_0}^{3} - -0.16666666666666666 \cdot {\log x}^{3}}{{n}^{3}}\right)\right)\right) - \left(0.5 \cdot \frac{{\log x}^{2}}{{n}^{2}} + 0.041666666666666664 \cdot \frac{{\log x}^{4}}{{n}^{4}}\right)\\

\mathbf{elif}\;\frac{1}{n} \leq 0.5:\\
\;\;\;\;\frac{t_1 \cdot \left(\frac{0.5}{n \cdot n} + \frac{-0.5}{n}\right)}{x \cdot x} + \left(\left(\frac{t_1}{n \cdot x} + \frac{t_1}{\frac{{x}^{3}}{\frac{0.3333333333333333}{n} + \left(\frac{0.16666666666666666}{{n}^{3}} + \frac{\frac{-0.5}{n}}{n}\right)}}\right) + \frac{\left(\frac{0.041666666666666664}{{n}^{4}} + \frac{0.4583333333333333}{n \cdot n}\right) - \left(\frac{0.25}{{n}^{3}} + \frac{0.25}{n}\right)}{\frac{{x}^{4}}{t_1}}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 1 n) < -1.99999999999999988e-98

    1. Initial program 77.4%

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

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

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

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

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1}}{1}\right)}} \]
      7. metadata-eval77.4%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{\frac{2}{2}}}\right)} \]
      8. associate-/l*77.4%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1} \cdot 2}{2}\right)}} \]
      9. *-commutative77.4%

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{1}}\right)} \]
      13. /-rgt-identity77.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
    8. Step-by-step derivation
      1. add-exp-log35.4%

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

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

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

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

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

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

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

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

    if -1.99999999999999988e-98 < (/.f64 1 n) < 4.99999999999999992e-46

    1. Initial program 33.0%

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

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

    if 4.99999999999999992e-46 < (/.f64 1 n) < 0.5

    1. Initial program 11.9%

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

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

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

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

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1}}{1}\right)}} \]
      7. metadata-eval11.4%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{\frac{2}{2}}}\right)} \]
      8. associate-/l*11.4%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1} \cdot 2}{2}\right)}} \]
      9. *-commutative11.4%

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{1}}\right)} \]
      13. /-rgt-identity11.4%

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

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

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

      \[\leadsto \color{blue}{\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}^{2}} + \left(\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \cdot \left(\left(0.3333333333333333 \cdot \frac{1}{n} + 0.16666666666666666 \cdot \frac{1}{{n}^{3}}\right) - 0.5 \cdot \frac{1}{{n}^{2}}\right)}{{x}^{3}} + \left(\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x} + \frac{\left(\left(0.041666666666666664 \cdot \frac{1}{{n}^{4}} + 0.4583333333333333 \cdot \frac{1}{{n}^{2}}\right) - \left(0.25 \cdot \frac{1}{{n}^{3}} + 0.25 \cdot \frac{1}{n}\right)\right) \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{{x}^{4}}\right)\right)} \]
    6. Simplified78.6%

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}} \cdot \left(\frac{0.5}{n \cdot n} + \frac{-0.5}{n}\right)}{x \cdot x} + \left(\left(\frac{e^{\frac{\log x}{n}}}{x \cdot n} + \frac{e^{\frac{\log x}{n}}}{\frac{{x}^{3}}{\frac{0.3333333333333333}{n} + \left(\frac{0.16666666666666666}{{n}^{3}} + \frac{\frac{-0.5}{n}}{n}\right)}}\right) + \frac{\left(\frac{0.041666666666666664}{{n}^{4}} + \frac{0.4583333333333333}{n \cdot n}\right) - \left(\frac{0.25}{{n}^{3}} + \frac{0.25}{n}\right)}{\frac{{x}^{4}}{e^{\frac{\log x}{n}}}}\right)} \]

    if 0.5 < (/.f64 1 n)

    1. Initial program 47.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-98}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-46}:\\ \;\;\;\;\left(0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{{n}^{2}} + \left(0.041666666666666664 \cdot \frac{{\log \left(1 + x\right)}^{4}}{{n}^{4}} + \left(\frac{\log \left(1 + x\right) - \log x}{n} - \frac{-0.16666666666666666 \cdot {\log \left(1 + x\right)}^{3} - -0.16666666666666666 \cdot {\log x}^{3}}{{n}^{3}}\right)\right)\right) - \left(0.5 \cdot \frac{{\log x}^{2}}{{n}^{2}} + 0.041666666666666664 \cdot \frac{{\log x}^{4}}{{n}^{4}}\right)\\ \mathbf{elif}\;\frac{1}{n} \leq 0.5:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}} \cdot \left(\frac{0.5}{n \cdot n} + \frac{-0.5}{n}\right)}{x \cdot x} + \left(\left(\frac{e^{\frac{\log x}{n}}}{n \cdot x} + \frac{e^{\frac{\log x}{n}}}{\frac{{x}^{3}}{\frac{0.3333333333333333}{n} + \left(\frac{0.16666666666666666}{{n}^{3}} + \frac{\frac{-0.5}{n}}{n}\right)}}\right) + \frac{\left(\frac{0.041666666666666664}{{n}^{4}} + \frac{0.4583333333333333}{n \cdot n}\right) - \left(\frac{0.25}{{n}^{3}} + \frac{0.25}{n}\right)}{\frac{{x}^{4}}{e^{\frac{\log x}{n}}}}\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \end{array} \]

Alternative 2: 85.2% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := e^{\frac{\log x}{n}}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-98}:\\
\;\;\;\;\frac{\frac{t_1}{n}}{x}\\

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

\mathbf{elif}\;\frac{1}{n} \leq 0.5:\\
\;\;\;\;\frac{t_0 \cdot \left(\frac{0.5}{n \cdot n} + \frac{-0.5}{n}\right)}{x \cdot x} + \left(\left(\frac{t_0}{n \cdot x} + \frac{t_0}{\frac{{x}^{3}}{\frac{0.3333333333333333}{n} + \left(\frac{0.16666666666666666}{{n}^{3}} + \frac{\frac{-0.5}{n}}{n}\right)}}\right) + \frac{\left(\frac{0.041666666666666664}{{n}^{4}} + \frac{0.4583333333333333}{n \cdot n}\right) - \left(\frac{0.25}{{n}^{3}} + \frac{0.25}{n}\right)}{\frac{{x}^{4}}{t_0}}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 1 n) < -1.99999999999999988e-98

    1. Initial program 77.4%

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

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

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

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

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1}}{1}\right)}} \]
      7. metadata-eval77.4%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{\frac{2}{2}}}\right)} \]
      8. associate-/l*77.4%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1} \cdot 2}{2}\right)}} \]
      9. *-commutative77.4%

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{1}}\right)} \]
      13. /-rgt-identity77.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
    8. Step-by-step derivation
      1. add-exp-log35.4%

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

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

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

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

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

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

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

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

    if -1.99999999999999988e-98 < (/.f64 1 n) < 4.99999999999999992e-46

    1. Initial program 33.0%

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

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

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

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

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

    if 4.99999999999999992e-46 < (/.f64 1 n) < 0.5

    1. Initial program 11.9%

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

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

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

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

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1}}{1}\right)}} \]
      7. metadata-eval11.4%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{\frac{2}{2}}}\right)} \]
      8. associate-/l*11.4%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1} \cdot 2}{2}\right)}} \]
      9. *-commutative11.4%

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{1}}\right)} \]
      13. /-rgt-identity11.4%

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

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

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

      \[\leadsto \color{blue}{\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}^{2}} + \left(\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \cdot \left(\left(0.3333333333333333 \cdot \frac{1}{n} + 0.16666666666666666 \cdot \frac{1}{{n}^{3}}\right) - 0.5 \cdot \frac{1}{{n}^{2}}\right)}{{x}^{3}} + \left(\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x} + \frac{\left(\left(0.041666666666666664 \cdot \frac{1}{{n}^{4}} + 0.4583333333333333 \cdot \frac{1}{{n}^{2}}\right) - \left(0.25 \cdot \frac{1}{{n}^{3}} + 0.25 \cdot \frac{1}{n}\right)\right) \cdot e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{{x}^{4}}\right)\right)} \]
    6. Simplified78.6%

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}} \cdot \left(\frac{0.5}{n \cdot n} + \frac{-0.5}{n}\right)}{x \cdot x} + \left(\left(\frac{e^{\frac{\log x}{n}}}{x \cdot n} + \frac{e^{\frac{\log x}{n}}}{\frac{{x}^{3}}{\frac{0.3333333333333333}{n} + \left(\frac{0.16666666666666666}{{n}^{3}} + \frac{\frac{-0.5}{n}}{n}\right)}}\right) + \frac{\left(\frac{0.041666666666666664}{{n}^{4}} + \frac{0.4583333333333333}{n \cdot n}\right) - \left(\frac{0.25}{{n}^{3}} + \frac{0.25}{n}\right)}{\frac{{x}^{4}}{e^{\frac{\log x}{n}}}}\right)} \]

    if 0.5 < (/.f64 1 n)

    1. Initial program 47.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-98}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-46}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\right) + -0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 0.5:\\ \;\;\;\;\frac{e^{\frac{\log x}{n}} \cdot \left(\frac{0.5}{n \cdot n} + \frac{-0.5}{n}\right)}{x \cdot x} + \left(\left(\frac{e^{\frac{\log x}{n}}}{n \cdot x} + \frac{e^{\frac{\log x}{n}}}{\frac{{x}^{3}}{\frac{0.3333333333333333}{n} + \left(\frac{0.16666666666666666}{{n}^{3}} + \frac{\frac{-0.5}{n}}{n}\right)}}\right) + \frac{\left(\frac{0.041666666666666664}{{n}^{4}} + \frac{0.4583333333333333}{n \cdot n}\right) - \left(\frac{0.25}{{n}^{3}} + \frac{0.25}{n}\right)}{\frac{{x}^{4}}{e^{\frac{\log x}{n}}}}\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \end{array} \]

Alternative 3: 85.3% accurate, 0.3× speedup?

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

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

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

\mathbf{elif}\;\frac{1}{n} \leq 0.5:\\
\;\;\;\;\frac{t_0}{n \cdot x} + \frac{\frac{0.3333333333333333}{{x}^{3}} - \frac{0.5}{x \cdot x}}{n}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 1 n) < -1.99999999999999988e-98

    1. Initial program 77.4%

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

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

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

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

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1}}{1}\right)}} \]
      7. metadata-eval77.4%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{\frac{2}{2}}}\right)} \]
      8. associate-/l*77.4%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1} \cdot 2}{2}\right)}} \]
      9. *-commutative77.4%

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{1}}\right)} \]
      13. /-rgt-identity77.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
    8. Step-by-step derivation
      1. add-exp-log35.4%

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

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

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

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

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

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

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

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

    if -1.99999999999999988e-98 < (/.f64 1 n) < 4.99999999999999992e-46

    1. Initial program 33.0%

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

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

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

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

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

    if 4.99999999999999992e-46 < (/.f64 1 n) < 0.5

    1. Initial program 11.9%

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

      \[\leadsto \color{blue}{\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}^{2}} + \left(\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \cdot \left(\left(0.3333333333333333 \cdot \frac{1}{n} + 0.16666666666666666 \cdot \frac{1}{{n}^{3}}\right) - 0.5 \cdot \frac{1}{{n}^{2}}\right)}{{x}^{3}} + \frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}\right)} \]
    3. Simplified77.7%

      \[\leadsto \color{blue}{\frac{{x}^{\left(\frac{1}{n}\right)}}{x \cdot n} + \left(\frac{{x}^{\left(\frac{1}{n}\right)}}{x} \cdot \frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x} + \frac{\frac{0.3333333333333333}{n} + \left(\frac{0.16666666666666666}{{n}^{3}} + {n}^{-2} \cdot -0.5\right)}{\frac{{x}^{3}}{{x}^{\left(\frac{1}{n}\right)}}}\right)} \]
    4. Taylor expanded in n around inf 77.7%

      \[\leadsto \frac{{x}^{\left(\frac{1}{n}\right)}}{x \cdot n} + \color{blue}{\frac{0.3333333333333333 \cdot \frac{1}{{x}^{3}} - 0.5 \cdot \frac{1}{{x}^{2}}}{n}} \]
    5. Step-by-step derivation
      1. associate-*r/77.7%

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

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

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

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

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

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

    if 0.5 < (/.f64 1 n)

    1. Initial program 47.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-98}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-46}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\right) + -0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\\ \mathbf{elif}\;\frac{1}{n} \leq 0.5:\\ \;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x} + \frac{\frac{0.3333333333333333}{{x}^{3}} - \frac{0.5}{x \cdot x}}{n}\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \end{array} \]

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

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

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

\mathbf{elif}\;\frac{1}{n} \leq 0.5:\\
\;\;\;\;\frac{t_0}{n \cdot x} + \frac{\frac{0.3333333333333333}{{x}^{3}} - \frac{0.5}{x \cdot x}}{n}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 1 n) < -1.99999999999999988e-98

    1. Initial program 77.4%

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

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

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

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

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1}}{1}\right)}} \]
      7. metadata-eval77.4%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{\frac{2}{2}}}\right)} \]
      8. associate-/l*77.4%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1} \cdot 2}{2}\right)}} \]
      9. *-commutative77.4%

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{1}}\right)} \]
      13. /-rgt-identity77.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
    8. Step-by-step derivation
      1. add-exp-log35.4%

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

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

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

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

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

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

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

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

    if -1.99999999999999988e-98 < (/.f64 1 n) < 4.99999999999999992e-46

    1. Initial program 33.0%

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

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

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

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

    if 4.99999999999999992e-46 < (/.f64 1 n) < 0.5

    1. Initial program 11.9%

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

      \[\leadsto \color{blue}{\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}^{2}} + \left(\frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}} \cdot \left(\left(0.3333333333333333 \cdot \frac{1}{n} + 0.16666666666666666 \cdot \frac{1}{{n}^{3}}\right) - 0.5 \cdot \frac{1}{{n}^{2}}\right)}{{x}^{3}} + \frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}\right)} \]
    3. Simplified77.7%

      \[\leadsto \color{blue}{\frac{{x}^{\left(\frac{1}{n}\right)}}{x \cdot n} + \left(\frac{{x}^{\left(\frac{1}{n}\right)}}{x} \cdot \frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x} + \frac{\frac{0.3333333333333333}{n} + \left(\frac{0.16666666666666666}{{n}^{3}} + {n}^{-2} \cdot -0.5\right)}{\frac{{x}^{3}}{{x}^{\left(\frac{1}{n}\right)}}}\right)} \]
    4. Taylor expanded in n around inf 77.7%

      \[\leadsto \frac{{x}^{\left(\frac{1}{n}\right)}}{x \cdot n} + \color{blue}{\frac{0.3333333333333333 \cdot \frac{1}{{x}^{3}} - 0.5 \cdot \frac{1}{{x}^{2}}}{n}} \]
    5. Step-by-step derivation
      1. associate-*r/77.7%

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

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

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

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

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

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

    if 0.5 < (/.f64 1 n)

    1. Initial program 47.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 85.2% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;\frac{1}{n} \leq 0.5:\\
\;\;\;\;\frac{t_0}{n \cdot x} + \frac{\frac{-0.5}{n}}{x \cdot x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 1 n) < -1.99999999999999988e-98

    1. Initial program 77.4%

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

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

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

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

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1}}{1}\right)}} \]
      7. metadata-eval77.4%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{\frac{2}{2}}}\right)} \]
      8. associate-/l*77.4%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1} \cdot 2}{2}\right)}} \]
      9. *-commutative77.4%

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{1}}\right)} \]
      13. /-rgt-identity77.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
    8. Step-by-step derivation
      1. add-exp-log35.4%

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

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

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

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

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

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

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

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

    if -1.99999999999999988e-98 < (/.f64 1 n) < 4.99999999999999992e-46

    1. Initial program 33.0%

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

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

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

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

    if 4.99999999999999992e-46 < (/.f64 1 n) < 0.5

    1. Initial program 11.9%

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

      \[\leadsto \color{blue}{\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}^{2}} + \frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    3. Simplified75.0%

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

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

    if 0.5 < (/.f64 1 n)

    1. Initial program 47.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 81.0% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;\frac{1}{n} \leq 0.5:\\
\;\;\;\;\frac{t_0}{n \cdot x} + \frac{\frac{-0.5}{n}}{x \cdot x}\\

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+215}:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot \left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}\right) + \left(1 + \frac{x}{n}\right)\right) - t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if (/.f64 1 n) < -1.99999999999999988e-98

    1. Initial program 77.4%

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

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

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

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

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1}}{1}\right)}} \]
      7. metadata-eval77.4%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{\frac{2}{2}}}\right)} \]
      8. associate-/l*77.4%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1} \cdot 2}{2}\right)}} \]
      9. *-commutative77.4%

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{1}}\right)} \]
      13. /-rgt-identity77.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
    8. Step-by-step derivation
      1. add-exp-log35.4%

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

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

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

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

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

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

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

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

    if -1.99999999999999988e-98 < (/.f64 1 n) < 4.99999999999999992e-46

    1. Initial program 33.0%

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

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

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

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

    if 4.99999999999999992e-46 < (/.f64 1 n) < 0.5

    1. Initial program 11.9%

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

      \[\leadsto \color{blue}{\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}^{2}} + \frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    3. Simplified75.0%

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

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

    if 0.5 < (/.f64 1 n) < 5.0000000000000001e215

    1. Initial program 63.4%

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000001e215 < (/.f64 1 n)

    1. Initial program 27.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{x \cdot n}} \]
    10. Simplified65.3%

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

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

Alternative 7: 70.3% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ t_1 := 1 - t_0\\ t_2 := \frac{-\log x}{n}\\ \mathbf{if}\;x \leq 1.6 \cdot 10^{-241}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{-132}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{-91}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-16}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t_0}{n}}{x}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- 1.0 t_0)) (t_2 (/ (- (log x)) n)))
   (if (<= x 1.6e-241)
     t_1
     (if (<= x 4.4e-132)
       t_2
       (if (<= x 4.4e-91) t_1 (if (<= x 5.5e-16) t_2 (/ (/ t_0 n) x)))))))
double code(double x, double n) {
	double t_0 = pow(x, (1.0 / n));
	double t_1 = 1.0 - t_0;
	double t_2 = -log(x) / n;
	double tmp;
	if (x <= 1.6e-241) {
		tmp = t_1;
	} else if (x <= 4.4e-132) {
		tmp = t_2;
	} else if (x <= 4.4e-91) {
		tmp = t_1;
	} else if (x <= 5.5e-16) {
		tmp = t_2;
	} else {
		tmp = (t_0 / n) / x;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = x ** (1.0d0 / n)
    t_1 = 1.0d0 - t_0
    t_2 = -log(x) / n
    if (x <= 1.6d-241) then
        tmp = t_1
    else if (x <= 4.4d-132) then
        tmp = t_2
    else if (x <= 4.4d-91) then
        tmp = t_1
    else if (x <= 5.5d-16) then
        tmp = t_2
    else
        tmp = (t_0 / n) / x
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double t_0 = Math.pow(x, (1.0 / n));
	double t_1 = 1.0 - t_0;
	double t_2 = -Math.log(x) / n;
	double tmp;
	if (x <= 1.6e-241) {
		tmp = t_1;
	} else if (x <= 4.4e-132) {
		tmp = t_2;
	} else if (x <= 4.4e-91) {
		tmp = t_1;
	} else if (x <= 5.5e-16) {
		tmp = t_2;
	} else {
		tmp = (t_0 / n) / x;
	}
	return tmp;
}
def code(x, n):
	t_0 = math.pow(x, (1.0 / n))
	t_1 = 1.0 - t_0
	t_2 = -math.log(x) / n
	tmp = 0
	if x <= 1.6e-241:
		tmp = t_1
	elif x <= 4.4e-132:
		tmp = t_2
	elif x <= 4.4e-91:
		tmp = t_1
	elif x <= 5.5e-16:
		tmp = t_2
	else:
		tmp = (t_0 / n) / x
	return tmp
function code(x, n)
	t_0 = x ^ Float64(1.0 / n)
	t_1 = Float64(1.0 - t_0)
	t_2 = Float64(Float64(-log(x)) / n)
	tmp = 0.0
	if (x <= 1.6e-241)
		tmp = t_1;
	elseif (x <= 4.4e-132)
		tmp = t_2;
	elseif (x <= 4.4e-91)
		tmp = t_1;
	elseif (x <= 5.5e-16)
		tmp = t_2;
	else
		tmp = Float64(Float64(t_0 / n) / x);
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = x ^ (1.0 / n);
	t_1 = 1.0 - t_0;
	t_2 = -log(x) / n;
	tmp = 0.0;
	if (x <= 1.6e-241)
		tmp = t_1;
	elseif (x <= 4.4e-132)
		tmp = t_2;
	elseif (x <= 4.4e-91)
		tmp = t_1;
	elseif (x <= 5.5e-16)
		tmp = t_2;
	else
		tmp = (t_0 / n) / x;
	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[(1.0 - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 1.6e-241], t$95$1, If[LessEqual[x, 4.4e-132], t$95$2, If[LessEqual[x, 4.4e-91], t$95$1, If[LessEqual[x, 5.5e-16], t$95$2, N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := 1 - t_0\\
t_2 := \frac{-\log x}{n}\\
\mathbf{if}\;x \leq 1.6 \cdot 10^{-241}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 4.4 \cdot 10^{-132}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq 4.4 \cdot 10^{-91}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 5.5 \cdot 10^{-16}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_0}{n}}{x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 1.6e-241 or 4.39999999999999981e-132 < x < 4.4000000000000002e-91

    1. Initial program 59.0%

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

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

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

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

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

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

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

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

    if 1.6e-241 < x < 4.39999999999999981e-132 or 4.4000000000000002e-91 < x < 5.49999999999999964e-16

    1. Initial program 30.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.49999999999999964e-16 < x

    1. Initial program 62.3%

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

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

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

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

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

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{\frac{2}{2}}}\right)} \]
      8. associate-/l*62.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.6 \cdot 10^{-241}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{-132}:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{-91}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-16}:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\ \end{array} \]

Alternative 8: 70.4% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-\log x}{n}\\ t_1 := {x}^{\left(\frac{1}{n}\right)}\\ t_2 := \left(1 + \frac{x}{n}\right) - t_1\\ \mathbf{if}\;x \leq 2.6 \cdot 10^{-241}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4 \cdot 10^{-130}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{-91}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{-16}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t_1}{n}}{x}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (/ (- (log x)) n))
        (t_1 (pow x (/ 1.0 n)))
        (t_2 (- (+ 1.0 (/ x n)) t_1)))
   (if (<= x 2.6e-241)
     t_2
     (if (<= x 4e-130)
       t_0
       (if (<= x 2.7e-91) t_2 (if (<= x 4.4e-16) t_0 (/ (/ t_1 n) x)))))))
double code(double x, double n) {
	double t_0 = -log(x) / n;
	double t_1 = pow(x, (1.0 / n));
	double t_2 = (1.0 + (x / n)) - t_1;
	double tmp;
	if (x <= 2.6e-241) {
		tmp = t_2;
	} else if (x <= 4e-130) {
		tmp = t_0;
	} else if (x <= 2.7e-91) {
		tmp = t_2;
	} else if (x <= 4.4e-16) {
		tmp = t_0;
	} else {
		tmp = (t_1 / n) / x;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = -log(x) / n
    t_1 = x ** (1.0d0 / n)
    t_2 = (1.0d0 + (x / n)) - t_1
    if (x <= 2.6d-241) then
        tmp = t_2
    else if (x <= 4d-130) then
        tmp = t_0
    else if (x <= 2.7d-91) then
        tmp = t_2
    else if (x <= 4.4d-16) then
        tmp = t_0
    else
        tmp = (t_1 / n) / x
    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 t_2 = (1.0 + (x / n)) - t_1;
	double tmp;
	if (x <= 2.6e-241) {
		tmp = t_2;
	} else if (x <= 4e-130) {
		tmp = t_0;
	} else if (x <= 2.7e-91) {
		tmp = t_2;
	} else if (x <= 4.4e-16) {
		tmp = t_0;
	} else {
		tmp = (t_1 / n) / x;
	}
	return tmp;
}
def code(x, n):
	t_0 = -math.log(x) / n
	t_1 = math.pow(x, (1.0 / n))
	t_2 = (1.0 + (x / n)) - t_1
	tmp = 0
	if x <= 2.6e-241:
		tmp = t_2
	elif x <= 4e-130:
		tmp = t_0
	elif x <= 2.7e-91:
		tmp = t_2
	elif x <= 4.4e-16:
		tmp = t_0
	else:
		tmp = (t_1 / n) / x
	return tmp
function code(x, n)
	t_0 = Float64(Float64(-log(x)) / n)
	t_1 = x ^ Float64(1.0 / n)
	t_2 = Float64(Float64(1.0 + Float64(x / n)) - t_1)
	tmp = 0.0
	if (x <= 2.6e-241)
		tmp = t_2;
	elseif (x <= 4e-130)
		tmp = t_0;
	elseif (x <= 2.7e-91)
		tmp = t_2;
	elseif (x <= 4.4e-16)
		tmp = t_0;
	else
		tmp = Float64(Float64(t_1 / n) / x);
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = -log(x) / n;
	t_1 = x ^ (1.0 / n);
	t_2 = (1.0 + (x / n)) - t_1;
	tmp = 0.0;
	if (x <= 2.6e-241)
		tmp = t_2;
	elseif (x <= 4e-130)
		tmp = t_0;
	elseif (x <= 2.7e-91)
		tmp = t_2;
	elseif (x <= 4.4e-16)
		tmp = t_0;
	else
		tmp = (t_1 / n) / x;
	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]}, Block[{t$95$2 = N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]}, If[LessEqual[x, 2.6e-241], t$95$2, If[LessEqual[x, 4e-130], t$95$0, If[LessEqual[x, 2.7e-91], t$95$2, If[LessEqual[x, 4.4e-16], t$95$0, N[(N[(t$95$1 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-\log x}{n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
t_2 := \left(1 + \frac{x}{n}\right) - t_1\\
\mathbf{if}\;x \leq 2.6 \cdot 10^{-241}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq 4 \cdot 10^{-130}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 2.7 \cdot 10^{-91}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq 4.4 \cdot 10^{-16}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_1}{n}}{x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 2.5999999999999999e-241 or 4.0000000000000003e-130 < x < 2.6999999999999997e-91

    1. Initial program 59.0%

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

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

    if 2.5999999999999999e-241 < x < 4.0000000000000003e-130 or 2.6999999999999997e-91 < x < 4.40000000000000001e-16

    1. Initial program 30.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.40000000000000001e-16 < x

    1. Initial program 62.3%

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

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

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

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

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

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{\frac{2}{2}}}\right)} \]
      8. associate-/l*62.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.6 \cdot 10^{-241}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 4 \cdot 10^{-130}:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{-91}:\\ \;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{-16}:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\ \end{array} \]

Alternative 9: 55.8% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;x \leq 2 \cdot 10^{-242}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{-131}:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-92}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 0.98:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
   (if (<= x 2e-242)
     t_0
     (if (<= x 1.45e-131)
       (/ (- (log x)) n)
       (if (<= x 5.5e-92)
         t_0
         (if (<= x 0.98)
           (/ (- x (log x)) n)
           (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n)))))))
double code(double x, double n) {
	double t_0 = 1.0 - pow(x, (1.0 / n));
	double tmp;
	if (x <= 2e-242) {
		tmp = t_0;
	} else if (x <= 1.45e-131) {
		tmp = -log(x) / n;
	} else if (x <= 5.5e-92) {
		tmp = t_0;
	} else if (x <= 0.98) {
		tmp = (x - log(x)) / n;
	} else {
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 - (x ** (1.0d0 / n))
    if (x <= 2d-242) then
        tmp = t_0
    else if (x <= 1.45d-131) then
        tmp = -log(x) / n
    else if (x <= 5.5d-92) then
        tmp = t_0
    else if (x <= 0.98d0) then
        tmp = (x - log(x)) / n
    else
        tmp = ((1.0d0 / x) - (0.5d0 / (x * x))) / n
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double t_0 = 1.0 - Math.pow(x, (1.0 / n));
	double tmp;
	if (x <= 2e-242) {
		tmp = t_0;
	} else if (x <= 1.45e-131) {
		tmp = -Math.log(x) / n;
	} else if (x <= 5.5e-92) {
		tmp = t_0;
	} else if (x <= 0.98) {
		tmp = (x - Math.log(x)) / n;
	} else {
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
	}
	return tmp;
}
def code(x, n):
	t_0 = 1.0 - math.pow(x, (1.0 / n))
	tmp = 0
	if x <= 2e-242:
		tmp = t_0
	elif x <= 1.45e-131:
		tmp = -math.log(x) / n
	elif x <= 5.5e-92:
		tmp = t_0
	elif x <= 0.98:
		tmp = (x - math.log(x)) / n
	else:
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n
	return tmp
function code(x, n)
	t_0 = Float64(1.0 - (x ^ Float64(1.0 / n)))
	tmp = 0.0
	if (x <= 2e-242)
		tmp = t_0;
	elseif (x <= 1.45e-131)
		tmp = Float64(Float64(-log(x)) / n);
	elseif (x <= 5.5e-92)
		tmp = t_0;
	elseif (x <= 0.98)
		tmp = Float64(Float64(x - log(x)) / n);
	else
		tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n);
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = 1.0 - (x ^ (1.0 / n));
	tmp = 0.0;
	if (x <= 2e-242)
		tmp = t_0;
	elseif (x <= 1.45e-131)
		tmp = -log(x) / n;
	elseif (x <= 5.5e-92)
		tmp = t_0;
	elseif (x <= 0.98)
		tmp = (x - log(x)) / n;
	else
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2e-242], t$95$0, If[LessEqual[x, 1.45e-131], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 5.5e-92], t$95$0, If[LessEqual[x, 0.98], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 1.45 \cdot 10^{-131}:\\
\;\;\;\;\frac{-\log x}{n}\\

\mathbf{elif}\;x \leq 5.5 \cdot 10^{-92}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 0.98:\\
\;\;\;\;\frac{x - \log x}{n}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < 2e-242 or 1.4500000000000001e-131 < x < 5.5000000000000002e-92

    1. Initial program 59.0%

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

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

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

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

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

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

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

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

    if 2e-242 < x < 1.4500000000000001e-131

    1. Initial program 33.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.5000000000000002e-92 < x < 0.97999999999999998

    1. Initial program 33.1%

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

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

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

    if 0.97999999999999998 < x

    1. Initial program 61.9%

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

      \[\leadsto \color{blue}{\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}^{2}} + \frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    3. Simplified85.7%

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

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

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

        \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{0.5}}{{x}^{2}}}{n} \]
      3. unpow264.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2 \cdot 10^{-242}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{-131}:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-92}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.98:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\ \end{array} \]

Alternative 10: 56.3% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 5.4 \cdot 10^{-264}:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{-245}:\\ \;\;\;\;\frac{1}{n \cdot x}\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= x 5.4e-264)
   (/ (- (log x)) n)
   (if (<= x 6.4e-245)
     (/ 1.0 (* n x))
     (if (<= x 1.0) (/ (- x (log x)) n) (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n)))))
double code(double x, double n) {
	double tmp;
	if (x <= 5.4e-264) {
		tmp = -log(x) / n;
	} else if (x <= 6.4e-245) {
		tmp = 1.0 / (n * x);
	} else if (x <= 1.0) {
		tmp = (x - log(x)) / n;
	} else {
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: tmp
    if (x <= 5.4d-264) then
        tmp = -log(x) / n
    else if (x <= 6.4d-245) then
        tmp = 1.0d0 / (n * x)
    else if (x <= 1.0d0) then
        tmp = (x - log(x)) / n
    else
        tmp = ((1.0d0 / x) - (0.5d0 / (x * x))) / n
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double tmp;
	if (x <= 5.4e-264) {
		tmp = -Math.log(x) / n;
	} else if (x <= 6.4e-245) {
		tmp = 1.0 / (n * x);
	} else if (x <= 1.0) {
		tmp = (x - Math.log(x)) / n;
	} else {
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if x <= 5.4e-264:
		tmp = -math.log(x) / n
	elif x <= 6.4e-245:
		tmp = 1.0 / (n * x)
	elif x <= 1.0:
		tmp = (x - math.log(x)) / n
	else:
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n
	return tmp
function code(x, n)
	tmp = 0.0
	if (x <= 5.4e-264)
		tmp = Float64(Float64(-log(x)) / n);
	elseif (x <= 6.4e-245)
		tmp = Float64(1.0 / Float64(n * x));
	elseif (x <= 1.0)
		tmp = Float64(Float64(x - log(x)) / n);
	else
		tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n);
	end
	return tmp
end
function tmp_2 = code(x, n)
	tmp = 0.0;
	if (x <= 5.4e-264)
		tmp = -log(x) / n;
	elseif (x <= 6.4e-245)
		tmp = 1.0 / (n * x);
	elseif (x <= 1.0)
		tmp = (x - log(x)) / n;
	else
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
	end
	tmp_2 = tmp;
end
code[x_, n_] := If[LessEqual[x, 5.4e-264], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 6.4e-245], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.4 \cdot 10^{-264}:\\
\;\;\;\;\frac{-\log x}{n}\\

\mathbf{elif}\;x \leq 6.4 \cdot 10^{-245}:\\
\;\;\;\;\frac{1}{n \cdot x}\\

\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\frac{x - \log x}{n}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < 5.39999999999999989e-264

    1. Initial program 46.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.39999999999999989e-264 < x < 6.39999999999999972e-245

    1. Initial program 67.8%

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

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

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

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

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1}}{1}\right)}} \]
      7. metadata-eval89.3%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{\frac{2}{2}}}\right)} \]
      8. associate-/l*89.3%

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

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{1}}\right)} \]
      13. /-rgt-identity89.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.39999999999999972e-245 < x < 1

    1. Initial program 40.5%

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

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

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

    if 1 < x

    1. Initial program 61.9%

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

      \[\leadsto \color{blue}{\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}^{2}} + \frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    3. Simplified85.7%

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

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

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

        \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{0.5}}{{x}^{2}}}{n} \]
      3. unpow264.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5.4 \cdot 10^{-264}:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{-245}:\\ \;\;\;\;\frac{1}{n \cdot x}\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\ \end{array} \]

Alternative 11: 56.0% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-\log x}{n}\\ \mathbf{if}\;x \leq 5.4 \cdot 10^{-264}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{-245}:\\ \;\;\;\;\frac{1}{n \cdot x}\\ \mathbf{elif}\;x \leq 0.68:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (/ (- (log x)) n)))
   (if (<= x 5.4e-264)
     t_0
     (if (<= x 6.4e-245)
       (/ 1.0 (* n x))
       (if (<= x 0.68) t_0 (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n))))))
double code(double x, double n) {
	double t_0 = -log(x) / n;
	double tmp;
	if (x <= 5.4e-264) {
		tmp = t_0;
	} else if (x <= 6.4e-245) {
		tmp = 1.0 / (n * x);
	} else if (x <= 0.68) {
		tmp = t_0;
	} else {
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: tmp
    t_0 = -log(x) / n
    if (x <= 5.4d-264) then
        tmp = t_0
    else if (x <= 6.4d-245) then
        tmp = 1.0d0 / (n * x)
    else if (x <= 0.68d0) then
        tmp = t_0
    else
        tmp = ((1.0d0 / x) - (0.5d0 / (x * x))) / n
    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 <= 5.4e-264) {
		tmp = t_0;
	} else if (x <= 6.4e-245) {
		tmp = 1.0 / (n * x);
	} else if (x <= 0.68) {
		tmp = t_0;
	} else {
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
	}
	return tmp;
}
def code(x, n):
	t_0 = -math.log(x) / n
	tmp = 0
	if x <= 5.4e-264:
		tmp = t_0
	elif x <= 6.4e-245:
		tmp = 1.0 / (n * x)
	elif x <= 0.68:
		tmp = t_0
	else:
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n
	return tmp
function code(x, n)
	t_0 = Float64(Float64(-log(x)) / n)
	tmp = 0.0
	if (x <= 5.4e-264)
		tmp = t_0;
	elseif (x <= 6.4e-245)
		tmp = Float64(1.0 / Float64(n * x));
	elseif (x <= 0.68)
		tmp = t_0;
	else
		tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n);
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = -log(x) / n;
	tmp = 0.0;
	if (x <= 5.4e-264)
		tmp = t_0;
	elseif (x <= 6.4e-245)
		tmp = 1.0 / (n * x);
	elseif (x <= 0.68)
		tmp = t_0;
	else
		tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 5.4e-264], t$95$0, If[LessEqual[x, 6.4e-245], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.68], t$95$0, N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-\log x}{n}\\
\mathbf{if}\;x \leq 5.4 \cdot 10^{-264}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 6.4 \cdot 10^{-245}:\\
\;\;\;\;\frac{1}{n \cdot x}\\

\mathbf{elif}\;x \leq 0.68:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 5.39999999999999989e-264 or 6.39999999999999972e-245 < x < 0.680000000000000049

    1. Initial program 41.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.39999999999999989e-264 < x < 6.39999999999999972e-245

    1. Initial program 67.8%

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

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

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

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

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\color{blue}{\left(\frac{{n}^{-1}}{1}\right)}} \]
      7. metadata-eval89.3%

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{\frac{2}{2}}}\right)} \]
      8. associate-/l*89.3%

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

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{1}}\right)} \]
      13. /-rgt-identity89.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.680000000000000049 < x

    1. Initial program 61.9%

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

      \[\leadsto \color{blue}{\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}^{2}} + \frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{n \cdot x}} \]
    3. Simplified85.7%

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

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

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

        \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{0.5}}{{x}^{2}}}{n} \]
      3. unpow264.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5.4 \cdot 10^{-264}:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{-245}:\\ \;\;\;\;\frac{1}{n \cdot x}\\ \mathbf{elif}\;x \leq 0.68:\\ \;\;\;\;\frac{-\log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\ \end{array} \]

Alternative 12: 40.0% accurate, 42.2× speedup?

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

\\
\frac{1}{n \cdot x}
\end{array}
Derivation
  1. Initial program 51.2%

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

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

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

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

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

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

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

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

      \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{\frac{2}{2}}}\right)} \]
    8. associate-/l*60.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{x \cdot n}} \]
  10. Simplified42.5%

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

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

Alternative 13: 40.5% 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.2%

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

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

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

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

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

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

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

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

      \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{\frac{2}{2}}}\right)} \]
    8. associate-/l*60.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{n}}{x}} \]
  10. Simplified43.0%

    \[\leadsto \color{blue}{\frac{\frac{1}{n}}{x}} \]
  11. Final simplification43.0%

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

Alternative 14: 40.5% accurate, 42.2× speedup?

\[\begin{array}{l} \\ \frac{\frac{1}{x}}{n} \end{array} \]
(FPCore (x n) :precision binary64 (/ (/ 1.0 x) n))
double code(double x, double n) {
	return (1.0 / x) / n;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    code = (1.0d0 / x) / n
end function
public static double code(double x, double n) {
	return (1.0 / x) / n;
}
def code(x, n):
	return (1.0 / x) / n
function code(x, n)
	return Float64(Float64(1.0 / x) / n)
end
function tmp = code(x, n)
	tmp = (1.0 / x) / n;
end
code[x_, n_] := N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{1}{x}}{n}
\end{array}
Derivation
  1. Initial program 51.2%

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

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

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

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

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

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

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

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

      \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{{n}^{-1}}{\color{blue}{\frac{2}{2}}}\right)} \]
    8. associate-/l*60.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
  8. Step-by-step derivation
    1. add-exp-log32.9%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{x}}{n}} \]
  12. Simplified43.0%

    \[\leadsto \color{blue}{\frac{\frac{1}{x}}{n}} \]
  13. Final simplification43.0%

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

Alternative 15: 4.5% accurate, 70.3× speedup?

\[\begin{array}{l} \\ \frac{x}{n} \end{array} \]
(FPCore (x n) :precision binary64 (/ x n))
double code(double x, double n) {
	return x / n;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    code = x / n
end function
public static double code(double x, double n) {
	return x / n;
}
def code(x, n):
	return x / n
function code(x, n)
	return Float64(x / n)
end
function tmp = code(x, n)
	tmp = x / n;
end
code[x_, n_] := N[(x / n), $MachinePrecision]
\begin{array}{l}

\\
\frac{x}{n}
\end{array}
Derivation
  1. Initial program 51.2%

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

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

    \[\leadsto \color{blue}{\frac{x}{n}} \]
  4. Final simplification4.6%

    \[\leadsto \frac{x}{n} \]

Reproduce

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