2nthrt (problem 3.4.6)

Percentage Accurate: 53.9% → 85.3%
Time: 40.6s
Alternatives: 16
Speedup: 1.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 16 alternatives:

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

Initial Program: 53.9% accurate, 1.0× speedup?

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

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

Alternative 1: 85.3% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;\frac{1}{n} \leq -0.0005:\\ \;\;\;\;\frac{\frac{t\_0}{n}}{x}\\ \mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-22}:\\ \;\;\;\;\frac{\log \left(\frac{x}{1 + 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) -0.0005)
     (/ (/ t_0 n) x)
     (if (<= (/ 1.0 n) 2e-22)
       (/ (log (/ x (+ 1.0 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) <= -0.0005) {
		tmp = (t_0 / n) / x;
	} else if ((1.0 / n) <= 2e-22) {
		tmp = log((x / (1.0 + 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) <= -0.0005) {
		tmp = (t_0 / n) / x;
	} else if ((1.0 / n) <= 2e-22) {
		tmp = Math.log((x / (1.0 + 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) <= -0.0005:
		tmp = (t_0 / n) / x
	elif (1.0 / n) <= 2e-22:
		tmp = math.log((x / (1.0 + 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) <= -0.0005)
		tmp = Float64(Float64(t_0 / n) / x);
	elseif (Float64(1.0 / n) <= 2e-22)
		tmp = Float64(log(Float64(x / Float64(1.0 + x))) / Float64(-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], -0.0005], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-22], N[(N[Log[N[(x / N[(1.0 + 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 -0.0005:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\

\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-22}:\\
\;\;\;\;\frac{\log \left(\frac{x}{1 + 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) < -5.0000000000000001e-4

    1. Initial program 98.7%

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

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

        \[\leadsto \color{blue}{{\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}} \]
      3. pow-to-exp98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.0000000000000001e-4 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-22

    1. Initial program 31.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{0} - \log \left(\frac{x}{x + 1}\right)}{n} \]
    11. Applied egg-rr79.3%

      \[\leadsto \frac{\color{blue}{0 - \log \left(\frac{x}{x + 1}\right)}}{n} \]
    12. Step-by-step derivation
      1. neg-sub079.3%

        \[\leadsto \frac{\color{blue}{-\log \left(\frac{x}{x + 1}\right)}}{n} \]
    13. Simplified79.3%

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

    if 2.0000000000000001e-22 < (/.f64 #s(literal 1 binary64) n)

    1. Initial program 64.3%

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

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

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

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

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

Alternative 2: 81.8% accurate, 1.6× speedup?

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

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

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


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

    1. Initial program 98.7%

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

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

        \[\leadsto \color{blue}{{\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}} \]
      3. pow-to-exp98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.0000000000000001e-4 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-22

    1. Initial program 31.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{0} - \log \left(\frac{x}{x + 1}\right)}{n} \]
    11. Applied egg-rr79.3%

      \[\leadsto \frac{\color{blue}{0 - \log \left(\frac{x}{x + 1}\right)}}{n} \]
    12. Step-by-step derivation
      1. neg-sub079.3%

        \[\leadsto \frac{\color{blue}{-\log \left(\frac{x}{x + 1}\right)}}{n} \]
    13. Simplified79.3%

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

    if 2.0000000000000001e-22 < (/.f64 #s(literal 1 binary64) n)

    1. Initial program 64.3%

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

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

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

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

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

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

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

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

Alternative 3: 80.4% accurate, 1.6× speedup?

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

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

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

\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+244}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\

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


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

    1. Initial program 98.7%

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

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

        \[\leadsto \color{blue}{{\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}} \]
      3. pow-to-exp98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.0000000000000001e-4 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-22

    1. Initial program 31.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{0} - \log \left(\frac{x}{x + 1}\right)}{n} \]
    11. Applied egg-rr79.3%

      \[\leadsto \frac{\color{blue}{0 - \log \left(\frac{x}{x + 1}\right)}}{n} \]
    12. Step-by-step derivation
      1. neg-sub079.3%

        \[\leadsto \frac{\color{blue}{-\log \left(\frac{x}{x + 1}\right)}}{n} \]
    13. Simplified79.3%

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

    if 2.0000000000000001e-22 < (/.f64 #s(literal 1 binary64) n) < 4.0000000000000003e244

    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 0 70.8%

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

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

    1. Initial program 3.1%

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

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

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

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

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

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

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

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

Alternative 4: 80.4% accurate, 1.7× speedup?

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

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

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

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+234}:\\
\;\;\;\;1 - t\_0\\

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


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

    1. Initial program 98.7%

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

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

        \[\leadsto \color{blue}{{\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}} \]
      3. pow-to-exp98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.0000000000000001e-4 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-22

    1. Initial program 31.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{0} - \log \left(\frac{x}{x + 1}\right)}{n} \]
    11. Applied egg-rr79.3%

      \[\leadsto \frac{\color{blue}{0 - \log \left(\frac{x}{x + 1}\right)}}{n} \]
    12. Step-by-step derivation
      1. neg-sub079.3%

        \[\leadsto \frac{\color{blue}{-\log \left(\frac{x}{x + 1}\right)}}{n} \]
    13. Simplified79.3%

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

    if 2.0000000000000001e-22 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000003e234

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

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

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

    1. Initial program 17.0%

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

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

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

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

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

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

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

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

Alternative 5: 65.6% accurate, 1.7× speedup?

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

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

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

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+234}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 #s(literal 1 binary64) n) < -1e167 or 2.0000000000000001e-22 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000003e234

    1. Initial program 90.0%

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

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

    if -1e167 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-22

    1. Initial program 47.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 17.0%

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

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

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

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

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

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

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

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

Alternative 6: 65.5% accurate, 1.7× speedup?

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

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

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

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+234}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 #s(literal 1 binary64) n) < -1e167 or 2.0000000000000001e-22 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000003e234

    1. Initial program 90.0%

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

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

    if -1e167 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-22

    1. Initial program 47.1%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 17.0%

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

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

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

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

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

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

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

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

Alternative 7: 59.0% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1.26 \cdot 10^{-266}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{-223}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+45}:\\ \;\;\;\;\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
 (if (<= x 1.26e-266)
   (/ (log x) (- n))
   (if (<= x 6.5e-223)
     (- 1.0 (pow x (/ 1.0 n)))
     (if (<= x 0.88)
       (/ (- x (log x)) n)
       (if (<= x 6.5e+45)
         (/
          (/
           (+
            1.0
            (/ (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5) x))
           x)
          n)
         0.0)))))
double code(double x, double n) {
	double tmp;
	if (x <= 1.26e-266) {
		tmp = log(x) / -n;
	} else if (x <= 6.5e-223) {
		tmp = 1.0 - pow(x, (1.0 / n));
	} else if (x <= 0.88) {
		tmp = (x - log(x)) / n;
	} else if (x <= 6.5e+45) {
		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) :: tmp
    if (x <= 1.26d-266) then
        tmp = log(x) / -n
    else if (x <= 6.5d-223) then
        tmp = 1.0d0 - (x ** (1.0d0 / n))
    else if (x <= 0.88d0) then
        tmp = (x - log(x)) / n
    else if (x <= 6.5d+45) 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 tmp;
	if (x <= 1.26e-266) {
		tmp = Math.log(x) / -n;
	} else if (x <= 6.5e-223) {
		tmp = 1.0 - Math.pow(x, (1.0 / n));
	} else if (x <= 0.88) {
		tmp = (x - Math.log(x)) / n;
	} else if (x <= 6.5e+45) {
		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):
	tmp = 0
	if x <= 1.26e-266:
		tmp = math.log(x) / -n
	elif x <= 6.5e-223:
		tmp = 1.0 - math.pow(x, (1.0 / n))
	elif x <= 0.88:
		tmp = (x - math.log(x)) / n
	elif x <= 6.5e+45:
		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)
	tmp = 0.0
	if (x <= 1.26e-266)
		tmp = Float64(log(x) / Float64(-n));
	elseif (x <= 6.5e-223)
		tmp = Float64(1.0 - (x ^ Float64(1.0 / n)));
	elseif (x <= 0.88)
		tmp = Float64(Float64(x - log(x)) / n);
	elseif (x <= 6.5e+45)
		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)
	tmp = 0.0;
	if (x <= 1.26e-266)
		tmp = log(x) / -n;
	elseif (x <= 6.5e-223)
		tmp = 1.0 - (x ^ (1.0 / n));
	elseif (x <= 0.88)
		tmp = (x - log(x)) / n;
	elseif (x <= 6.5e+45)
		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_] := If[LessEqual[x, 1.26e-266], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 6.5e-223], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.88], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 6.5e+45], 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}
\mathbf{if}\;x \leq 1.26 \cdot 10^{-266}:\\
\;\;\;\;\frac{\log x}{-n}\\

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

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

\mathbf{elif}\;x \leq 6.5 \cdot 10^{+45}:\\
\;\;\;\;\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.26000000000000008e-266

    1. Initial program 40.0%

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

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

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

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

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

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

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

    if 1.26000000000000008e-266 < x < 6.4999999999999996e-223

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

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

    if 6.4999999999999996e-223 < x < 0.880000000000000004

    1. Initial program 36.2%

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

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

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

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

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

    if 0.880000000000000004 < x < 6.50000000000000034e45

    1. Initial program 21.0%

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

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

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

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

      \[\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} \]

    if 6.50000000000000034e45 < x

    1. Initial program 78.3%

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

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

      \[\leadsto 1 - \color{blue}{1} \]
    5. Step-by-step derivation
      1. metadata-eval78.3%

        \[\leadsto \color{blue}{0} \]
    6. Applied egg-rr78.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.26 \cdot 10^{-266}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{-223}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+45}:\\ \;\;\;\;\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: 58.7% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.88:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 1.95 \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
 (if (<= x 0.88)
   (/ (- x (log x)) n)
   (if (<= x 1.95e+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 tmp;
	if (x <= 0.88) {
		tmp = (x - log(x)) / n;
	} else if (x <= 1.95e+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) :: tmp
    if (x <= 0.88d0) then
        tmp = (x - log(x)) / n
    else if (x <= 1.95d+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 tmp;
	if (x <= 0.88) {
		tmp = (x - Math.log(x)) / n;
	} else if (x <= 1.95e+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):
	tmp = 0
	if x <= 0.88:
		tmp = (x - math.log(x)) / n
	elif x <= 1.95e+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)
	tmp = 0.0
	if (x <= 0.88)
		tmp = Float64(Float64(x - log(x)) / n);
	elseif (x <= 1.95e+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)
	tmp = 0.0;
	if (x <= 0.88)
		tmp = (x - log(x)) / n;
	elseif (x <= 1.95e+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_] := If[LessEqual[x, 0.88], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 1.95e+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}
\mathbf{if}\;x \leq 0.88:\\
\;\;\;\;\frac{x - \log x}{n}\\

\mathbf{elif}\;x \leq 1.95 \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 3 regimes
  2. if x < 0.880000000000000004

    1. Initial program 42.1%

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

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

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

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

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

    if 0.880000000000000004 < x < 1.94999999999999985e42

    1. Initial program 21.0%

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

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

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

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

      \[\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} \]

    if 1.94999999999999985e42 < x

    1. Initial program 78.3%

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

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

      \[\leadsto 1 - \color{blue}{1} \]
    5. Step-by-step derivation
      1. metadata-eval78.3%

        \[\leadsto \color{blue}{0} \]
    6. Applied egg-rr78.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.88:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 1.95 \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: 58.6% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.7:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{+44}:\\ \;\;\;\;\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
 (if (<= x 0.7)
   (/ (log x) (- n))
   (if (<= x 1.8e+44)
     (/
      (/
       (+ 1.0 (/ (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5) x))
       x)
      n)
     0.0)))
double code(double x, double n) {
	double tmp;
	if (x <= 0.7) {
		tmp = log(x) / -n;
	} else if (x <= 1.8e+44) {
		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) :: tmp
    if (x <= 0.7d0) then
        tmp = log(x) / -n
    else if (x <= 1.8d+44) 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 tmp;
	if (x <= 0.7) {
		tmp = Math.log(x) / -n;
	} else if (x <= 1.8e+44) {
		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):
	tmp = 0
	if x <= 0.7:
		tmp = math.log(x) / -n
	elif x <= 1.8e+44:
		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)
	tmp = 0.0
	if (x <= 0.7)
		tmp = Float64(log(x) / Float64(-n));
	elseif (x <= 1.8e+44)
		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)
	tmp = 0.0;
	if (x <= 0.7)
		tmp = log(x) / -n;
	elseif (x <= 1.8e+44)
		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_] := If[LessEqual[x, 0.7], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 1.8e+44], 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}
