2nthrt (problem 3.4.6)

Percentage Accurate: 57.4% → 88.0%
Time: 34.5s
Alternatives: 13
Speedup: 1.7×

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 13 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: 57.4% 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: 88.0% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-14}:\\
\;\;\;\;\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}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\


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

    1. Initial program 84.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}} \]
    10. Step-by-step derivation
      1. unpow-prod-up92.5%

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

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

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

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

    if -1.99999999999999998e-92 < (/.f64 #s(literal 1 binary64) n) < 2e-14

    1. Initial program 29.8%

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

      \[\leadsto \color{blue}{\frac{\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+79.6%

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

        \[\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. +-commutative79.6%

        \[\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+79.6%

        \[\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--79.6%

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

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

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

      \[\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 2e-14 < (/.f64 #s(literal 1 binary64) n)

    1. Initial program 42.8%

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

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

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

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - \color{blue}{{x}^{\left(\frac{1}{n}\right)}} \]
    5. Simplified92.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 2: 88.0% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 84.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}} \]
    10. Step-by-step derivation
      1. unpow-prod-up92.5%

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

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

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

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

    if -1.99999999999999998e-92 < (/.f64 #s(literal 1 binary64) n) < 2e-14

    1. Initial program 29.8%

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

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

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

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

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

    1. Initial program 42.8%

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

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

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

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

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

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

        \[\leadsto e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - \color{blue}{{x}^{\left(\frac{1}{n}\right)}} \]
    5. Simplified92.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: 72.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.6 \cdot 10^{-131}:\\ \;\;\;\;0\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-290}:\\ \;\;\;\;1 - {x}^{\left(\frac{3}{n} \cdot 0.3333333333333333\right)}\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-190}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-88}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{n}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{x}}{n}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= x -3.6e-131)
   0.0
   (if (<= x 6e-290)
     (- 1.0 (pow x (* (/ 3.0 n) 0.3333333333333333)))
     (if (<= x 6e-190)
       (/ (log x) (- n))
       (if (<= x 3.6e-88)
         (/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* n x)) (/ 0.5 n)) x)) x)
         (if (<= x 1.0)
           (log1p (expm1 (/ x n)))
           (/ (/ (pow x (/ 1.0 n)) x) n)))))))
double code(double x, double n) {
	double tmp;
	if (x <= -3.6e-131) {
		tmp = 0.0;
	} else if (x <= 6e-290) {
		tmp = 1.0 - pow(x, ((3.0 / n) * 0.3333333333333333));
	} else if (x <= 6e-190) {
		tmp = log(x) / -n;
	} else if (x <= 3.6e-88) {
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
	} else if (x <= 1.0) {
		tmp = log1p(expm1((x / n)));
	} else {
		tmp = (pow(x, (1.0 / n)) / x) / n;
	}
	return tmp;
}
public static double code(double x, double n) {
	double tmp;
	if (x <= -3.6e-131) {
		tmp = 0.0;
	} else if (x <= 6e-290) {
		tmp = 1.0 - Math.pow(x, ((3.0 / n) * 0.3333333333333333));
	} else if (x <= 6e-190) {
		tmp = Math.log(x) / -n;
	} else if (x <= 3.6e-88) {
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
	} else if (x <= 1.0) {
		tmp = Math.log1p(Math.expm1((x / n)));
	} else {
		tmp = (Math.pow(x, (1.0 / n)) / x) / n;
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if x <= -3.6e-131:
		tmp = 0.0
	elif x <= 6e-290:
		tmp = 1.0 - math.pow(x, ((3.0 / n) * 0.3333333333333333))
	elif x <= 6e-190:
		tmp = math.log(x) / -n
	elif x <= 3.6e-88:
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x
	elif x <= 1.0:
		tmp = math.log1p(math.expm1((x / n)))
	else:
		tmp = (math.pow(x, (1.0 / n)) / x) / n
	return tmp
function code(x, n)
	tmp = 0.0
	if (x <= -3.6e-131)
		tmp = 0.0;
	elseif (x <= 6e-290)
		tmp = Float64(1.0 - (x ^ Float64(Float64(3.0 / n) * 0.3333333333333333)));
	elseif (x <= 6e-190)
		tmp = Float64(log(x) / Float64(-n));
	elseif (x <= 3.6e-88)
		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) - Float64(0.5 / n)) / x)) / x);
	elseif (x <= 1.0)
		tmp = log1p(expm1(Float64(x / n)));
	else
		tmp = Float64(Float64((x ^ Float64(1.0 / n)) / x) / n);
	end
	return tmp
