2nthrt (problem 3.4.6)

Percentage Accurate: 53.0% → 84.4%
Time: 48.7s
Alternatives: 14
Speedup: 1.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 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.0% accurate, 1.0× speedup?

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

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

Alternative 1: 84.4% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 260000:\\
\;\;\;\;\frac{\log \left(\frac{e^{\mathsf{log1p}\left(x\right) + 0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n}}}{x}\right)}{n}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\


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

    1. Initial program 48.0%

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

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

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

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

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

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) + \color{blue}{\left(\left(0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n}\right) - \log x\right)}}{n} \]
      5. distribute-lft-out--68.0%

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

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

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

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

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

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

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

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

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

    if 2.6e5 < x

    1. Initial program 69.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 85.3% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
t_2 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_1\\
\mathbf{if}\;t\_2 \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left({x}^{\left(\frac{0.5}{n}\right)}, -\sqrt{t\_1}, t\_0\right)\\

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

\mathbf{else}:\\
\;\;\;\;t\_0 - t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -0.0100000000000000002

    1. Initial program 99.8%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg99.8%

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

        \[\leadsto \color{blue}{\left(-{x}^{\left(\frac{1}{n}\right)}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \]
      3. sqr-pow99.7%

        \[\leadsto \left(-\color{blue}{{x}^{\left(\frac{\frac{1}{n}}{2}\right)} \cdot {x}^{\left(\frac{\frac{1}{n}}{2}\right)}}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
      4. distribute-rgt-neg-in99.7%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{\left(\frac{\frac{1}{n}}{2}\right)}, -{x}^{\left(\frac{\frac{1}{n}}{2}\right)}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
      6. sqrt-pow199.8%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{{x}^{\left(\frac{1}{n}\right)}}}, -{x}^{\left(\frac{\frac{1}{n}}{2}\right)}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right) \]
      7. sqrt-pow199.8%

        \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\color{blue}{\sqrt{{x}^{\left(\frac{1}{n}\right)}}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right) \]
      8. pow-to-exp99.8%

        \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
      9. un-div-inv99.8%

        \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
      10. +-commutative99.8%

        \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
      11. log1p-define99.8%

        \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right) \]
    4. Applied egg-rr99.8%

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{e^{\frac{\log x}{n}}}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
    6. Step-by-step derivation
      1. *-rgt-identity99.8%

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

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

        \[\leadsto \mathsf{fma}\left(\sqrt{\color{blue}{{x}^{\left(\frac{1}{n}\right)}}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
      4. unpow1/299.8%

        \[\leadsto \mathsf{fma}\left(\color{blue}{{\left({x}^{\left(\frac{1}{n}\right)}\right)}^{0.5}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
      5. exp-to-pow99.8%

        \[\leadsto \mathsf{fma}\left({\color{blue}{\left(e^{\log x \cdot \frac{1}{n}}\right)}}^{0.5}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
      6. associate-*r/99.8%

        \[\leadsto \mathsf{fma}\left({\left(e^{\color{blue}{\frac{\log x \cdot 1}{n}}}\right)}^{0.5}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
      7. *-rgt-identity99.8%

        \[\leadsto \mathsf{fma}\left({\left(e^{\frac{\color{blue}{\log x}}{n}}\right)}^{0.5}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
      8. exp-prod99.8%

        \[\leadsto \mathsf{fma}\left(\color{blue}{e^{\frac{\log x}{n} \cdot 0.5}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
      9. *-rgt-identity99.8%

        \[\leadsto \mathsf{fma}\left(e^{\frac{\color{blue}{\log x \cdot 1}}{n} \cdot 0.5}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
      10. associate-*r/99.8%

        \[\leadsto \mathsf{fma}\left(e^{\color{blue}{\left(\log x \cdot \frac{1}{n}\right)} \cdot 0.5}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
      11. associate-*r*99.8%

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

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

        \[\leadsto \mathsf{fma}\left({x}^{\color{blue}{\left(\frac{1 \cdot 0.5}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
      14. metadata-eval99.8%

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

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

    if -0.0100000000000000002 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 5.00000000000000018e-11

    1. Initial program 42.0%

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

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

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

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

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

        \[\leadsto \frac{\mathsf{log1p}\left(x\right) + \color{blue}{\left(\left(0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n}\right) - \log x\right)}}{n} \]
      5. distribute-lft-out--81.7%

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

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

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

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

    if 5.00000000000000018e-11 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n)))

    1. Initial program 67.2%

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

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

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

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

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

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

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

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

Alternative 3: 85.1% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
t_2 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_1\\
\mathbf{if}\;t\_2 \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left({x}^{\left(\frac{0.5}{n}\right)}, -\sqrt{t\_1}, t\_0\right)\\

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

\mathbf{else}:\\
\;\;\;\;t\_0 - t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -0.0100000000000000002

    1. Initial program 99.8%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg99.8%

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

        \[\leadsto \color{blue}{\left(-{x}^{\left(\frac{1}{n}\right)}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \]
      3. sqr-pow99.7%

        \[\leadsto \left(-\color{blue}{{x}^{\left(\frac{\frac{1}{n}}{2}\right)} \cdot {x}^{\left(\frac{\frac{1}{n}}{2}\right)}}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
      4. distribute-rgt-neg-in99.7%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{\left(\frac{\frac{1}{n}}{2}\right)}, -{x}^{\left(\frac{\frac{1}{n}}{2}\right)}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
      6. sqrt-pow199.8%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{{x}^{\left(\frac{1}{n}\right)}}}, -{x}^{\left(\frac{\frac{1}{n}}{2}\right)}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right) \]
      7. sqrt-pow199.8%

        \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\color{blue}{\sqrt{{x}^{\left(\frac{1}{n}\right)}}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right) \]
      8. pow-to-exp99.8%

        \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
      9. un-div-inv99.8%

        \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
      10. +-commutative99.8%

        \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
      11. log1p-define99.8%

        \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\color{blue}{\mathsf{log1p}\left(x\right)}}{n}}\right) \]
    4. Applied egg-rr99.8%

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{e^{\frac{\log x}{n}}}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
    6. Step-by-step derivation
      1. *-rgt-identity99.8%

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

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

        \[\leadsto \mathsf{fma}\left(\sqrt{\color{blue}{{x}^{\left(\frac{1}{n}\right)}}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
      4. unpow1/299.8%

        \[\leadsto \mathsf{fma}\left(\color{blue}{{\left({x}^{\left(\frac{1}{n}\right)}\right)}^{0.5}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
      5. exp-to-pow99.8%

        \[\leadsto \mathsf{fma}\left({\color{blue}{\left(e^{\log x \cdot \frac{1}{n}}\right)}}^{0.5}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
      6. associate-*r/99.8%

        \[\leadsto \mathsf{fma}\left({\left(e^{\color{blue}{\frac{\log x \cdot 1}{n}}}\right)}^{0.5}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
      7. *-rgt-identity99.8%

        \[\leadsto \mathsf{fma}\left({\left(e^{\frac{\color{blue}{\log x}}{n}}\right)}^{0.5}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
      8. exp-prod99.8%

        \[\leadsto \mathsf{fma}\left(\color{blue}{e^{\frac{\log x}{n} \cdot 0.5}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
      9. *-rgt-identity99.8%

        \[\leadsto \mathsf{fma}\left(e^{\frac{\color{blue}{\log x \cdot 1}}{n} \cdot 0.5}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
      10. associate-*r/99.8%

        \[\leadsto \mathsf{fma}\left(e^{\color{blue}{\left(\log x \cdot \frac{1}{n}\right)} \cdot 0.5}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
      11. associate-*r*99.8%

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

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

        \[\leadsto \mathsf{fma}\left({x}^{\color{blue}{\left(\frac{1 \cdot 0.5}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\right) \]
      14. metadata-eval99.8%

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

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

    if -0.0100000000000000002 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 5.00000000000000018e-11

    1. Initial program 42.0%

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

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

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

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

    if 5.00000000000000018e-11 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n)))

    1. Initial program 67.2%

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

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

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

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

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

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

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

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

Alternative 4: 85.1% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -0.01:\\
\;\;\;\;\log \left(e^{1 - t\_0}\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -0.0100000000000000002

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \left(\frac{e^{1}}{e^{\color{blue}{{x}^{\left(\frac{1}{n}\right)}}}}\right) \]
      5. div-exp99.8%

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

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

    if -0.0100000000000000002 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 5.00000000000000018e-11

    1. Initial program 42.0%

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

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

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

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

    if 5.00000000000000018e-11 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n)))

    1. Initial program 67.2%

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

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

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

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

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

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

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

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

Alternative 5: 81.6% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -0.01:\\
\;\;\;\;\log \left(e^{1 - t\_0}\right)\\

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

\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + x \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right)\right) - t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -0.0100000000000000002

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \left(\frac{e^{1}}{e^{\color{blue}{{x}^{\left(\frac{1}{n}\right)}}}}\right) \]
      5. div-exp99.8%

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

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

    if -0.0100000000000000002 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 5.00000000000000018e-11

    1. Initial program 42.0%

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

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

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

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

    if 5.00000000000000018e-11 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n)))

    1. Initial program 67.2%

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

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

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

Alternative 6: 81.7% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -0.01:\\
\;\;\;\;1 - t\_0\\

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

\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + x \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right)\right) - t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -0.0100000000000000002

    1. Initial program 99.8%

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

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

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

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

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

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

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

    if -0.0100000000000000002 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 5.00000000000000018e-11

    1. Initial program 42.0%

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

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

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

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

    if 5.00000000000000018e-11 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n)))

    1. Initial program 67.2%

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

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

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

Alternative 7: 78.4% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -0.01:\\
\;\;\;\;1 - t\_0\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -0.0100000000000000002

    1. Initial program 99.8%

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

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

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

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

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

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

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

    if -0.0100000000000000002 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 5.00000000000000018e-11

    1. Initial program 42.0%

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

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

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

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

    if 5.00000000000000018e-11 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n)))

    1. Initial program 67.2%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Add Preprocessing
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 8: 77.9% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -40000:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\

\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-75}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-90}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n}}{x}}{x}\\

\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;\left(\left(2 + \frac{x}{n}\right) + -1\right) - t\_0\\


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4e4 < (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e-75 or -5.00000000000000019e-90 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999991e-6

    1. Initial program 31.2%

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

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

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

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

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

    1. Initial program 4.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 1.99999999999999991e-6 < (/.f64 #s(literal 1 binary64) n)

      1. Initial program 67.2%

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

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

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

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

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(1 + \frac{x}{n}\right)} - 1\right)} - {x}^{\left(\frac{1}{n}\right)} \]
      6. Step-by-step derivation
        1. sub-neg66.7%

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

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

          \[\leadsto \left(\color{blue}{\left(1 + \left(1 + \frac{x}{n}\right)\right)} + \left(-1\right)\right) - {x}^{\left(\frac{1}{n}\right)} \]
        4. associate-+r+66.8%

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

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

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

        \[\leadsto \color{blue}{\left(\left(2 + \frac{x}{n}\right) + -1\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    7. Recombined 4 regimes into one program.
    8. Add Preprocessing

    Alternative 9: 56.1% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\ t_1 := \frac{\log x}{-n}\\ \mathbf{if}\;x \leq 1.6 \cdot 10^{-286}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.95 \cdot 10^{-224}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-189}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{-134}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+127}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n}}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
    (FPCore (x n)
     :precision binary64
     (let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (log x) (- n))))
       (if (<= x 1.6e-286)
         t_0
         (if (<= x 1.95e-224)
           t_1
           (if (<= x 3.5e-189)
             t_0
             (if (<= x 4.5e-134)
               t_1
               (if (<= x 1.0)
                 t_0
                 (if (<= x 6.5e+127)
                   (/ (+ (/ 1.0 n) (/ (/ -0.5 n) x)) x)
                   0.0))))))))
    double code(double x, double n) {
    	double t_0 = 1.0 - pow(x, (1.0 / n));
    	double t_1 = log(x) / -n;
    	double tmp;
    	if (x <= 1.6e-286) {
    		tmp = t_0;
    	} else if (x <= 1.95e-224) {
    		tmp = t_1;
    	} else if (x <= 3.5e-189) {
    		tmp = t_0;
    	} else if (x <= 4.5e-134) {
    		tmp = t_1;
    	} else if (x <= 1.0) {
    		tmp = t_0;
    	} else if (x <= 6.5e+127) {
    		tmp = ((1.0 / n) + ((-0.5 / n) / x)) / x;
    	} else {
    		tmp = 0.0;
    	}
    	return tmp;
    }
    
    real(8) function code(x, n)
        real(8), intent (in) :: x
        real(8), intent (in) :: n
        real(8) :: t_0
        real(8) :: t_1
        real(8) :: tmp
        t_0 = 1.0d0 - (x ** (1.0d0 / n))
        t_1 = log(x) / -n
        if (x <= 1.6d-286) then
            tmp = t_0
        else if (x <= 1.95d-224) then
            tmp = t_1
        else if (x <= 3.5d-189) then
            tmp = t_0
        else if (x <= 4.5d-134) then
            tmp = t_1
        else if (x <= 1.0d0) then
            tmp = t_0
        else if (x <= 6.5d+127) then
            tmp = ((1.0d0 / n) + (((-0.5d0) / n) / x)) / x
        else
            tmp = 0.0d0
        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 t_1 = Math.log(x) / -n;
    	double tmp;
    	if (x <= 1.6e-286) {
    		tmp = t_0;
    	} else if (x <= 1.95e-224) {
    		tmp = t_1;
    	} else if (x <= 3.5e-189) {
    		tmp = t_0;
    	} else if (x <= 4.5e-134) {
    		tmp = t_1;
    	} else if (x <= 1.0) {
    		tmp = t_0;
    	} else if (x <= 6.5e+127) {
    		tmp = ((1.0 / n) + ((-0.5 / n) / x)) / x;
    	} else {
    		tmp = 0.0;
    	}
    	return tmp;
    }
    
    def code(x, n):
    	t_0 = 1.0 - math.pow(x, (1.0 / n))
    	t_1 = math.log(x) / -n
    	tmp = 0
    	if x <= 1.6e-286:
    		tmp = t_0
    	elif x <= 1.95e-224:
    		tmp = t_1
    	elif x <= 3.5e-189:
    		tmp = t_0
    	elif x <= 4.5e-134:
    		tmp = t_1
    	elif x <= 1.0:
    		tmp = t_0
    	elif x <= 6.5e+127:
    		tmp = ((1.0 / n) + ((-0.5 / n) / x)) / x
    	else:
    		tmp = 0.0
    	return tmp
    
    function code(x, n)
    	t_0 = Float64(1.0 - (x ^ Float64(1.0 / n)))
    	t_1 = Float64(log(x) / Float64(-n))
    	tmp = 0.0
    	if (x <= 1.6e-286)
    		tmp = t_0;
    	elseif (x <= 1.95e-224)
    		tmp = t_1;
    	elseif (x <= 3.5e-189)
    		tmp = t_0;
    	elseif (x <= 4.5e-134)
    		tmp = t_1;
    	elseif (x <= 1.0)
    		tmp = t_0;
    	elseif (x <= 6.5e+127)
    		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(-0.5 / n) / x)) / x);
    	else
    		tmp = 0.0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, n)
    	t_0 = 1.0 - (x ^ (1.0 / n));
    	t_1 = log(x) / -n;
    	tmp = 0.0;
    	if (x <= 1.6e-286)
    		tmp = t_0;
    	elseif (x <= 1.95e-224)
    		tmp = t_1;
    	elseif (x <= 3.5e-189)
    		tmp = t_0;
    	elseif (x <= 4.5e-134)
    		tmp = t_1;
    	elseif (x <= 1.0)
    		tmp = t_0;
    	elseif (x <= 6.5e+127)
    		tmp = ((1.0 / n) + ((-0.5 / n) / x)) / x;
    	else
    		tmp = 0.0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 1.6e-286], t$95$0, If[LessEqual[x, 1.95e-224], t$95$1, If[LessEqual[x, 3.5e-189], t$95$0, If[LessEqual[x, 4.5e-134], t$95$1, If[LessEqual[x, 1.0], t$95$0, If[LessEqual[x, 6.5e+127], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(-0.5 / n), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
    t_1 := \frac{\log x}{-n}\\
    \mathbf{if}\;x \leq 1.6 \cdot 10^{-286}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;x \leq 1.95 \cdot 10^{-224}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;x \leq 3.5 \cdot 10^{-189}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;x \leq 4.5 \cdot 10^{-134}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;x \leq 1:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;x \leq 6.5 \cdot 10^{+127}:\\
    \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n}}{x}}{x}\\
    
    \mathbf{else}:\\
    \;\;\;\;0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if x < 1.60000000000000003e-286 or 1.9499999999999999e-224 < x < 3.5000000000000001e-189 or 4.5000000000000005e-134 < x < 1

      1. Initial program 59.5%

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

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

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

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

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

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

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

      if 1.60000000000000003e-286 < x < 1.9499999999999999e-224 or 3.5000000000000001e-189 < x < 4.5000000000000005e-134

      1. Initial program 33.6%

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{-\frac{\log x}{n}} \]
        2. distribute-frac-neg67.4%

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

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

      if 1 < x < 6.5e127

      1. Initial program 46.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 6.5e127 < x

        1. Initial program 89.1%

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

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

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

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{\left(\frac{\frac{1}{n}}{2}\right)}, -{x}^{\left(\frac{\frac{1}{n}}{2}\right)}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
          6. sqrt-pow189.1%

            \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{{x}^{\left(\frac{1}{n}\right)}}}, -{x}^{\left(\frac{\frac{1}{n}}{2}\right)}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right) \]
          7. sqrt-pow189.1%

            \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\color{blue}{\sqrt{{x}^{\left(\frac{1}{n}\right)}}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right) \]
          8. pow-to-exp89.1%

            \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
          9. un-div-inv89.1%

            \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
          10. +-commutative89.1%

            \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
          11. log1p-define89.1%

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

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

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

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

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

            \[\leadsto \color{blue}{0} \]
        7. Simplified89.1%

          \[\leadsto \color{blue}{0} \]
      7. Recombined 4 regimes into one program.
      8. Final simplification67.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.6 \cdot 10^{-286}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 1.95 \cdot 10^{-224}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-189}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{-134}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+127}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n}}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      9. Add Preprocessing

      Alternative 10: 70.2% accurate, 1.6× 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 8.2 \cdot 10^{-287}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{-224}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{-189}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 4.9 \cdot 10^{-36}:\\ \;\;\;\;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 8.2e-287)
           t_1
           (if (<= x 1.9e-224)
             t_2
             (if (<= x 2.7e-189) t_1 (if (<= x 4.9e-36) 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 <= 8.2e-287) {
      		tmp = t_1;
      	} else if (x <= 1.9e-224) {
      		tmp = t_2;
      	} else if (x <= 2.7e-189) {
      		tmp = t_1;
      	} else if (x <= 4.9e-36) {
      		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 <= 8.2d-287) then
              tmp = t_1
          else if (x <= 1.9d-224) then
              tmp = t_2
          else if (x <= 2.7d-189) then
              tmp = t_1
          else if (x <= 4.9d-36) 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 <= 8.2e-287) {
      		tmp = t_1;
      	} else if (x <= 1.9e-224) {
      		tmp = t_2;
      	} else if (x <= 2.7e-189) {
      		tmp = t_1;
      	} else if (x <= 4.9e-36) {
      		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 <= 8.2e-287:
      		tmp = t_1
      	elif x <= 1.9e-224:
      		tmp = t_2
      	elif x <= 2.7e-189:
      		tmp = t_1
      	elif x <= 4.9e-36:
      		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(log(x) / Float64(-n))
      	tmp = 0.0
      	if (x <= 8.2e-287)
      		tmp = t_1;
      	elseif (x <= 1.9e-224)
      		tmp = t_2;
      	elseif (x <= 2.7e-189)
      		tmp = t_1;
      	elseif (x <= 4.9e-36)
      		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 <= 8.2e-287)
      		tmp = t_1;
      	elseif (x <= 1.9e-224)
      		tmp = t_2;
      	elseif (x <= 2.7e-189)
      		tmp = t_1;
      	elseif (x <= 4.9e-36)
      		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, 8.2e-287], t$95$1, If[LessEqual[x, 1.9e-224], t$95$2, If[LessEqual[x, 2.7e-189], t$95$1, If[LessEqual[x, 4.9e-36], 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 8.2 \cdot 10^{-287}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;x \leq 1.9 \cdot 10^{-224}:\\
      \;\;\;\;t\_2\\
      
      \mathbf{elif}\;x \leq 2.7 \cdot 10^{-189}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;x \leq 4.9 \cdot 10^{-36}:\\
      \;\;\;\;t\_2\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if x < 8.2000000000000004e-287 or 1.90000000000000001e-224 < x < 2.6999999999999999e-189

        1. Initial program 72.4%

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

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

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

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

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

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

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

        if 8.2000000000000004e-287 < x < 1.90000000000000001e-224 or 2.6999999999999999e-189 < x < 4.8999999999999997e-36

        1. Initial program 41.6%

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{-\frac{\log x}{n}} \]
          2. distribute-frac-neg58.1%

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

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

        if 4.8999999999999997e-36 < x

        1. Initial program 68.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 8.2 \cdot 10^{-287}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{-224}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{-189}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 4.9 \cdot 10^{-36}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 11: 57.3% accurate, 1.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ \mathbf{if}\;x \leq 2 \cdot 10^{-224}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-210}:\\ \;\;\;\;\frac{1}{x \cdot n}\\ \mathbf{elif}\;x \leq 4.9 \cdot 10^{-36}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.95 \cdot 10^{+127}:\\ \;\;\;\;\frac{\frac{1}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
      (FPCore (x n)
       :precision binary64
       (let* ((t_0 (/ (log x) (- n))))
         (if (<= x 2e-224)
           t_0
           (if (<= x 1.05e-210)
             (/ 1.0 (* x n))
             (if (<= x 4.9e-36) t_0 (if (<= x 1.95e+127) (/ (/ 1.0 x) n) 0.0))))))
      double code(double x, double n) {
      	double t_0 = log(x) / -n;
      	double tmp;
      	if (x <= 2e-224) {
      		tmp = t_0;
      	} else if (x <= 1.05e-210) {
      		tmp = 1.0 / (x * n);
      	} else if (x <= 4.9e-36) {
      		tmp = t_0;
      	} else if (x <= 1.95e+127) {
      		tmp = (1.0 / x) / n;
      	} else {
      		tmp = 0.0;
      	}
      	return tmp;
      }
      
      real(8) function code(x, n)
          real(8), intent (in) :: x
          real(8), intent (in) :: n
          real(8) :: t_0
          real(8) :: tmp
          t_0 = log(x) / -n
          if (x <= 2d-224) then
              tmp = t_0
          else if (x <= 1.05d-210) then
              tmp = 1.0d0 / (x * n)
          else if (x <= 4.9d-36) then
              tmp = t_0
          else if (x <= 1.95d+127) then
              tmp = (1.0d0 / x) / n
          else
              tmp = 0.0d0
          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 <= 2e-224) {
      		tmp = t_0;
      	} else if (x <= 1.05e-210) {
      		tmp = 1.0 / (x * n);
      	} else if (x <= 4.9e-36) {
      		tmp = t_0;
      	} else if (x <= 1.95e+127) {
      		tmp = (1.0 / x) / n;
      	} else {
      		tmp = 0.0;
      	}
      	return tmp;
      }
      
      def code(x, n):
      	t_0 = math.log(x) / -n
      	tmp = 0
      	if x <= 2e-224:
      		tmp = t_0
      	elif x <= 1.05e-210:
      		tmp = 1.0 / (x * n)
      	elif x <= 4.9e-36:
      		tmp = t_0
      	elif x <= 1.95e+127:
      		tmp = (1.0 / x) / n
      	else:
      		tmp = 0.0
      	return tmp
      
      function code(x, n)
      	t_0 = Float64(log(x) / Float64(-n))
      	tmp = 0.0
      	if (x <= 2e-224)
      		tmp = t_0;
      	elseif (x <= 1.05e-210)
      		tmp = Float64(1.0 / Float64(x * n));
      	elseif (x <= 4.9e-36)
      		tmp = t_0;
      	elseif (x <= 1.95e+127)
      		tmp = Float64(Float64(1.0 / x) / n);
      	else
      		tmp = 0.0;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, n)
      	t_0 = log(x) / -n;
      	tmp = 0.0;
      	if (x <= 2e-224)
      		tmp = t_0;
      	elseif (x <= 1.05e-210)
      		tmp = 1.0 / (x * n);
      	elseif (x <= 4.9e-36)
      		tmp = t_0;
      	elseif (x <= 1.95e+127)
      		tmp = (1.0 / x) / n;
      	else
      		tmp = 0.0;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 2e-224], t$95$0, If[LessEqual[x, 1.05e-210], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.9e-36], t$95$0, If[LessEqual[x, 1.95e+127], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \frac{\log x}{-n}\\
      \mathbf{if}\;x \leq 2 \cdot 10^{-224}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq 1.05 \cdot 10^{-210}:\\
      \;\;\;\;\frac{1}{x \cdot n}\\
      
      \mathbf{elif}\;x \leq 4.9 \cdot 10^{-36}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq 1.95 \cdot 10^{+127}:\\
      \;\;\;\;\frac{\frac{1}{x}}{n}\\
      
      \mathbf{else}:\\
      \;\;\;\;0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if x < 2e-224 or 1.05000000000000008e-210 < x < 4.8999999999999997e-36

        1. Initial program 45.4%

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{-\frac{\log x}{n}} \]
          2. distribute-frac-neg55.5%

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

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

        if 2e-224 < x < 1.05000000000000008e-210

        1. Initial program 88.2%

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

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

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

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

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

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

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

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

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

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

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

        if 4.8999999999999997e-36 < x < 1.94999999999999991e127

        1. Initial program 50.3%

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\frac{\frac{1}{x}}{n}} \]
        8. Simplified59.2%

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

        if 1.94999999999999991e127 < x

        1. Initial program 89.1%

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

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

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

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{\left(\frac{\frac{1}{n}}{2}\right)}, -{x}^{\left(\frac{\frac{1}{n}}{2}\right)}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
          6. sqrt-pow189.1%

            \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{{x}^{\left(\frac{1}{n}\right)}}}, -{x}^{\left(\frac{\frac{1}{n}}{2}\right)}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right) \]
          7. sqrt-pow189.1%

            \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\color{blue}{\sqrt{{x}^{\left(\frac{1}{n}\right)}}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right) \]
          8. pow-to-exp89.1%

            \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
          9. un-div-inv89.1%

            \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
          10. +-commutative89.1%

            \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
          11. log1p-define89.1%

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

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

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

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

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

            \[\leadsto \color{blue}{0} \]
        7. Simplified89.1%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2 \cdot 10^{-224}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-210}:\\ \;\;\;\;\frac{1}{x \cdot n}\\ \mathbf{elif}\;x \leq 4.9 \cdot 10^{-36}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.95 \cdot 10^{+127}:\\ \;\;\;\;\frac{\frac{1}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      5. Add Preprocessing

      Alternative 12: 44.3% accurate, 21.1× speedup?

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

        1. Initial program 48.4%

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\frac{\frac{1}{x}}{n}} \]
        8. Simplified35.5%

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

        if 6.0000000000000005e127 < x

        1. Initial program 89.1%

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

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

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

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{\left(\frac{\frac{1}{n}}{2}\right)}, -{x}^{\left(\frac{\frac{1}{n}}{2}\right)}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
          6. sqrt-pow189.1%

            \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{{x}^{\left(\frac{1}{n}\right)}}}, -{x}^{\left(\frac{\frac{1}{n}}{2}\right)}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right) \]
          7. sqrt-pow189.1%

            \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\color{blue}{\sqrt{{x}^{\left(\frac{1}{n}\right)}}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right) \]
          8. pow-to-exp89.1%

            \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
          9. un-div-inv89.1%

            \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
          10. +-commutative89.1%

            \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
          11. log1p-define89.1%

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

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

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

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

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

            \[\leadsto \color{blue}{0} \]
        7. Simplified89.1%

          \[\leadsto \color{blue}{0} \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 13: 44.1% accurate, 21.1× speedup?

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

        1. Initial program 48.4%

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

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

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

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

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

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

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

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

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

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

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

        if 9.99999999999999955e126 < x

        1. Initial program 89.1%

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

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

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

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{\left(\frac{\frac{1}{n}}{2}\right)}, -{x}^{\left(\frac{\frac{1}{n}}{2}\right)}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
          6. sqrt-pow189.1%

            \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{{x}^{\left(\frac{1}{n}\right)}}}, -{x}^{\left(\frac{\frac{1}{n}}{2}\right)}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right) \]
          7. sqrt-pow189.1%

            \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\color{blue}{\sqrt{{x}^{\left(\frac{1}{n}\right)}}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right) \]
          8. pow-to-exp89.1%

            \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
          9. un-div-inv89.1%

            \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
          10. +-commutative89.1%

            \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
          11. log1p-define89.1%

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

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

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

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

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

            \[\leadsto \color{blue}{0} \]
        7. Simplified89.1%

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

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

      Alternative 14: 30.0% accurate, 211.0× speedup?

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

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

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

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

          \[\leadsto \left(-\color{blue}{{x}^{\left(\frac{\frac{1}{n}}{2}\right)} \cdot {x}^{\left(\frac{\frac{1}{n}}{2}\right)}}\right) + {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \]
        4. distribute-rgt-neg-in56.3%

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

          \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{\left(\frac{\frac{1}{n}}{2}\right)}, -{x}^{\left(\frac{\frac{1}{n}}{2}\right)}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right)} \]
        6. sqrt-pow156.4%

          \[\leadsto \mathsf{fma}\left(\color{blue}{\sqrt{{x}^{\left(\frac{1}{n}\right)}}}, -{x}^{\left(\frac{\frac{1}{n}}{2}\right)}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right) \]
        7. sqrt-pow156.3%

          \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\color{blue}{\sqrt{{x}^{\left(\frac{1}{n}\right)}}}, {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right) \]
        8. pow-to-exp56.3%

          \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}}\right) \]
        9. un-div-inv56.3%

          \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\color{blue}{\frac{\log \left(x + 1\right)}{n}}}\right) \]
        10. +-commutative56.3%

          \[\leadsto \mathsf{fma}\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}}, -\sqrt{{x}^{\left(\frac{1}{n}\right)}}, e^{\frac{\log \color{blue}{\left(1 + x\right)}}{n}}\right) \]
        11. log1p-define60.0%

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

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

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

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

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

          \[\leadsto \color{blue}{0} \]
      7. Simplified28.9%

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

      Reproduce

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