\mathbf{if}\;x \leq 0.7:\\
\;\;\;\;\frac{\log x}{-n}\\

\mathbf{elif}\;x \leq 1.8 \cdot 10^{+44}:\\
\;\;\;\;\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 3 regimes
  2. if x < 0.69999999999999996

    1. Initial program 42.1%

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

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

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

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

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

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

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

    if 0.69999999999999996 < x < 1.8e44

    1. Initial program 21.0%

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

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

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

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

      \[\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} \]

    if 1.8e44 < x

    1. Initial program 78.3%

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

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

      \[\leadsto 1 - \color{blue}{1} \]
    5. Step-by-step derivation
      1. metadata-eval78.3%

        \[\leadsto \color{blue}{0} \]
    6. Applied egg-rr78.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.7:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{+44}:\\ \;\;\;\;\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 10: 49.5% accurate, 10.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.5 \cdot 10^{+45}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x} + -0.5}{n \cdot x}}{x}\\

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


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

    1. Initial program 40.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{n} + \color{blue}{\frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{n \cdot x}}}{x} \]
      11. sub-neg33.2%

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

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

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

        \[\leadsto \frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x} + \color{blue}{-0.5}}{n \cdot x}}{x} \]
      15. *-commutative33.2%

        \[\leadsto \frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x} + -0.5}{\color{blue}{x \cdot n}}}{x} \]
    12. Simplified33.2%

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

    if 6.50000000000000034e45 < x

    1. Initial program 78.3%

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

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

      \[\leadsto 1 - \color{blue}{1} \]
    5. Step-by-step derivation
      1. metadata-eval78.3%

        \[\leadsto \color{blue}{0} \]
    6. Applied egg-rr78.3%

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

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