end
code[x_, n_] := If[LessEqual[x, -3.6e-131], 0.0, If[LessEqual[x, 6e-290], N[(1.0 - N[Power[x, N[(N[(3.0 / n), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6e-190], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 3.6e-88], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 1.0], N[Log[1 + N[(Exp[N[(x / n), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-131}:\\
\;\;\;\;0\\

\mathbf{elif}\;x \leq 6 \cdot 10^{-290}:\\
\;\;\;\;1 - {x}^{\left(\frac{3}{n} \cdot 0.3333333333333333\right)}\\

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

\mathbf{elif}\;x \leq 3.6 \cdot 10^{-88}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\

\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{n}\right)\right)\\

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


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

    1. Initial program 63.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 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.5999999999999999e-131 < x < 5.99999999999999985e-290

    1. Initial program 63.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 16.0%

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

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

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

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

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

      \[\leadsto \color{blue}{1 - {x}^{\left(\frac{1}{n}\right)}} \]
    6. Step-by-step derivation
      1. add-cbrt-cube63.6%

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

        \[\leadsto 1 - \sqrt[3]{\color{blue}{{\left({x}^{\left(\frac{1}{n}\right)}\right)}^{3}}} \]
      3. pow-pow74.2%

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

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

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

        \[\leadsto 1 - \sqrt[3]{{x}^{\left(\frac{\color{blue}{3}}{n}\right)}} \]
    9. Simplified74.2%

      \[\leadsto 1 - \color{blue}{\sqrt[3]{{x}^{\left(\frac{3}{n}\right)}}} \]
    10. Step-by-step derivation
      1. pow1/374.2%

        \[\leadsto 1 - \color{blue}{{\left({x}^{\left(\frac{3}{n}\right)}\right)}^{0.3333333333333333}} \]
      2. pow-pow68.9%

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

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

    if 5.99999999999999985e-290 < x < 5.9999999999999996e-190

    1. Initial program 30.7%

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

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

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

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

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

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

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

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

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

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

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

    if 5.9999999999999996e-190 < x < 3.5999999999999999e-88

    1. Initial program 54.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.5999999999999999e-88 < x < 1

    1. Initial program 37.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 26.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{x}}{n}} \]
      2. div-inv11.9%

        \[\leadsto \color{blue}{\frac{1}{x} \cdot \frac{1}{n}} \]
      3. rem-exp-log11.9%

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

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

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

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

        \[\leadsto e^{\sqrt{\color{blue}{\log x \cdot \log x}}} \cdot \frac{1}{n} \]
      8. sqrt-unprod0.0%

        \[\leadsto e^{\color{blue}{\sqrt{\log x} \cdot \sqrt{\log x}}} \cdot \frac{1}{n} \]
      9. add-sqr-sqrt6.3%

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

        \[\leadsto \color{blue}{x} \cdot \frac{1}{n} \]
      11. log1p-expm1-u54.0%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(x \cdot \frac{1}{n}\right)\right)} \]
      12. un-div-inv54.0%

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

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

    if 1 < x

    1. Initial program 66.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}} \]
    10. Step-by-step derivation
      1. unpow-prod-up99.2%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.6 \cdot 10^{-131}:\\ \;\;\;\;0\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-290}:\\ \;\;\;\;1 - {x}^{\left(\frac{3}{n} \cdot 0.3333333333333333\right)}\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-190}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-88}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{n}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{x}}{n}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 79.7% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 84.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}} \]
    10. Step-by-step derivation
      1. unpow-prod-up92.5%

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

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

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

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

    if -1.99999999999999998e-92 < (/.f64 #s(literal 1 binary64) n) < 2e-14

    1. Initial program 29.8%

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

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

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

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

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

    1. Initial program 42.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 52.8%

      \[\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)} \]
    4. Taylor expanded in n around inf 53.6%

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

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

Alternative 5: 72.6% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ \mathbf{if}\;x \leq -3.8 \cdot 10^{-131}:\\ \;\;\;\;0\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{-290}:\\ \;\;\;\;1 - {x}^{\left(\frac{3}{n} \cdot 0.3333333333333333\right)}\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{-189}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{-87}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{-14}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{x}}{n}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (/ (log x) (- n))))
   (if (<= x -3.8e-131)
     0.0
     (if (<= x 6.4e-290)
       (- 1.0 (pow x (* (/ 3.0 n) 0.3333333333333333)))
       (if (<= x 2.5e-189)
         t_0
         (if (<= x 1.15e-87)
           (/
            (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* n x)) (/ 0.5 n)) x))
            x)
           (if (<= x 5.8e-14) t_0 (/ (/ (pow x (/ 1.0 n)) x) n))))))))
