2nthrt (problem 3.4.6)

Percentage Accurate: 53.2% → 91.8%
Time: 1.0min
Alternatives: 21
Speedup: 1.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 21 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.2% 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: 91.8% accurate, 0.2× speedup?

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

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

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


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

    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 84.5%

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

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

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

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

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

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

    if 35000 < x

    1. Initial program 68.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 86.8% accurate, 0.2× speedup?

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

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

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


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

    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 84.5%

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

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

    if 28000 < x

    1. Initial program 68.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 85.4% accurate, 0.2× speedup?

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

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

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

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


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

    1. Initial program 98.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.99999999999999982e-6 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 2e-16

    1. Initial program 45.7%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 46.1%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 85.5% accurate, 0.2× speedup?

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

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

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

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


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

    1. Initial program 98.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.99999999999999982e-6 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 2e-16

    1. Initial program 45.7%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 46.1%

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

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

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

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

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

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

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

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

Alternative 5: 85.5% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-16}:\\
\;\;\;\;\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 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -1e-8

    1. Initial program 97.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1e-8 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 2e-16

    1. Initial program 45.6%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 46.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 0 46.1%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \leq -1 \cdot 10^{-8}:\\ \;\;\;\;\log \left(e^{1 - {x}^{\left(\frac{1}{n}\right)}}\right)\\ \mathbf{elif}\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \leq 2 \cdot 10^{-16}:\\ \;\;\;\;\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 6: 85.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\ \mathbf{if}\;t\_1 \leq -4 \cdot 10^{-6}:\\ \;\;\;\;\log \left(e \cdot e^{-e^{\frac{\log x}{n}}}\right)\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-16}:\\ \;\;\;\;\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))) (t_1 (- (pow (+ x 1.0) (/ 1.0 n)) t_0)))
   (if (<= t_1 -4e-6)
     (log (* E (exp (- (exp (/ (log x) n))))))
     (if (<= t_1 2e-16)
       (/ (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 t_1 = pow((x + 1.0), (1.0 / n)) - t_0;
	double tmp;
	if (t_1 <= -4e-6) {
		tmp = log((((double) M_E) * exp(-exp((log(x) / n)))));
	} else if (t_1 <= 2e-16) {
		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 t_1 = Math.pow((x + 1.0), (1.0 / n)) - t_0;
	double tmp;
	if (t_1 <= -4e-6) {
		tmp = Math.log((Math.E * Math.exp(-Math.exp((Math.log(x) / n)))));
	} else if (t_1 <= 2e-16) {
		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))
	t_1 = math.pow((x + 1.0), (1.0 / n)) - t_0
	tmp = 0
	if t_1 <= -4e-6:
		tmp = math.log((math.e * math.exp(-math.exp((math.log(x) / n)))))
	elif t_1 <= 2e-16:
		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)
	t_1 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0)
	tmp = 0.0
	if (t_1 <= -4e-6)
		tmp = log(Float64(exp(1) * exp(Float64(-exp(Float64(log(x) / n))))));
	elseif (t_1 <= 2e-16)
		tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n);
	else
		tmp = Float64(exp(Float64(log1p(x) / n)) - t_0);
	end
	return tmp
end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-6], N[Log[N[(E * N[Exp[(-N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 2e-16], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-16}:\\
\;\;\;\;\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 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -3.99999999999999982e-6

    1. Initial program 98.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.99999999999999982e-6 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 2e-16

    1. Initial program 45.7%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 46.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 0 46.1%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \leq -4 \cdot 10^{-6}:\\ \;\;\;\;\log \left(e \cdot e^{-e^{\frac{\log x}{n}}}\right)\\ \mathbf{elif}\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \leq 2 \cdot 10^{-16}:\\ \;\;\;\;\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 7: 82.2% accurate, 0.4× speedup?

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

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

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

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


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

    1. Initial program 97.2%

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

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

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

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

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

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

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

    if -1e-8 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 2e-16

    1. Initial program 45.6%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 46.1%

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

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

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

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

Alternative 8: 82.1% accurate, 0.4× speedup?

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

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

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

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


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

    1. Initial program 97.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1e-8 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 2e-16

    1. Initial program 45.6%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 46.1%

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

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

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

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

Alternative 9: 86.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.0003:\\ \;\;\;\;\frac{\frac{-0.16666666666666666 \cdot \frac{{\log x}^{3}}{n} + {\log x}^{2} \cdot -0.5}{n} - \log x}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (if (<= x 0.0003)
   (/
    (-
     (/
      (+
       (* -0.16666666666666666 (/ (pow (log x) 3.0) n))
       (* (pow (log x) 2.0) -0.5))
      n)
     (log x))
    n)
   (/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
	double tmp;
	if (x <= 0.0003) {
		tmp = ((((-0.16666666666666666 * (pow(log(x), 3.0) / n)) + (pow(log(x), 2.0) * -0.5)) / n) - log(x)) / n;
	} else {
		tmp = (pow(x, (1.0 / n)) / n) / x;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: tmp
    if (x <= 0.0003d0) then
        tmp = (((((-0.16666666666666666d0) * ((log(x) ** 3.0d0) / n)) + ((log(x) ** 2.0d0) * (-0.5d0))) / n) - log(x)) / n
    else
        tmp = ((x ** (1.0d0 / n)) / n) / x
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double tmp;
	if (x <= 0.0003) {
		tmp = ((((-0.16666666666666666 * (Math.pow(Math.log(x), 3.0) / n)) + (Math.pow(Math.log(x), 2.0) * -0.5)) / n) - Math.log(x)) / n;
	} else {
		tmp = (Math.pow(x, (1.0 / n)) / n) / x;
	}
	return tmp;
}
def code(x, n):
	tmp = 0
	if x <= 0.0003:
		tmp = ((((-0.16666666666666666 * (math.pow(math.log(x), 3.0) / n)) + (math.pow(math.log(x), 2.0) * -0.5)) / n) - math.log(x)) / n
	else:
		tmp = (math.pow(x, (1.0 / n)) / n) / x
	return tmp
function code(x, n)
	tmp = 0.0
	if (x <= 0.0003)
		tmp = Float64(Float64(Float64(Float64(Float64(-0.16666666666666666 * Float64((log(x) ^ 3.0) / n)) + Float64((log(x) ^ 2.0) * -0.5)) / n) - log(x)) / n);
	else
		tmp = Float64(Float64((x ^ Float64(1.0 / n)) / n) / x);
	end
	return tmp
end
function tmp_2 = code(x, n)
	tmp = 0.0;
	if (x <= 0.0003)
		tmp = ((((-0.16666666666666666 * ((log(x) ^ 3.0) / n)) + ((log(x) ^ 2.0) * -0.5)) / n) - log(x)) / n;
	else
		tmp = ((x ^ (1.0 / n)) / n) / x;
	end
	tmp_2 = tmp;
end
code[x_, n_] := If[LessEqual[x, 0.0003], N[(N[(N[(N[(N[(-0.16666666666666666 * N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0003:\\
\;\;\;\;\frac{\frac{-0.16666666666666666 \cdot \frac{{\log x}^{3}}{n} + {\log x}^{2} \cdot -0.5}{n} - \log x}{n}\\

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


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

    1. Initial program 35.4%

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

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

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

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

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

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

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

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

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

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

    if 2.99999999999999974e-4 < x

    1. Initial program 67.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 80.6% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\frac{1 + \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x}}{x}}{n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
t_2 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -0.2:\\
\;\;\;\;\frac{\frac{t\_1}{n}}{x}\\

\mathbf{elif}\;\frac{1}{n} \leq 10^{-142}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;\frac{1}{n} \leq 10^{-78}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-19}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+131}:\\
\;\;\;\;\left(1 - t\_1\right) + \frac{x}{n}\\

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


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

    1. Initial program 98.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.20000000000000001 < (/.f64 #s(literal 1 binary64) n) < 1e-142 or 9.99999999999999999e-79 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000004e-19

    1. Initial program 34.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 79.4%

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

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

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

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

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

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

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

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

    if 1e-142 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999999e-79 or 4.99999999999999995e131 < (/.f64 #s(literal 1 binary64) n)

    1. Initial program 26.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 30.0%

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

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

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

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

    if 5.0000000000000004e-19 < (/.f64 #s(literal 1 binary64) n) < 4.99999999999999995e131

    1. Initial program 78.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 80.7% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\frac{1 + \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x}}{x}}{n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
t_2 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -0.2:\\
\;\;\;\;\frac{\frac{t\_1}{n}}{x}\\

\mathbf{elif}\;\frac{1}{n} \leq 10^{-142}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;\frac{1}{n} \leq 10^{-78}:\\
\;\;\;\;t\_0\\

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

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

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


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

    1. Initial program 98.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.20000000000000001 < (/.f64 #s(literal 1 binary64) n) < 1e-142 or 9.99999999999999999e-79 < (/.f64 #s(literal 1 binary64) n) < 2e-8

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

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

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

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

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

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

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

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

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

    if 1e-142 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999999e-79 or 4.99999999999999995e131 < (/.f64 #s(literal 1 binary64) n)

    1. Initial program 26.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 30.0%

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

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

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

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

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

    1. Initial program 84.9%

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

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

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

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

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

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

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

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

Alternative 12: 67.0% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\frac{1 + \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x}}{x}}{n}\\
t_1 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq 10^{-142}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{1}{n} \leq 10^{-78}:\\
\;\;\;\;t\_0\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 #s(literal 1 binary64) n) < 1e-142 or 9.99999999999999999e-79 < (/.f64 #s(literal 1 binary64) n) < 2e-8

    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 n around inf 72.2%

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

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

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

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

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

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

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

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

    if 1e-142 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999999e-79 or 4.99999999999999995e131 < (/.f64 #s(literal 1 binary64) n)

    1. Initial program 26.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 30.0%

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

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

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

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

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

    1. Initial program 84.9%

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

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

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

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

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

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

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

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

Alternative 13: 60.9% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ t_1 := 1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;x \leq 1.85 \cdot 10^{-266}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 5.4 \cdot 10^{-217}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-176}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-152}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\ \mathbf{elif}\;x \leq 7.4 \cdot 10^{+135}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (/ (log x) (- n))) (t_1 (- 1.0 (pow x (/ 1.0 n)))))
   (if (<= x 1.85e-266)
     t_0
     (if (<= x 5.4e-217)
       t_1
       (if (<= x 1.4e-176)
         t_0
         (if (<= x 9e-152)
           t_1
           (if (<= x 0.88)
             (- (/ x n) (/ (log x) n))
             (if (<= x 7.4e+135)
               (/
                (/
                 (+
                  1.0
                  (/
                   (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5)
                   x))
                 x)
                n)
               0.0))))))))
double code(double x, double n) {
	double t_0 = log(x) / -n;
	double t_1 = 1.0 - pow(x, (1.0 / n));
	double tmp;
	if (x <= 1.85e-266) {
		tmp = t_0;
	} else if (x <= 5.4e-217) {
		tmp = t_1;
	} else if (x <= 1.4e-176) {
		tmp = t_0;
	} else if (x <= 9e-152) {
		tmp = t_1;
	} else if (x <= 0.88) {
		tmp = (x / n) - (log(x) / n);
	} else if (x <= 7.4e+135) {
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = log(x) / -n
    t_1 = 1.0d0 - (x ** (1.0d0 / n))
    if (x <= 1.85d-266) then
        tmp = t_0
    else if (x <= 5.4d-217) then
        tmp = t_1
    else if (x <= 1.4d-176) then
        tmp = t_0
    else if (x <= 9d-152) then
        tmp = t_1
    else if (x <= 0.88d0) then
        tmp = (x / n) - (log(x) / n)
    else if (x <= 7.4d+135) then
        tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double t_0 = Math.log(x) / -n;
	double t_1 = 1.0 - Math.pow(x, (1.0 / n));
	double tmp;
	if (x <= 1.85e-266) {
		tmp = t_0;
	} else if (x <= 5.4e-217) {
		tmp = t_1;
	} else if (x <= 1.4e-176) {
		tmp = t_0;
	} else if (x <= 9e-152) {
		tmp = t_1;
	} else if (x <= 0.88) {
		tmp = (x / n) - (Math.log(x) / n);
	} else if (x <= 7.4e+135) {
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	t_0 = math.log(x) / -n
	t_1 = 1.0 - math.pow(x, (1.0 / n))
	tmp = 0
	if x <= 1.85e-266:
		tmp = t_0
	elif x <= 5.4e-217:
		tmp = t_1
	elif x <= 1.4e-176:
		tmp = t_0
	elif x <= 9e-152:
		tmp = t_1
	elif x <= 0.88:
		tmp = (x / n) - (math.log(x) / n)
	elif x <= 7.4e+135:
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	t_0 = Float64(log(x) / Float64(-n))
	t_1 = Float64(1.0 - (x ^ Float64(1.0 / n)))
	tmp = 0.0
	if (x <= 1.85e-266)
		tmp = t_0;
	elseif (x <= 5.4e-217)
		tmp = t_1;
	elseif (x <= 1.4e-176)
		tmp = t_0;
	elseif (x <= 9e-152)
		tmp = t_1;
	elseif (x <= 0.88)
		tmp = Float64(Float64(x / n) - Float64(log(x) / n));
	elseif (x <= 7.4e+135)
		tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n);
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = log(x) / -n;
	t_1 = 1.0 - (x ^ (1.0 / n));
	tmp = 0.0;
	if (x <= 1.85e-266)
		tmp = t_0;
	elseif (x <= 5.4e-217)
		tmp = t_1;
	elseif (x <= 1.4e-176)
		tmp = t_0;
	elseif (x <= 9e-152)
		tmp = t_1;
	elseif (x <= 0.88)
		tmp = (x / n) - (log(x) / n);
	elseif (x <= 7.4e+135)
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.85e-266], t$95$0, If[LessEqual[x, 5.4e-217], t$95$1, If[LessEqual[x, 1.4e-176], t$95$0, If[LessEqual[x, 9e-152], t$95$1, If[LessEqual[x, 0.88], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.4e+135], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 5.4 \cdot 10^{-217}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 1.4 \cdot 10^{-176}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 9 \cdot 10^{-152}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \leq 7.4 \cdot 10^{+135}:\\
\;\;\;\;\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.8500000000000001e-266 or 5.40000000000000032e-217 < x < 1.4000000000000001e-176

    1. Initial program 20.8%

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

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

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

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

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

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

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

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

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

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

    if 1.8500000000000001e-266 < x < 5.40000000000000032e-217 or 1.4000000000000001e-176 < x < 9.0000000000000008e-152

    1. Initial program 64.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 64.6%

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

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

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

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

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

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

    if 9.0000000000000008e-152 < x < 0.880000000000000004

    1. Initial program 30.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 59.2%

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

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

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

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

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

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

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

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

    if 0.880000000000000004 < x < 7.39999999999999994e135

    1. Initial program 46.7%

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

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

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

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

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

    if 7.39999999999999994e135 < x

    1. Initial program 81.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \color{blue}{1} \]
      3. metadata-eval81.6%

        \[\leadsto \color{blue}{0} \]
    7. Simplified81.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.85 \cdot 10^{-266}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 5.4 \cdot 10^{-217}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-176}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-152}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\ \mathbf{elif}\;x \leq 7.4 \cdot 10^{+135}:\\ \;\;\;\;\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 14: 61.0% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ t_1 := 1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;x \leq 5.2 \cdot 10^{-267}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.32 \cdot 10^{-216}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{-176}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-152}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 4.9 \cdot 10^{+135}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (/ (log x) (- n))) (t_1 (- 1.0 (pow x (/ 1.0 n)))))
   (if (<= x 5.2e-267)
     t_0
     (if (<= x 1.32e-216)
       t_1
       (if (<= x 1.15e-176)
         t_0
         (if (<= x 9e-152)
           t_1
           (if (<= x 0.88)
             (/ (- x (log x)) n)
             (if (<= x 4.9e+135)
               (/
                (/
                 (+
                  1.0
                  (/
                   (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5)
                   x))
                 x)
                n)
               0.0))))))))
double code(double x, double n) {
	double t_0 = log(x) / -n;
	double t_1 = 1.0 - pow(x, (1.0 / n));
	double tmp;
	if (x <= 5.2e-267) {
		tmp = t_0;
	} else if (x <= 1.32e-216) {
		tmp = t_1;
	} else if (x <= 1.15e-176) {
		tmp = t_0;
	} else if (x <= 9e-152) {
		tmp = t_1;
	} else if (x <= 0.88) {
		tmp = (x - log(x)) / n;
	} else if (x <= 4.9e+135) {
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = log(x) / -n
    t_1 = 1.0d0 - (x ** (1.0d0 / n))
    if (x <= 5.2d-267) then
        tmp = t_0
    else if (x <= 1.32d-216) then
        tmp = t_1
    else if (x <= 1.15d-176) then
        tmp = t_0
    else if (x <= 9d-152) then
        tmp = t_1
    else if (x <= 0.88d0) then
        tmp = (x - log(x)) / n
    else if (x <= 4.9d+135) then
        tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double t_0 = Math.log(x) / -n;
	double t_1 = 1.0 - Math.pow(x, (1.0 / n));
	double tmp;
	if (x <= 5.2e-267) {
		tmp = t_0;
	} else if (x <= 1.32e-216) {
		tmp = t_1;
	} else if (x <= 1.15e-176) {
		tmp = t_0;
	} else if (x <= 9e-152) {
		tmp = t_1;
	} else if (x <= 0.88) {
		tmp = (x - Math.log(x)) / n;
	} else if (x <= 4.9e+135) {
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	t_0 = math.log(x) / -n
	t_1 = 1.0 - math.pow(x, (1.0 / n))
	tmp = 0
	if x <= 5.2e-267:
		tmp = t_0
	elif x <= 1.32e-216:
		tmp = t_1
	elif x <= 1.15e-176:
		tmp = t_0
	elif x <= 9e-152:
		tmp = t_1
	elif x <= 0.88:
		tmp = (x - math.log(x)) / n
	elif x <= 4.9e+135:
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	t_0 = Float64(log(x) / Float64(-n))
	t_1 = Float64(1.0 - (x ^ Float64(1.0 / n)))
	tmp = 0.0
	if (x <= 5.2e-267)
		tmp = t_0;
	elseif (x <= 1.32e-216)
		tmp = t_1;
	elseif (x <= 1.15e-176)
		tmp = t_0;
	elseif (x <= 9e-152)
		tmp = t_1;
	elseif (x <= 0.88)
		tmp = Float64(Float64(x - log(x)) / n);
	elseif (x <= 4.9e+135)
		tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n);
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = log(x) / -n;
	t_1 = 1.0 - (x ^ (1.0 / n));
	tmp = 0.0;
	if (x <= 5.2e-267)
		tmp = t_0;
	elseif (x <= 1.32e-216)
		tmp = t_1;
	elseif (x <= 1.15e-176)
		tmp = t_0;
	elseif (x <= 9e-152)
		tmp = t_1;
	elseif (x <= 0.88)
		tmp = (x - log(x)) / n;
	elseif (x <= 4.9e+135)
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 5.2e-267], t$95$0, If[LessEqual[x, 1.32e-216], t$95$1, If[LessEqual[x, 1.15e-176], t$95$0, If[LessEqual[x, 9e-152], t$95$1, If[LessEqual[x, 0.88], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 4.9e+135], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 1.32 \cdot 10^{-216}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 1.15 \cdot 10^{-176}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 9 \cdot 10^{-152}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \leq 4.9 \cdot 10^{+135}:\\
\;\;\;\;\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 < 5.2000000000000003e-267 or 1.31999999999999997e-216 < x < 1.1500000000000001e-176

    1. Initial program 20.8%

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

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

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

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

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

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

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

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

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

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

    if 5.2000000000000003e-267 < x < 1.31999999999999997e-216 or 1.1500000000000001e-176 < x < 9.0000000000000008e-152

    1. Initial program 64.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 64.6%

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

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

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

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

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

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

    if 9.0000000000000008e-152 < x < 0.880000000000000004

    1. Initial program 30.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 59.2%

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

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

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

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

    if 0.880000000000000004 < x < 4.9000000000000001e135

    1. Initial program 46.7%

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

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

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

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

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

    if 4.9000000000000001e135 < x

    1. Initial program 81.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \color{blue}{1} \]
      3. metadata-eval81.6%

        \[\leadsto \color{blue}{0} \]
    7. Simplified81.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5.2 \cdot 10^{-267}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 1.32 \cdot 10^{-216}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{-176}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-152}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 4.9 \cdot 10^{+135}:\\ \;\;\;\;\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 15: 60.6% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 2.9 \cdot 10^{-183}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 3.4 \cdot 10^{-160}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{0.3333333333333333 \cdot \frac{1}{x \cdot n} + 0.5 \cdot \frac{-1}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 8.4 \cdot 10^{+135}:\\ \;\;\;\;\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 2.9e-183)
   (/ (log x) (- n))
   (if (<= x 3.4e-160)
     (/
      (+
       (/ 1.0 n)
       (/ (+ (* 0.3333333333333333 (/ 1.0 (* x n))) (* 0.5 (/ -1.0 n))) x))
      x)
     (if (<= x 0.88)
       (/ (- x (log x)) n)
       (if (<= x 8.4e+135)
         (/
          (/
           (+
            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 <= 2.9e-183) {
		tmp = log(x) / -n;
	} else if (x <= 3.4e-160) {
		tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x;
	} else if (x <= 0.88) {
		tmp = (x - log(x)) / n;
	} else if (x <= 8.4e+135) {
		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 <= 2.9d-183) then
        tmp = log(x) / -n
    else if (x <= 3.4d-160) then
        tmp = ((1.0d0 / n) + (((0.3333333333333333d0 * (1.0d0 / (x * n))) + (0.5d0 * ((-1.0d0) / n))) / x)) / x
    else if (x <= 0.88d0) then
        tmp = (x - log(x)) / n
    else if (x <= 8.4d+135) 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 <= 2.9e-183) {
		tmp = Math.log(x) / -n;
	} else if (x <= 3.4e-160) {
		tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x;
	} else if (x <= 0.88) {
		tmp = (x - Math.log(x)) / n;
	} else if (x <= 8.4e+135) {
		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 <= 2.9e-183:
		tmp = math.log(x) / -n
	elif x <= 3.4e-160:
		tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x
	elif x <= 0.88:
		tmp = (x - math.log(x)) / n
	elif x <= 8.4e+135:
		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 <= 2.9e-183)
		tmp = Float64(log(x) / Float64(-n));
	elseif (x <= 3.4e-160)
		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / Float64(x * n))) + Float64(0.5 * Float64(-1.0 / n))) / x)) / x);
	elseif (x <= 0.88)
		tmp = Float64(Float64(x - log(x)) / n);
	elseif (x <= 8.4e+135)
		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 <= 2.9e-183)
		tmp = log(x) / -n;
	elseif (x <= 3.4e-160)
		tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x;
	elseif (x <= 0.88)
		tmp = (x - log(x)) / n;
	elseif (x <= 8.4e+135)
		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, 2.9e-183], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 3.4e-160], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 * N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.88], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 8.4e+135], 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 2.9 \cdot 10^{-183}:\\
\;\;\;\;\frac{\log x}{-n}\\

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

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

\mathbf{elif}\;x \leq 8.4 \cdot 10^{+135}:\\
\;\;\;\;\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 < 2.9e-183

    1. Initial program 39.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 39.6%

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

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

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

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

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

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

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

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

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

    if 2.9e-183 < x < 3.40000000000000021e-160

    1. Initial program 44.8%

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(x\right) - \log x}{n}} \]
    6. Taylor expanded in x around -inf 65.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}} \]

    if 3.40000000000000021e-160 < x < 0.880000000000000004

    1. Initial program 33.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 57.4%

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

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

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

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

    if 0.880000000000000004 < x < 8.40000000000000039e135

    1. Initial program 46.7%

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

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

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

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

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

    if 8.40000000000000039e135 < x

    1. Initial program 81.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \color{blue}{1} \]
      3. metadata-eval81.6%

        \[\leadsto \color{blue}{0} \]
    7. Simplified81.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.9 \cdot 10^{-183}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 3.4 \cdot 10^{-160}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{0.3333333333333333 \cdot \frac{1}{x \cdot n} + 0.5 \cdot \frac{-1}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.88:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 8.4 \cdot 10^{+135}:\\ \;\;\;\;\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 16: 60.4% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{-n}\\ \mathbf{if}\;x \leq 2.9 \cdot 10^{-183}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 2.05 \cdot 10^{-160}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{0.3333333333333333 \cdot \frac{1}{x \cdot n} + 0.5 \cdot \frac{-1}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.7:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 7 \cdot 10^{+135}:\\ \;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (/ (log x) (- n))))
   (if (<= x 2.9e-183)
     t_0
     (if (<= x 2.05e-160)
       (/
        (+
         (/ 1.0 n)
         (/ (+ (* 0.3333333333333333 (/ 1.0 (* x n))) (* 0.5 (/ -1.0 n))) x))
        x)
       (if (<= x 0.7)
         t_0
         (if (<= x 7e+135)
           (/
            (/
             (+
              1.0
              (/ (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5) x))
             x)
            n)
           0.0))))))