Alternative 11: 49.5% accurate, 11.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.5 \cdot 10^{+44}:\\
\;\;\;\;\frac{\frac{-1 + \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{n}}{-x}\\

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


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

    1. Initial program 40.0%

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

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

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

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

      \[\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. Taylor expanded in n around 0 33.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot \frac{\frac{\frac{\frac{-0.3333333333333333}{x} + 0.5}{x} + \color{blue}{-1}}{n}}{x} \]
    9. Simplified33.1%

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

    if 8.5e44 < x

    1. Initial program 78.3%

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

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

      \[\leadsto 1 - \color{blue}{1} \]
    5. Step-by-step derivation
      1. metadata-eval78.3%

        \[\leadsto \color{blue}{0} \]
    6. Applied egg-rr78.3%

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

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

Alternative 12: 49.5% accurate, 11.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.1 \cdot 10^{+45}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333}{x} + -0.5}{x}}{x}}{n}\\

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


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

    1. Initial program 40.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1 + \color{blue}{\frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x}}}{x}}{n} \]
      9. sub-neg33.1%

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

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

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

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

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

    if 2.09999999999999995e45 < x

    1. Initial program 78.3%

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

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

      \[\leadsto 1 - \color{blue}{1} \]
    5. Step-by-step derivation
      1. metadata-eval78.3%

        \[\leadsto \color{blue}{0} \]
    6. Applied egg-rr78.3%

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