double code(double x, double n) {
	double t_0 = log(x) / -n;
	double tmp;
	if (x <= -3.8e-131) {
		tmp = 0.0;
	} else if (x <= 6.4e-290) {
		tmp = 1.0 - pow(x, ((3.0 / n) * 0.3333333333333333));
	} else if (x <= 2.5e-189) {
		tmp = t_0;
	} else if (x <= 1.15e-87) {
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
	} else if (x <= 5.8e-14) {
		tmp = t_0;
	} else {
		tmp = (pow(x, (1.0 / n)) / x) / n;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: tmp
    t_0 = log(x) / -n
    if (x <= (-3.8d-131)) then
        tmp = 0.0d0
    else if (x <= 6.4d-290) then
        tmp = 1.0d0 - (x ** ((3.0d0 / n) * 0.3333333333333333d0))
    else if (x <= 2.5d-189) then
        tmp = t_0
    else if (x <= 1.15d-87) then
        tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) - (0.5d0 / n)) / x)) / x
    else if (x <= 5.8d-14) then
        tmp = t_0
    else
        tmp = ((x ** (1.0d0 / n)) / x) / n
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double t_0 = Math.log(x) / -n;
	double tmp;
	if (x <= -3.8e-131) {
		tmp = 0.0;
	} else if (x <= 6.4e-290) {
		tmp = 1.0 - Math.pow(x, ((3.0 / n) * 0.3333333333333333));
	} else if (x <= 2.5e-189) {
		tmp = t_0;
	} else if (x <= 1.15e-87) {
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
	} else if (x <= 5.8e-14) {
		tmp = t_0;
	} else {
		tmp = (Math.pow(x, (1.0 / n)) / x) / n;
	}
	return tmp;
}
def code(x, n):
	t_0 = math.log(x) / -n
	tmp = 0
	if x <= -3.8e-131:
		tmp = 0.0
	elif x <= 6.4e-290:
		tmp = 1.0 - math.pow(x, ((3.0 / n) * 0.3333333333333333))
	elif x <= 2.5e-189:
		tmp = t_0
	elif x <= 1.15e-87:
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x
	elif x <= 5.8e-14:
		tmp = t_0
	else:
		tmp = (math.pow(x, (1.0 / n)) / x) / n
	return tmp