double code(double x, double n) {
	double t_0 = log(x) / -n;
	double tmp;
	if (x <= 2.9e-183) {
		tmp = t_0;
	} else if (x <= 2.05e-160) {
		tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x;
	} else if (x <= 0.7) {
		tmp = t_0;
	} else if (x <= 7e+135) {
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(x, n)
    real(8), intent (in) :: x
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: tmp
    t_0 = log(x) / -n
    if (x <= 2.9d-183) then
        tmp = t_0
    else if (x <= 2.05d-160) then
        tmp = ((1.0d0 / n) + (((0.3333333333333333d0 * (1.0d0 / (x * n))) + (0.5d0 * ((-1.0d0) / n))) / x)) / x
    else if (x <= 0.7d0) then
        tmp = t_0
    else if (x <= 7d+135) then
        tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double x, double n) {
	double t_0 = Math.log(x) / -n;
	double tmp;
	if (x <= 2.9e-183) {
		tmp = t_0;
	} else if (x <= 2.05e-160) {
		tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x;
	} else if (x <= 0.7) {
		tmp = t_0;
	} else if (x <= 7e+135) {
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, n):
	t_0 = math.log(x) / -n
	tmp = 0
	if x <= 2.9e-183:
		tmp = t_0
	elif x <= 2.05e-160:
		tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x
	elif x <= 0.7:
		tmp = t_0
	elif x <= 7e+135:
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n
	else:
		tmp = 0.0
	return tmp
function code(x, n)
	t_0 = Float64(log(x) / Float64(-n))
	tmp = 0.0
	if (x <= 2.9e-183)
		tmp = t_0;
	elseif (x <= 2.05e-160)
		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / Float64(x * n))) + Float64(0.5 * Float64(-1.0 / n))) / x)) / x);
	elseif (x <= 0.7)
		tmp = t_0;
	elseif (x <= 7e+135)
		tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n);
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(x, n)
	t_0 = log(x) / -n;
	tmp = 0.0;
	if (x <= 2.9e-183)
		tmp = t_0;
	elseif (x <= 2.05e-160)
		tmp = ((1.0 / n) + (((0.3333333333333333 * (1.0 / (x * n))) + (0.5 * (-1.0 / n))) / x)) / x;
	elseif (x <= 0.7)
		tmp = t_0;
	elseif (x <= 7e+135)
		tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 2.9e-183], t$95$0, If[LessEqual[x, 2.05e-160], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 * N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.7], t$95$0, If[LessEqual[x, 7e+135], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq 2.9 \cdot 10^{-183}:\\
\;\;\;\;t\_0\\

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < 2.9e-183 or 2.05000000000000001e-160 < x < 0.69999999999999996

    1. Initial program 35.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 34.9%

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

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

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

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

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

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

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

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

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

    if 2.9e-183 < x < 2.05000000000000001e-160

    1. Initial program 44.8%

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(x\right) - \log x}{n}} \]
    6. Taylor expanded in x around -inf 65.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}} \]

    if 0.69999999999999996 < x < 7.0000000000000005e135

    1. Initial program 46.7%

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

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

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

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

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

    if 7.0000000000000005e135 < x

    1. Initial program 81.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \color{blue}{1} \]
      3. metadata-eval81.6%

        \[\leadsto \color{blue}{0} \]
    7. Simplified81.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.9 \cdot 10^{-183}:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 2.05 \cdot 10^{-160}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{0.3333333333333333 \cdot \frac{1}{x \cdot n} + 0.5 \cdot \frac{-1}{n}}{x}}{x}\\ \mathbf{elif}\;x \leq 0.7:\\ \;\;\;\;\frac{\log x}{-n}\\ \mathbf{elif}\;x \leq 7 \cdot 10^{+135}:\\ \;\;\;\;\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 17: 48.2% accurate, 7.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -50000000:\\