Alternative 13: 49.4% accurate, 11.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.05 \cdot 10^{+46}:\\
\;\;\;\;\frac{1 + \frac{\frac{0.3333333333333333}{x} - 0.5}{x}}{n \cdot x}\\

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


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

    1. Initial program 40.0%

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

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

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

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

      \[\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. Taylor expanded in n around -inf 32.9%

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

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

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

        \[\leadsto \frac{1 - \frac{0.5 - \color{blue}{\frac{0.3333333333333333 \cdot 1}{x}}}{x}}{n \cdot x} \]
      4. metadata-eval32.9%

        \[\leadsto \frac{1 - \frac{0.5 - \frac{\color{blue}{0.3333333333333333}}{x}}{x}}{n \cdot x} \]
      5. *-commutative32.9%

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

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

    if 2.05e46 < x

    1. Initial program 78.3%

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

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

      \[\leadsto 1 - \color{blue}{1} \]
    5. Step-by-step derivation
      1. metadata-eval78.3%

        \[\leadsto \color{blue}{0} \]
    6. Applied egg-rr78.3%

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

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

Alternative 14: 45.6% accurate, 14.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -3.7 \lor \neg \left(n \leq -2.7 \cdot 10^{-167}\right):\\ \;\;\;\;\frac{\frac{1}{n}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (or (<= n -3.7) (not (<= n -2.7e-167))) (/ (/ 1.0 n) x) 0.0))
double code(double x, double n) {
	double tmp;
	if ((n <= -3.7) || !(n <= -2.7e-167)) {
		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 <= (-3.7d0)) .or. (.not. (n <= (-2.7d-167)))) 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 <= -3.7) || !(n <= -2.7e-167)) {
		tmp = (1.0 / n) / x;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if (n <= -3.7) or not (n <= -2.7e-167):
		tmp = (1.0 / n) / x
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	tmp = 0.0
	if ((n <= -3.7) || !(n <= -2.7e-167))
		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 <= -3.7) || ~((n <= -2.7e-167)))
		tmp = (1.0 / n) / x;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[x_, n_] := If[Or[LessEqual[n, -3.7], N[Not[LessEqual[n, -2.7e-167]], $MachinePrecision]], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.7 \lor \neg \left(n \leq -2.7 \cdot 10^{-167}\right):\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -3.7000000000000002 or -2.7000000000000001e-167 < n

    1. Initial program 44.3%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{n}}{x}} \]
    12. Simplified47.5%

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

    if -3.7000000000000002 < n < -2.7000000000000001e-167

    1. Initial program 100.0%

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

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

      \[\leadsto 1 - \color{blue}{1} \]
    5. Step-by-step derivation
      1. metadata-eval64.4%

        \[\leadsto \color{blue}{0} \]
    6. Applied egg-rr64.4%

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

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