function code(x, n)
	t_0 = Float64(log(x) / Float64(-n))
	tmp = 0.0
	if (x <= -3.8e-131)
		tmp = 0.0;
	elseif (x <= 6.4e-290)
		tmp = Float64(1.0 - (x ^ Float64(Float64(3.0 / n) * 0.3333333333333333)));
	elseif (x <= 2.5e-189)
		tmp = t_0;
	elseif (x <= 1.15e-87)
		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) - Float64(0.5 / n)) / x)) / x);
	elseif (x <= 5.8e-14)
		tmp = t_0;
	else
		tmp = Float64(Float64((x ^ Float64(1.0 / n)) / x) / n);
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = log(x) / -n;
	tmp = 0.0;
	if (x <= -3.8e-131)
		tmp = 0.0;
	elseif (x <= 6.4e-290)
		tmp = 1.0 - (x ^ ((3.0 / n) * 0.3333333333333333));
	elseif (x <= 2.5e-189)
		tmp = t_0;
	elseif (x <= 1.15e-87)
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
	elseif (x <= 5.8e-14)
		tmp = t_0;
	else
		tmp = ((x ^ (1.0 / n)) / x) / n;
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, -3.8e-131], 0.0, If[LessEqual[x, 6.4e-290], N[(1.0 - N[Power[x, N[(N[(3.0 / n), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.5e-189], t$95$0, If[LessEqual[x, 1.15e-87], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 5.8e-14], t$95$0, N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 6.4 \cdot 10^{-290}:\\
\;\;\;\;1 - {x}^{\left(\frac{3}{n} \cdot 0.3333333333333333\right)}\\

\mathbf{elif}\;x \leq 2.5 \cdot 10^{-189}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1.15 \cdot 10^{-87}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\

\mathbf{elif}\;x \leq 5.8 \cdot 10^{-14}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < -3.79999999999999995e-131

    1. Initial program 63.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 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.79999999999999995e-131 < x < 6.39999999999999976e-290

    1. Initial program 63.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 16.0%

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

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

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

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

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

      \[\leadsto \color{blue}{1 - {x}^{\left(\frac{1}{n}\right)}} \]
    6. Step-by-step derivation
      1. add-cbrt-cube63.6%

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

        \[\leadsto 1 - \sqrt[3]{\color{blue}{{\left({x}^{\left(\frac{1}{n}\right)}\right)}^{3}}} \]
      3. pow-pow74.2%

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

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

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

        \[\leadsto 1 - \sqrt[3]{{x}^{\left(\frac{\color{blue}{3}}{n}\right)}} \]
    9. Simplified74.2%

      \[\leadsto 1 - \color{blue}{\sqrt[3]{{x}^{\left(\frac{3}{n}\right)}}} \]
    10. Step-by-step derivation
      1. pow1/374.2%

        \[\leadsto 1 - \color{blue}{{\left({x}^{\left(\frac{3}{n}\right)}\right)}^{0.3333333333333333}} \]
      2. pow-pow68.9%

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

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

    if 6.39999999999999976e-290 < x < 2.4999999999999999e-189 or 1.1500000000000001e-87 < x < 5.8000000000000005e-14

    1. Initial program 31.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 31.6%

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

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

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

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

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

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

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

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

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

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

    if 2.4999999999999999e-189 < x < 1.1500000000000001e-87

    1. Initial program 53.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.8000000000000005e-14 < x

    1. Initial program 67.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}} \]
    10. Step-by-step derivation
      1. unpow-prod-up97.0%

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

        \[\leadsto \frac{{x}^{\left(\frac{1}{n}\right)} \cdot \color{blue}{\frac{1}{x}}}{n} \]
      3. div-inv97.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.8 \cdot 10^{-131}:\\ \;\;\;\;0\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{-290}:\\ \;\;\;\;1 - {x}^{\left(\frac{3}{n} \cdot 0.3333333333333333\right)}\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{-189}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{-87}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{-14}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{x}}{n}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 63.0% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ \mathbf{if}\;x \leq -1.25 \cdot 10^{-130}:\\ \;\;\;\;0\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-290}:\\ \;\;\;\;1 - {x}^{\left(\frac{3}{n} \cdot 0.3333333333333333\right)}\\ \mathbf{elif}\;x \leq 2.15 \cdot 10^{-190}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{-87}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.7:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{+42}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (/ (log x) (- n))))
   (if (<= x -1.25e-130)
     0.0
     (if (<= x 2.8e-290)
       (- 1.0 (pow x (* (/ 3.0 n) 0.3333333333333333)))
       (if (<= x 2.15e-190)
         t_0
         (if (<= x 1.2e-87)
           (/
            (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* n x)) (/ 0.5 n)) x))
            x)
           (if (<= x 0.7)
             t_0
             (if (<= x 5.2e+42)
               (/
                (/
                 (+
                  1.0
                  (/
                   (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5)
                   x))
                 x)
                n)
               0.0))))))))