\;\;\;\;0\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \color{blue}{1} \]
      3. metadata-eval60.3%

        \[\leadsto \color{blue}{0} \]
    7. Simplified60.3%

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

    if -5e7 < (/.f64 #s(literal 1 binary64) n)

    1. Initial program 35.8%

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{log1p}\left(x\right) - \log x}{n}} \]
    6. Taylor expanded in x around -inf 53.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}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification54.9%

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

Alternative 18: 48.2% accurate, 9.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -50000000:\\
\;\;\;\;0\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \color{blue}{1} \]
      3. metadata-eval60.3%

        \[\leadsto \color{blue}{0} \]
    7. Simplified60.3%

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

    if -5e7 < (/.f64 #s(literal 1 binary64) n)

    1. Initial program 35.8%

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

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

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

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

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

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

Alternative 19: 46.3% accurate, 14.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -2.39999999999999991 or -2.80000000000000025e-293 < n

    1. Initial program 36.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.39999999999999991 < n < -2.80000000000000025e-293

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \color{blue}{1} \]
      3. metadata-eval61.6%

        \[\leadsto \color{blue}{0} \]
    7. Simplified61.6%

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

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

Alternative 20: 46.6% accurate, 17.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -50000000:\\
\;\;\;\;0\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \color{blue}{1} \]
      3. metadata-eval60.3%

        \[\leadsto \color{blue}{0} \]
    7. Simplified60.3%

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

    if -5e7 < (/.f64 #s(literal 1 binary64) n)

    1. Initial program 35.8%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \leq -50000000:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{n}\\ \end{array} \]
  5. Add Preprocessing

Alternative 21: 31.0% accurate, 211.0× speedup?

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

\\
0
\end{array}
Derivation
  1. Initial program 51.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \log \color{blue}{1} \]
    3. metadata-eval34.3%

      \[\leadsto \color{blue}{0} \]
  7. Simplified34.3%

    \[\leadsto \color{blue}{0} \]
  8. Final simplification34.3%

    \[\leadsto 0 \]
  9. Add Preprocessing

Reproduce

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