Alternative 15: 45.0% accurate, 14.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -2.9 \lor \neg \left(n \leq -8.5 \cdot 10^{-168}\right):\\ \;\;\;\;\frac{1}{n \cdot x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (or (<= n -2.9) (not (<= n -8.5e-168))) (/ 1.0 (* n x)) 0.0))
double code(double x, double n) {
	double tmp;
	if ((n <= -2.9) || !(n <= -8.5e-168)) {
		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.9d0)) .or. (.not. (n <= (-8.5d-168)))) 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.9) || !(n <= -8.5e-168)) {
		tmp = 1.0 / (n * x);
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if (n <= -2.9) or not (n <= -8.5e-168):
		tmp = 1.0 / (n * x)
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	tmp = 0.0
	if ((n <= -2.9) || !(n <= -8.5e-168))
		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 ((n <= -2.9) || ~((n <= -8.5e-168)))
		tmp = 1.0 / (n * x);
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[x_, n_] := If[Or[LessEqual[n, -2.9], N[Not[LessEqual[n, -8.5e-168]], $MachinePrecision]], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.9 \lor \neg \left(n \leq -8.5 \cdot 10^{-168}\right):\\
\;\;\;\;\frac{1}{n \cdot x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -2.89999999999999991 or -8.4999999999999994e-168 < n

    1. Initial program 44.3%

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

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

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

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

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

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

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

    if -2.89999999999999991 < n < -8.4999999999999994e-168

    1. Initial program 100.0%

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

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

      \[\leadsto 1 - \color{blue}{1} \]
    5. Step-by-step derivation
      1. metadata-eval64.4%

        \[\leadsto \color{blue}{0} \]
    6. Applied egg-rr64.4%

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

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

Alternative 16: 30.9% 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.5%

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

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

    \[\leadsto 1 - \color{blue}{1} \]
  5. Step-by-step derivation
    1. metadata-eval33.1%

      \[\leadsto \color{blue}{0} \]
  6. Applied egg-rr33.1%

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

Reproduce

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