double code(double x, double n) {
	double t_0 = log(x) / -n;
	double tmp;
	if (x <= -1.25e-130) {
		tmp = 0.0;
	} else if (x <= 2.8e-290) {
		tmp = 1.0 - pow(x, ((3.0 / n) * 0.3333333333333333));
	} else if (x <= 2.15e-190) {
		tmp = t_0;
	} else if (x <= 1.2e-87) {
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
	} else if (x <= 0.7) {
		tmp = t_0;
	} else if (x <= 5.2e+42) {
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / 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 <= (-1.25d-130)) then
        tmp = 0.0d0
    else if (x <= 2.8d-290) then
        tmp = 1.0d0 - (x ** ((3.0d0 / n) * 0.3333333333333333d0))
    else if (x <= 2.15d-190) then
        tmp = t_0
    else if (x <= 1.2d-87) then
        tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) - (0.5d0 / n)) / x)) / x
    else if (x <= 0.7d0) then
        tmp = t_0
    else if (x <= 5.2d+42) then
        tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / 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 <= -1.25e-130) {
		tmp = 0.0;
	} else if (x <= 2.8e-290) {
		tmp = 1.0 - Math.pow(x, ((3.0 / n) * 0.3333333333333333));
	} else if (x <= 2.15e-190) {
		tmp = t_0;
	} else if (x <= 1.2e-87) {
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
	} else if (x <= 0.7) {
		tmp = t_0;
	} else if (x <= 5.2e+42) {
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	t_0 = math.log(x) / -n
	tmp = 0
	if x <= -1.25e-130:
		tmp = 0.0
	elif x <= 2.8e-290:
		tmp = 1.0 - math.pow(x, ((3.0 / n) * 0.3333333333333333))
	elif x <= 2.15e-190:
		tmp = t_0
	elif x <= 1.2e-87:
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x
	elif x <= 0.7:
		tmp = t_0
	elif x <= 5.2e+42:
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	t_0 = Float64(log(x) / Float64(-n))
	tmp = 0.0
	if (x <= -1.25e-130)
		tmp = 0.0;
	elseif (x <= 2.8e-290)
		tmp = Float64(1.0 - (x ^ Float64(Float64(3.0 / n) * 0.3333333333333333)));
	elseif (x <= 2.15e-190)
		tmp = t_0;
	elseif (x <= 1.2e-87)
		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) - Float64(0.5 / n)) / x)) / x);
	elseif (x <= 0.7)
		tmp = t_0;
	elseif (x <= 5.2e+42)
		tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / 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 <= -1.25e-130)
		tmp = 0.0;
	elseif (x <= 2.8e-290)
		tmp = 1.0 - (x ^ ((3.0 / n) * 0.3333333333333333));
	elseif (x <= 2.15e-190)
		tmp = t_0;
	elseif (x <= 1.2e-87)
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
	elseif (x <= 0.7)
		tmp = t_0;
	elseif (x <= 5.2e+42)
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / 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, -1.25e-130], 0.0, If[LessEqual[x, 2.8e-290], N[(1.0 - N[Power[x, N[(N[(3.0 / n), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.15e-190], t$95$0, If[LessEqual[x, 1.2e-87], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.7], t$95$0, If[LessEqual[x, 5.2e+42], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 2.8 \cdot 10^{-290}:\\
\;\;\;\;1 - {x}^{\left(\frac{3}{n} \cdot 0.3333333333333333\right)}\\

\mathbf{elif}\;x \leq 2.15 \cdot 10^{-190}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1.2 \cdot 10^{-87}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\

\mathbf{elif}\;x \leq 0.7:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 5.2 \cdot 10^{+42}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < -1.2499999999999999e-130 or 5.1999999999999998e42 < x

    1. Initial program 70.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 48.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.2499999999999999e-130 < x < 2.79999999999999997e-290

    1. Initial program 63.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 16.0%

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

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

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

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

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

      \[\leadsto \color{blue}{1 - {x}^{\left(\frac{1}{n}\right)}} \]
    6. Step-by-step derivation
      1. add-cbrt-cube63.6%

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

        \[\leadsto 1 - \sqrt[3]{\color{blue}{{\left({x}^{\left(\frac{1}{n}\right)}\right)}^{3}}} \]
      3. pow-pow74.2%

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

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

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

        \[\leadsto 1 - \sqrt[3]{{x}^{\left(\frac{\color{blue}{3}}{n}\right)}} \]
    9. Simplified74.2%

      \[\leadsto 1 - \color{blue}{\sqrt[3]{{x}^{\left(\frac{3}{n}\right)}}} \]
    10. Step-by-step derivation
      1. pow1/374.2%

        \[\leadsto 1 - \color{blue}{{\left({x}^{\left(\frac{3}{n}\right)}\right)}^{0.3333333333333333}} \]
      2. pow-pow68.9%

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

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

    if 2.79999999999999997e-290 < x < 2.15e-190 or 1.2e-87 < x < 0.69999999999999996

    1. Initial program 34.4%

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

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

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

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

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

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

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

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

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

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

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

    if 2.15e-190 < x < 1.2e-87

    1. Initial program 53.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.69999999999999996 < x < 5.1999999999999998e42

    1. Initial program 20.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.25 \cdot 10^{-130}:\\ \;\;\;\;0\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-290}:\\ \;\;\;\;1 - {x}^{\left(\frac{3}{n} \cdot 0.3333333333333333\right)}\\ \mathbf{elif}\;x \leq 2.15 \cdot 10^{-190}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{-87}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.7:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{+42}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 63.1% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ \mathbf{if}\;x \leq -3.6 \cdot 10^{-131}:\\ \;\;\;\;0\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-290}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 1.38 \cdot 10^{-189}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{-88}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.7:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 5.3 \cdot 10^{+42}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (/ (log x) (- n))))
   (if (<= x -3.6e-131)
     0.0
     (if (<= x 6e-290)
       (- 1.0 (pow x (/ 1.0 n)))
       (if (<= x 1.38e-189)
         t_0
         (if (<= x 8.2e-88)
           (/
            (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* n x)) (/ 0.5 n)) x))
            x)
           (if (<= x 0.7)
             t_0
             (if (<= x 5.3e+42)
               (/
                (/
                 (+
                  1.0
                  (/
                   (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5)
                   x))
                 x)
                n)
               0.0))))))))
double code(double x, double n) {
	double t_0 = log(x) / -n;
	double tmp;
	if (x <= -3.6e-131) {
		tmp = 0.0;
	} else if (x <= 6e-290) {
		tmp = 1.0 - pow(x, (1.0 / n));
	} else if (x <= 1.38e-189) {
		tmp = t_0;
	} else if (x <= 8.2e-88) {
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
	} else if (x <= 0.7) {
		tmp = t_0;
	} else if (x <= 5.3e+42) {
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / 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 <= (-3.6d-131)) then
        tmp = 0.0d0
    else if (x <= 6d-290) then
        tmp = 1.0d0 - (x ** (1.0d0 / n))
    else if (x <= 1.38d-189) then
        tmp = t_0
    else if (x <= 8.2d-88) then
        tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) - (0.5d0 / n)) / x)) / x
    else if (x <= 0.7d0) then
        tmp = t_0
    else if (x <= 5.3d+42) then
        tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / 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 <= -3.6e-131) {
		tmp = 0.0;
	} else if (x <= 6e-290) {
		tmp = 1.0 - Math.pow(x, (1.0 / n));
	} else if (x <= 1.38e-189) {
		tmp = t_0;
	} else if (x <= 8.2e-88) {
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
	} else if (x <= 0.7) {
		tmp = t_0;
	} else if (x <= 5.3e+42) {
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	t_0 = math.log(x) / -n
	tmp = 0
	if x <= -3.6e-131:
		tmp = 0.0
	elif x <= 6e-290:
		tmp = 1.0 - math.pow(x, (1.0 / n))
	elif x <= 1.38e-189:
		tmp = t_0
	elif x <= 8.2e-88:
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x
	elif x <= 0.7:
		tmp = t_0
	elif x <= 5.3e+42:
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	t_0 = Float64(log(x) / Float64(-n))
	tmp = 0.0
	if (x <= -3.6e-131)
		tmp = 0.0;
	elseif (x <= 6e-290)
		tmp = Float64(1.0 - (x ^ Float64(1.0 / n)));
	elseif (x <= 1.38e-189)
		tmp = t_0;
	elseif (x <= 8.2e-88)
		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) - Float64(0.5 / n)) / x)) / x);
	elseif (x <= 0.7)
		tmp = t_0;
	elseif (x <= 5.3e+42)
		tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / 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 <= -3.6e-131)
		tmp = 0.0;
	elseif (x <= 6e-290)
		tmp = 1.0 - (x ^ (1.0 / n));
	elseif (x <= 1.38e-189)
		tmp = t_0;
	elseif (x <= 8.2e-88)
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
	elseif (x <= 0.7)
		tmp = t_0;
	elseif (x <= 5.3e+42)
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / 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, -3.6e-131], 0.0, If[LessEqual[x, 6e-290], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.38e-189], t$95$0, If[LessEqual[x, 8.2e-88], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.7], t$95$0, If[LessEqual[x, 5.3e+42], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 6 \cdot 10^{-290}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\

\mathbf{elif}\;x \leq 1.38 \cdot 10^{-189}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 8.2 \cdot 10^{-88}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\

\mathbf{elif}\;x \leq 0.7:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 5.3 \cdot 10^{+42}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < -3.5999999999999999e-131 or 5.30000000000000028e42 < x

    1. Initial program 70.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 48.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.5999999999999999e-131 < x < 5.99999999999999985e-290

    1. Initial program 63.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 16.0%

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

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

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

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

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

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

    if 5.99999999999999985e-290 < x < 1.3800000000000001e-189 or 8.2000000000000002e-88 < x < 0.69999999999999996

    1. Initial program 34.4%

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

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

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

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

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

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

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

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

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

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

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

    if 1.3800000000000001e-189 < x < 8.2000000000000002e-88

    1. Initial program 53.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.69999999999999996 < x < 5.30000000000000028e42

    1. Initial program 20.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.6 \cdot 10^{-131}:\\ \;\;\;\;0\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-290}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 1.38 \cdot 10^{-189}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{-88}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.7:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 5.3 \cdot 10^{+42}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 60.1% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ \mathbf{if}\;x \leq -1 \cdot 10^{-309}:\\ \;\;\;\;0\\ \mathbf{elif}\;x \leq 2.15 \cdot 10^{-190}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 8.8 \cdot 10^{-88}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.7:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 4.7 \cdot 10^{+42}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (/ (log x) (- n))))
   (if (<= x -1e-309)
     0.0
     (if (<= x 2.15e-190)
       t_0
       (if (<= x 8.8e-88)
         (/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* n x)) (/ 0.5 n)) x)) x)
         (if (<= x 0.7)
           t_0
           (if (<= x 4.7e+42)
             (/
              (/
               (+
                1.0
                (/ (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5) x))
               x)
              n)
             0.0)))))))
double code(double x, double n) {
	double t_0 = log(x) / -n;
	double tmp;
	if (x <= -1e-309) {
		tmp = 0.0;
	} else if (x <= 2.15e-190) {
		tmp = t_0;
	} else if (x <= 8.8e-88) {
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
	} else if (x <= 0.7) {
		tmp = t_0;
	} else if (x <= 4.7e+42) {
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / 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 <= (-1d-309)) then
        tmp = 0.0d0
    else if (x <= 2.15d-190) then
        tmp = t_0
    else if (x <= 8.8d-88) then
        tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) - (0.5d0 / n)) / x)) / x
    else if (x <= 0.7d0) then
        tmp = t_0
    else if (x <= 4.7d+42) then
        tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / 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 <= -1e-309) {
		tmp = 0.0;
	} else if (x <= 2.15e-190) {
		tmp = t_0;
	} else if (x <= 8.8e-88) {
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
	} else if (x <= 0.7) {
		tmp = t_0;
	} else if (x <= 4.7e+42) {
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	t_0 = math.log(x) / -n
	tmp = 0
	if x <= -1e-309:
		tmp = 0.0
	elif x <= 2.15e-190:
		tmp = t_0
	elif x <= 8.8e-88:
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x
	elif x <= 0.7:
		tmp = t_0
	elif x <= 4.7e+42:
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	t_0 = Float64(log(x) / Float64(-n))
	tmp = 0.0
	if (x <= -1e-309)
		tmp = 0.0;
	elseif (x <= 2.15e-190)
		tmp = t_0;
	elseif (x <= 8.8e-88)
		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) - Float64(0.5 / n)) / x)) / x);
	elseif (x <= 0.7)
		tmp = t_0;
	elseif (x <= 4.7e+42)
		tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / 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 <= -1e-309)
		tmp = 0.0;
	elseif (x <= 2.15e-190)
		tmp = t_0;
	elseif (x <= 8.8e-88)
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
	elseif (x <= 0.7)
		tmp = t_0;
	elseif (x <= 4.7e+42)
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / 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, -1e-309], 0.0, If[LessEqual[x, 2.15e-190], t$95$0, If[LessEqual[x, 8.8e-88], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.7], t$95$0, If[LessEqual[x, 4.7e+42], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 2.15 \cdot 10^{-190}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 8.8 \cdot 10^{-88}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\

\mathbf{elif}\;x \leq 0.7:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 4.7 \cdot 10^{+42}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.000000000000002e-309 or 4.69999999999999986e42 < x

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.000000000000002e-309 < x < 2.15e-190 or 8.8000000000000002e-88 < x < 0.69999999999999996

    1. Initial program 36.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 34.1%

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

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

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

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

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

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

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

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

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

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

    if 2.15e-190 < x < 8.8000000000000002e-88

    1. Initial program 53.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.69999999999999996 < x < 4.69999999999999986e42

    1. Initial program 20.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{-309}:\\ \;\;\;\;0\\ \mathbf{elif}\;x \leq 2.15 \cdot 10^{-190}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 8.8 \cdot 10^{-88}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.7:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 4.7 \cdot 10^{+42}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 53.3% accurate, 7.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 7.2 \cdot 10^{-290}:\\ \;\;\;\;0\\ \mathbf{elif}\;x \leq 4.1 \cdot 10^{+42}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= x 7.2e-290)
   0.0
   (if (<= x 4.1e+42)
     (/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* n x)) (/ 0.5 n)) x)) x)
     0.0)))
double code(double x, double n) {
	double tmp;
	if (x <= 7.2e-290) {
		tmp = 0.0;
	} else if (x <= 4.1e+42) {
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (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) :: tmp
    if (x <= 7.2d-290) then
        tmp = 0.0d0
    else if (x <= 4.1d+42) then
        tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) - (0.5d0 / n)) / x)) / x
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double tmp;
	if (x <= 7.2e-290) {
		tmp = 0.0;
	} else if (x <= 4.1e+42) {
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if x <= 7.2e-290:
		tmp = 0.0
	elif x <= 4.1e+42:
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	tmp = 0.0
	if (x <= 7.2e-290)
		tmp = 0.0;
	elseif (x <= 4.1e+42)
		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) - Float64(0.5 / n)) / x)) / x);
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(x, n)
	tmp = 0.0;
	if (x <= 7.2e-290)
		tmp = 0.0;
	elseif (x <= 4.1e+42)
		tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) - (0.5 / n)) / x)) / x;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[x_, n_] := If[LessEqual[x, 7.2e-290], 0.0, If[LessEqual[x, 4.1e+42], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.2 \cdot 10^{-290}:\\
\;\;\;\;0\\

\mathbf{elif}\;x \leq 4.1 \cdot 10^{+42}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} - \frac{0.5}{n}}{x}}{x}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 7.19999999999999959e-290 or 4.1e42 < x

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

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

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

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

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

        \[\leadsto e^{-\frac{\color{blue}{-\log x}}{n}} - {x}^{\left(\frac{1}{n}\right)} \]
      5. distribute-frac-neg40.9%

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

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

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

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

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

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

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

    if 7.19999999999999959e-290 < x < 4.1e42

    1. Initial program 39.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 49.5% accurate, 14.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -2.8 \cdot 10^{-6} \lor \neg \left(n \leq 3.6 \cdot 10^{-56}\right):\\ \;\;\;\;\frac{\frac{1}{n}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (or (<= n -2.8e-6) (not (<= n 3.6e-56))) (/ (/ 1.0 n) x) 0.0))
double code(double x, double n) {
	double tmp;
	if ((n <= -2.8e-6) || !(n <= 3.6e-56)) {
		tmp = (1.0 / n) / x;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: tmp
    if ((n <= (-2.8d-6)) .or. (.not. (n <= 3.6d-56))) then
        tmp = (1.0d0 / n) / x
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double tmp;
	if ((n <= -2.8e-6) || !(n <= 3.6e-56)) {
		tmp = (1.0 / n) / x;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if (n <= -2.8e-6) or not (n <= 3.6e-56):
		tmp = (1.0 / n) / x
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	tmp = 0.0
	if ((n <= -2.8e-6) || !(n <= 3.6e-56))
		tmp = Float64(Float64(1.0 / n) / x);
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(x, n)
	tmp = 0.0;
	if ((n <= -2.8e-6) || ~((n <= 3.6e-56)))
		tmp = (1.0 / n) / x;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[x_, n_] := If[Or[LessEqual[n, -2.8e-6], N[Not[LessEqual[n, 3.6e-56]], $MachinePrecision]], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.8 \cdot 10^{-6} \lor \neg \left(n \leq 3.6 \cdot 10^{-56}\right):\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -2.79999999999999987e-6 or 3.59999999999999978e-56 < n

    1. Initial program 31.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{n}}{x}} \]
    12. Simplified45.8%

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

    if -2.79999999999999987e-6 < n < 3.59999999999999978e-56

    1. Initial program 76.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 inf 22.3%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.8 \cdot 10^{-6} \lor \neg \left(n \leq 3.6 \cdot 10^{-56}\right):\\ \;\;\;\;\frac{\frac{1}{n}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 49.5% accurate, 14.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.8 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\

\mathbf{elif}\;n \leq 3.2 \cdot 10^{-56}:\\
\;\;\;\;0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -2.79999999999999987e-6

    1. Initial program 22.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.79999999999999987e-6 < n < 3.19999999999999986e-56

    1. Initial program 76.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 inf 22.3%

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.19999999999999986e-56 < n

    1. Initial program 39.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 45.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. log-rec45.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{n}}{x}} \]
    12. Simplified45.8%

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

Alternative 12: 49.3% accurate, 14.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.05 \cdot 10^{-298}:\\
\;\;\;\;0\\

\mathbf{elif}\;x \leq 4.9 \cdot 10^{+42}:\\
\;\;\;\;\frac{1}{n \cdot x}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 3.05000000000000006e-298 or 4.9000000000000002e42 < x

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.05000000000000006e-298 < x < 4.9000000000000002e42

    1. Initial program 39.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 40.3% 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 54.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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