2nthrt (problem 3.4.6)

Percentage Accurate: 53.4% → 86.2%
Time: 43.4s
Alternatives: 19
Speedup: 1.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

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

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

Alternative 1: 86.2% accurate, 0.1× speedup?

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

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

\mathbf{elif}\;n \leq 25:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -2.1e5

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

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

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

    if -2.1e5 < n < 25

    1. Initial program 81.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. pow-to-expN/A

        \[\leadsto \mathsf{\_.f64}\left(\left(e^{\log \left(x + 1\right) \cdot \frac{1}{n}}\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      2. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\log \left(x + 1\right) \cdot \frac{1}{n}\right)\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\frac{\log \left(x + 1\right)}{n}\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(x + 1\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(1 + x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      6. log1p-defineN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{log1p}\left(x\right)\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      7. log1p-lowering-log1p.f6499.9%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log1p.f64}\left(x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    4. Applied egg-rr99.9%

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

      \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\color{blue}{\left(\frac{x}{n}\right)}\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6499.9%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(x, n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    7. Simplified99.9%

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

    if 25 < n

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

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

      \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
    5. Applied egg-rr67.6%

      \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
    6. Taylor expanded in n around inf

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
    7. Step-by-step derivation
      1. log-lowering-log.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
      3. +-lowering-+.f6483.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
    8. Simplified83.4%

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

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

Alternative 2: 86.1% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;n \leq 25:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -6.2e7

    1. Initial program 34.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. flip--N/A

        \[\leadsto \frac{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \cdot {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \cdot {x}^{\left(\frac{1}{n}\right)}}{\color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + {x}^{\left(\frac{1}{n}\right)}}} \]
      2. clear-numN/A

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

        \[\leadsto \frac{1}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + {x}^{\left(\frac{1}{n}\right)}} \cdot \color{blue}{\left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \cdot {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \cdot {x}^{\left(\frac{1}{n}\right)}\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + {x}^{\left(\frac{1}{n}\right)}}\right), \color{blue}{\left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \cdot {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \cdot {x}^{\left(\frac{1}{n}\right)}\right)}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} + {x}^{\left(\frac{1}{n}\right)}\right)\right), \left(\color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \cdot {\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} - {x}^{\left(\frac{1}{n}\right)} \cdot {x}^{\left(\frac{1}{n}\right)}\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)}\right), \left({x}^{\left(\frac{1}{n}\right)}\right)\right)\right), \left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \cdot \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} - {x}^{\left(\frac{1}{n}\right)} \cdot {x}^{\left(\frac{1}{n}\right)}\right)\right) \]
      7. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{pow.f64}\left(\left(x + 1\right), \left(\frac{1}{n}\right)\right), \left({x}^{\left(\frac{1}{n}\right)}\right)\right)\right), \left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \cdot {\color{blue}{\left(x + 1\right)}}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \cdot {x}^{\left(\frac{1}{n}\right)}\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \left(\frac{1}{n}\right)\right), \left({x}^{\left(\frac{1}{n}\right)}\right)\right)\right), \left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \cdot {\left(\color{blue}{x} + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \cdot {x}^{\left(\frac{1}{n}\right)}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{/.f64}\left(1, n\right)\right), \left({x}^{\left(\frac{1}{n}\right)}\right)\right)\right), \left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \cdot {\left(x + \color{blue}{1}\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \cdot {x}^{\left(\frac{1}{n}\right)}\right)\right) \]
      10. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{/.f64}\left(1, n\right)\right), \mathsf{pow.f64}\left(x, \left(\frac{1}{n}\right)\right)\right)\right), \left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \cdot {\left(x + 1\right)}^{\color{blue}{\left(\frac{1}{n}\right)}} - {x}^{\left(\frac{1}{n}\right)} \cdot {x}^{\left(\frac{1}{n}\right)}\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{/.f64}\left(1, n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right)\right), \left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} \cdot {\left(x + 1\right)}^{\left(\frac{1}{\color{blue}{n}}\right)} - {x}^{\left(\frac{1}{n}\right)} \cdot {x}^{\left(\frac{1}{n}\right)}\right)\right) \]
    4. Applied egg-rr34.5%

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{/.f64}\left(1, n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right)\right), \color{blue}{\left(\frac{\left(2 \cdot \log \left(1 + x\right) + 2 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n}\right) - \left(2 \cdot \log x + 2 \cdot \frac{{\log x}^{2}}{n}\right)}{n}\right)}\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \mathsf{/.f64}\left(1, n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right)\right), \mathsf{/.f64}\left(\left(\left(2 \cdot \log \left(1 + x\right) + 2 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n}\right) - \left(2 \cdot \log x + 2 \cdot \frac{{\log x}^{2}}{n}\right)\right), \color{blue}{n}\right)\right) \]
    7. Simplified73.0%

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

    if -6.2e7 < n < 25

    1. Initial program 81.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. pow-to-expN/A

        \[\leadsto \mathsf{\_.f64}\left(\left(e^{\log \left(x + 1\right) \cdot \frac{1}{n}}\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      2. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\log \left(x + 1\right) \cdot \frac{1}{n}\right)\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\frac{\log \left(x + 1\right)}{n}\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(x + 1\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(1 + x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      6. log1p-defineN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{log1p}\left(x\right)\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      7. log1p-lowering-log1p.f6499.8%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log1p.f64}\left(x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    4. Applied egg-rr99.8%

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

      \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\color{blue}{\left(\frac{x}{n}\right)}\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6499.8%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(x, n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    7. Simplified99.8%

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

    if 25 < n

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

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

      \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
    5. Applied egg-rr67.6%

      \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
    6. Taylor expanded in n around inf

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
    7. Step-by-step derivation
      1. log-lowering-log.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
      3. +-lowering-+.f6483.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
    8. Simplified83.4%

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

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

Alternative 3: 86.1% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;n \leq 25:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -4.5e7

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

      \[\leadsto \color{blue}{\frac{\left(\log \left(1 + x\right) + \frac{1}{2} \cdot \frac{{\log \left(1 + x\right)}^{2}}{n}\right) - \left(\log x + \frac{1}{2} \cdot \frac{{\log x}^{2}}{n}\right)}{n}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\left(\log \left(1 + x\right) + \frac{1}{2} \cdot \frac{{\log \left(1 + x\right)}^{2}}{n}\right) - \left(\log x + \frac{1}{2} \cdot \frac{{\log x}^{2}}{n}\right)\right), \color{blue}{n}\right) \]
    5. Simplified73.0%

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

    if -4.5e7 < n < 25

    1. Initial program 81.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. pow-to-expN/A

        \[\leadsto \mathsf{\_.f64}\left(\left(e^{\log \left(x + 1\right) \cdot \frac{1}{n}}\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      2. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\log \left(x + 1\right) \cdot \frac{1}{n}\right)\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\frac{\log \left(x + 1\right)}{n}\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(x + 1\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(1 + x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      6. log1p-defineN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{log1p}\left(x\right)\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      7. log1p-lowering-log1p.f6499.8%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log1p.f64}\left(x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    4. Applied egg-rr99.8%

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

      \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\color{blue}{\left(\frac{x}{n}\right)}\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6499.8%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(x, n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    7. Simplified99.8%

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

    if 25 < n

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

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

      \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
    5. Applied egg-rr67.6%

      \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
    6. Taylor expanded in n around inf

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
    7. Step-by-step derivation
      1. log-lowering-log.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
      3. +-lowering-+.f6483.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
    8. Simplified83.4%

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

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

Alternative 4: 86.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -22000000000:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\

\mathbf{elif}\;n \leq 25:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -2.2e10

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

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

      \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
    5. Applied egg-rr48.8%

      \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
    6. Taylor expanded in n around inf

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
    7. Step-by-step derivation
      1. log-lowering-log.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
      3. +-lowering-+.f6472.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
    8. Simplified72.2%

      \[\leadsto \frac{-1}{n} \cdot \color{blue}{\log \left(\frac{x}{1 + x}\right)} \]
    9. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \frac{-1 \cdot \log \left(\frac{x}{1 + x}\right)}{\color{blue}{n}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(-1 \cdot \log \left(\frac{x}{1 + x}\right)\right), \color{blue}{n}\right) \]
      3. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\log \left(\frac{x}{1 + x}\right)\right)\right), n\right) \]
      4. neg-logN/A

        \[\leadsto \mathsf{/.f64}\left(\log \left(\frac{1}{\frac{x}{1 + x}}\right), n\right) \]
      5. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(\log \left(\frac{1 + x}{x}\right), n\right) \]
      6. log-lowering-log.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\left(\frac{1 + x}{x}\right)\right), n\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\left(1 + x\right), x\right)\right), n\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\left(x + 1\right), x\right)\right), n\right) \]
      9. +-lowering-+.f6472.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, 1\right), x\right)\right), n\right) \]
    10. Applied egg-rr72.2%

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

    if -2.2e10 < n < 25

    1. Initial program 81.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. pow-to-expN/A

        \[\leadsto \mathsf{\_.f64}\left(\left(e^{\log \left(x + 1\right) \cdot \frac{1}{n}}\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      2. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\log \left(x + 1\right) \cdot \frac{1}{n}\right)\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\frac{\log \left(x + 1\right)}{n}\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(x + 1\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(1 + x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      6. log1p-defineN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{log1p}\left(x\right)\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      7. log1p-lowering-log1p.f6499.8%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log1p.f64}\left(x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    4. Applied egg-rr99.8%

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

      \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\color{blue}{\left(\frac{x}{n}\right)}\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6499.8%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(x, n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    7. Simplified99.8%

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

    if 25 < n

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

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

      \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
    5. Applied egg-rr67.6%

      \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
    6. Taylor expanded in n around inf

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
    7. Step-by-step derivation
      1. log-lowering-log.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
      3. +-lowering-+.f6483.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
    8. Simplified83.4%

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

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

Alternative 5: 82.3% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;\frac{1}{n} \leq 0.05:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\

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


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

    1. Initial program 98.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. pow-to-expN/A

        \[\leadsto \mathsf{\_.f64}\left(\left(e^{\log \left(x + 1\right) \cdot \frac{1}{n}}\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      2. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\log \left(x + 1\right) \cdot \frac{1}{n}\right)\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\frac{\log \left(x + 1\right)}{n}\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(x + 1\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(1 + x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      6. log1p-defineN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{log1p}\left(x\right)\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      7. log1p-lowering-log1p.f6498.4%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log1p.f64}\left(x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    4. Applied egg-rr98.4%

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

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

        \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{\log \left(\frac{1}{x}\right)}{n}\right)}}{n \cdot x} \]
      2. log-recN/A

        \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{\mathsf{neg}\left(\log x\right)}{n}\right)}}{n \cdot x} \]
      3. mul-1-negN/A

        \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      4. associate-*r/N/A

        \[\leadsto \frac{e^{\mathsf{neg}\left(-1 \cdot \frac{\log x}{n}\right)}}{n \cdot x} \]
      5. mul-1-negN/A

        \[\leadsto \frac{e^{\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{\log x}{n}\right)\right)\right)}}{n \cdot x} \]
      6. remove-double-negN/A

        \[\leadsto \frac{e^{\frac{\log x}{n}}}{n \cdot x} \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(e^{\frac{\log x}{n}}\right), \color{blue}{\left(n \cdot x\right)}\right) \]
      8. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\left(\frac{\log x}{n}\right)\right), \left(\color{blue}{n} \cdot x\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log x, n\right)\right), \left(n \cdot x\right)\right) \]
      10. log-lowering-log.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \left(n \cdot x\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \left(x \cdot \color{blue}{n}\right)\right) \]
      12. *-lowering-*.f6496.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \mathsf{*.f64}\left(x, \color{blue}{n}\right)\right) \]
    7. Simplified96.0%

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
    8. Step-by-step derivation
      1. div-invN/A

        \[\leadsto \mathsf{/.f64}\left(\left(e^{\log x \cdot \frac{1}{n}}\right), \mathsf{*.f64}\left(x, n\right)\right) \]
      2. exp-to-powN/A

        \[\leadsto \mathsf{/.f64}\left(\left({x}^{\left(\frac{1}{n}\right)}\right), \mathsf{*.f64}\left(\color{blue}{x}, n\right)\right) \]
      3. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(x, \left(\frac{1}{n}\right)\right), \mathsf{*.f64}\left(\color{blue}{x}, n\right)\right) \]
      4. /-lowering-/.f6496.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right), \mathsf{*.f64}\left(x, n\right)\right) \]
    9. Applied egg-rr96.0%

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

    if -1.99999999999999988e-11 < (/.f64 #s(literal 1 binary64) n) < 0.050000000000000003

    1. Initial program 29.4%

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

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

      \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
    5. Applied egg-rr59.6%

      \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
    6. Taylor expanded in n around inf

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
    7. Step-by-step derivation
      1. log-lowering-log.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
      3. +-lowering-+.f6478.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
    8. Simplified78.8%

      \[\leadsto \frac{-1}{n} \cdot \color{blue}{\log \left(\frac{x}{1 + x}\right)} \]
    9. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \frac{-1 \cdot \log \left(\frac{x}{1 + x}\right)}{\color{blue}{n}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(-1 \cdot \log \left(\frac{x}{1 + x}\right)\right), \color{blue}{n}\right) \]
      3. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\log \left(\frac{x}{1 + x}\right)\right)\right), n\right) \]
      4. neg-logN/A

        \[\leadsto \mathsf{/.f64}\left(\log \left(\frac{1}{\frac{x}{1 + x}}\right), n\right) \]
      5. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(\log \left(\frac{1 + x}{x}\right), n\right) \]
      6. log-lowering-log.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\left(\frac{1 + x}{x}\right)\right), n\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\left(1 + x\right), x\right)\right), n\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\left(x + 1\right), x\right)\right), n\right) \]
      9. +-lowering-+.f6478.8%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, 1\right), x\right)\right), n\right) \]
    10. Applied egg-rr78.8%

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

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

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

      \[\leadsto \mathsf{\_.f64}\left(\color{blue}{\left(1 + x \cdot \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right) + \frac{1}{n}\right)\right)}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    4. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \left(x \cdot \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right) + \frac{1}{n}\right)\right)\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right) + \frac{1}{n}\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(\frac{1}{n} + x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{1}{n}\right), \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      7. sub-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} + \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{1}{2} \cdot \frac{1}{{n}^{2}}\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{\frac{1}{2} \cdot 1}{{n}^{2}}\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{\frac{1}{2}}{{n}^{2}}\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \left({n}^{2}\right)\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \left(n \cdot n\right)\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      14. associate-*r/N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot 1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\mathsf{neg}\left(\frac{\frac{1}{2}}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      16. distribute-neg-fracN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\frac{\mathsf{neg}\left(\frac{1}{2}\right)}{n}\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      17. metadata-evalN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\frac{\frac{-1}{2}}{n}\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      18. /-lowering-/.f6481.0%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \mathsf{/.f64}\left(\frac{-1}{2}, n\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    5. Simplified81.0%

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

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

Alternative 6: 82.3% accurate, 1.6× speedup?

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

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

\mathbf{elif}\;\frac{1}{n} \leq 0.05:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\

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


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

    1. Initial program 98.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. pow-to-expN/A

        \[\leadsto \mathsf{\_.f64}\left(\left(e^{\log \left(x + 1\right) \cdot \frac{1}{n}}\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      2. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\log \left(x + 1\right) \cdot \frac{1}{n}\right)\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\frac{\log \left(x + 1\right)}{n}\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(x + 1\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(1 + x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      6. log1p-defineN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{log1p}\left(x\right)\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      7. log1p-lowering-log1p.f6498.4%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log1p.f64}\left(x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    4. Applied egg-rr98.4%

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

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

        \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{\log \left(\frac{1}{x}\right)}{n}\right)}}{n \cdot x} \]
      2. log-recN/A

        \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{\mathsf{neg}\left(\log x\right)}{n}\right)}}{n \cdot x} \]
      3. mul-1-negN/A

        \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      4. associate-*r/N/A

        \[\leadsto \frac{e^{\mathsf{neg}\left(-1 \cdot \frac{\log x}{n}\right)}}{n \cdot x} \]
      5. mul-1-negN/A

        \[\leadsto \frac{e^{\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{\log x}{n}\right)\right)\right)}}{n \cdot x} \]
      6. remove-double-negN/A

        \[\leadsto \frac{e^{\frac{\log x}{n}}}{n \cdot x} \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(e^{\frac{\log x}{n}}\right), \color{blue}{\left(n \cdot x\right)}\right) \]
      8. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\left(\frac{\log x}{n}\right)\right), \left(\color{blue}{n} \cdot x\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log x, n\right)\right), \left(n \cdot x\right)\right) \]
      10. log-lowering-log.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \left(n \cdot x\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \left(x \cdot \color{blue}{n}\right)\right) \]
      12. *-lowering-*.f6496.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \mathsf{*.f64}\left(x, \color{blue}{n}\right)\right) \]
    7. Simplified96.0%

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
    8. Step-by-step derivation
      1. div-invN/A

        \[\leadsto \mathsf{/.f64}\left(\left(e^{\log x \cdot \frac{1}{n}}\right), \mathsf{*.f64}\left(x, n\right)\right) \]
      2. exp-to-powN/A

        \[\leadsto \mathsf{/.f64}\left(\left({x}^{\left(\frac{1}{n}\right)}\right), \mathsf{*.f64}\left(\color{blue}{x}, n\right)\right) \]
      3. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(x, \left(\frac{1}{n}\right)\right), \mathsf{*.f64}\left(\color{blue}{x}, n\right)\right) \]
      4. /-lowering-/.f6496.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right), \mathsf{*.f64}\left(x, n\right)\right) \]
    9. Applied egg-rr96.0%

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

    if -1.99999999999999988e-11 < (/.f64 #s(literal 1 binary64) n) < 0.050000000000000003

    1. Initial program 29.4%

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

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

      \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
    5. Applied egg-rr59.6%

      \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
    6. Taylor expanded in n around inf

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
    7. Step-by-step derivation
      1. log-lowering-log.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
      3. +-lowering-+.f6478.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
    8. Simplified78.8%

      \[\leadsto \frac{-1}{n} \cdot \color{blue}{\log \left(\frac{x}{1 + x}\right)} \]
    9. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \frac{-1 \cdot \log \left(\frac{x}{1 + x}\right)}{\color{blue}{n}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(-1 \cdot \log \left(\frac{x}{1 + x}\right)\right), \color{blue}{n}\right) \]
      3. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\log \left(\frac{x}{1 + x}\right)\right)\right), n\right) \]
      4. neg-logN/A

        \[\leadsto \mathsf{/.f64}\left(\log \left(\frac{1}{\frac{x}{1 + x}}\right), n\right) \]
      5. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(\log \left(\frac{1 + x}{x}\right), n\right) \]
      6. log-lowering-log.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\left(\frac{1 + x}{x}\right)\right), n\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\left(1 + x\right), x\right)\right), n\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\left(x + 1\right), x\right)\right), n\right) \]
      9. +-lowering-+.f6478.8%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, 1\right), x\right)\right), n\right) \]
    10. Applied egg-rr78.8%

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

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

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

      \[\leadsto \mathsf{\_.f64}\left(\color{blue}{\left(1 + x \cdot \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right) + \frac{1}{n}\right)\right)}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    4. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \left(x \cdot \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right) + \frac{1}{n}\right)\right)\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right) + \frac{1}{n}\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(\frac{1}{n} + x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{1}{n}\right), \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      7. sub-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} + \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{1}{2} \cdot \frac{1}{{n}^{2}}\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{\frac{1}{2} \cdot 1}{{n}^{2}}\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{\frac{1}{2}}{{n}^{2}}\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \left({n}^{2}\right)\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \left(n \cdot n\right)\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      14. associate-*r/N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot 1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\mathsf{neg}\left(\frac{\frac{1}{2}}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      16. distribute-neg-fracN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\frac{\mathsf{neg}\left(\frac{1}{2}\right)}{n}\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      17. metadata-evalN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\frac{\frac{-1}{2}}{n}\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      18. /-lowering-/.f6481.0%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \mathsf{/.f64}\left(\frac{-1}{2}, n\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    5. Simplified81.0%

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

      \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \color{blue}{\left(\frac{1}{2} \cdot \frac{x}{{n}^{2}}\right)}\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    7. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{x}{{n}^{2}}\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(x, \left({n}^{2}\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(x, \left(n \cdot n\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      4. *-lowering-*.f6481.0%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(n, n\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    8. Simplified81.0%

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

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

Alternative 7: 80.8% accurate, 1.6× speedup?

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

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

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

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

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


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

    1. Initial program 98.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. pow-to-expN/A

        \[\leadsto \mathsf{\_.f64}\left(\left(e^{\log \left(x + 1\right) \cdot \frac{1}{n}}\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      2. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\log \left(x + 1\right) \cdot \frac{1}{n}\right)\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\frac{\log \left(x + 1\right)}{n}\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(x + 1\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(1 + x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      6. log1p-defineN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{log1p}\left(x\right)\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      7. log1p-lowering-log1p.f6498.4%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log1p.f64}\left(x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    4. Applied egg-rr98.4%

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

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

        \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{\log \left(\frac{1}{x}\right)}{n}\right)}}{n \cdot x} \]
      2. log-recN/A

        \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{\mathsf{neg}\left(\log x\right)}{n}\right)}}{n \cdot x} \]
      3. mul-1-negN/A

        \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      4. associate-*r/N/A

        \[\leadsto \frac{e^{\mathsf{neg}\left(-1 \cdot \frac{\log x}{n}\right)}}{n \cdot x} \]
      5. mul-1-negN/A

        \[\leadsto \frac{e^{\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{\log x}{n}\right)\right)\right)}}{n \cdot x} \]
      6. remove-double-negN/A

        \[\leadsto \frac{e^{\frac{\log x}{n}}}{n \cdot x} \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(e^{\frac{\log x}{n}}\right), \color{blue}{\left(n \cdot x\right)}\right) \]
      8. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\left(\frac{\log x}{n}\right)\right), \left(\color{blue}{n} \cdot x\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log x, n\right)\right), \left(n \cdot x\right)\right) \]
      10. log-lowering-log.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \left(n \cdot x\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \left(x \cdot \color{blue}{n}\right)\right) \]
      12. *-lowering-*.f6496.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \mathsf{*.f64}\left(x, \color{blue}{n}\right)\right) \]
    7. Simplified96.0%

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
    8. Step-by-step derivation
      1. div-invN/A

        \[\leadsto \mathsf{/.f64}\left(\left(e^{\log x \cdot \frac{1}{n}}\right), \mathsf{*.f64}\left(x, n\right)\right) \]
      2. exp-to-powN/A

        \[\leadsto \mathsf{/.f64}\left(\left({x}^{\left(\frac{1}{n}\right)}\right), \mathsf{*.f64}\left(\color{blue}{x}, n\right)\right) \]
      3. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(x, \left(\frac{1}{n}\right)\right), \mathsf{*.f64}\left(\color{blue}{x}, n\right)\right) \]
      4. /-lowering-/.f6496.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right), \mathsf{*.f64}\left(x, n\right)\right) \]
    9. Applied egg-rr96.0%

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

    if -1.99999999999999988e-11 < (/.f64 #s(literal 1 binary64) n) < 1e18

    1. Initial program 29.9%

      \[{\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

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

      \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
    5. Applied egg-rr59.2%

      \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
    6. Taylor expanded in n around inf

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
    7. Step-by-step derivation
      1. log-lowering-log.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
      3. +-lowering-+.f6478.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
    8. Simplified78.3%

      \[\leadsto \frac{-1}{n} \cdot \color{blue}{\log \left(\frac{x}{1 + x}\right)} \]
    9. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \frac{-1 \cdot \log \left(\frac{x}{1 + x}\right)}{\color{blue}{n}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(-1 \cdot \log \left(\frac{x}{1 + x}\right)\right), \color{blue}{n}\right) \]
      3. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\log \left(\frac{x}{1 + x}\right)\right)\right), n\right) \]
      4. neg-logN/A

        \[\leadsto \mathsf{/.f64}\left(\log \left(\frac{1}{\frac{x}{1 + x}}\right), n\right) \]
      5. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(\log \left(\frac{1 + x}{x}\right), n\right) \]
      6. log-lowering-log.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\left(\frac{1 + x}{x}\right)\right), n\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\left(1 + x\right), x\right)\right), n\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\left(x + 1\right), x\right)\right), n\right) \]
      9. +-lowering-+.f6478.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, 1\right), x\right)\right), n\right) \]
    10. Applied egg-rr78.3%

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

    if 1e18 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e178

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

      \[\leadsto \mathsf{\_.f64}\left(\color{blue}{\left(1 + \frac{x}{n}\right)}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    4. Step-by-step derivation
      1. *-rgt-identityN/A

        \[\leadsto \mathsf{\_.f64}\left(\left(1 + \frac{x \cdot 1}{n}\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      2. associate-*r/N/A

        \[\leadsto \mathsf{\_.f64}\left(\left(1 + x \cdot \frac{1}{n}\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \left(x \cdot \frac{1}{n}\right)\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      4. associate-*r/N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{x \cdot 1}{n}\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      5. *-rgt-identityN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{x}{n}\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      6. /-lowering-/.f6479.5%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{/.f64}\left(x, n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    5. Simplified79.5%

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

    if 2.0000000000000001e178 < (/.f64 #s(literal 1 binary64) n)

    1. Initial program 3.1%

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

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

      \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
    5. Applied egg-rr0.0%

      \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
    6. Taylor expanded in n around inf

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
    7. Step-by-step derivation
      1. log-lowering-log.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
      3. +-lowering-+.f647.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
    8. Simplified7.2%

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\left(\frac{\frac{1}{2} \cdot \frac{1}{x} - \left(1 + \frac{\frac{1}{3}}{{x}^{2}}\right)}{x}\right)}\right) \]
    10. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{/.f64}\left(\left(\frac{1}{2} \cdot \frac{1}{x} - \left(1 + \frac{\frac{1}{3}}{{x}^{2}}\right)\right), \color{blue}{x}\right)\right) \]
    11. Simplified100.0%

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

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

Alternative 8: 80.7% accurate, 1.7× speedup?

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

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

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

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

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


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

    1. Initial program 98.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. pow-to-expN/A

        \[\leadsto \mathsf{\_.f64}\left(\left(e^{\log \left(x + 1\right) \cdot \frac{1}{n}}\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      2. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\log \left(x + 1\right) \cdot \frac{1}{n}\right)\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\frac{\log \left(x + 1\right)}{n}\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(x + 1\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(1 + x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      6. log1p-defineN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{log1p}\left(x\right)\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      7. log1p-lowering-log1p.f6498.4%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log1p.f64}\left(x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    4. Applied egg-rr98.4%

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

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

        \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{\log \left(\frac{1}{x}\right)}{n}\right)}}{n \cdot x} \]
      2. log-recN/A

        \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{\mathsf{neg}\left(\log x\right)}{n}\right)}}{n \cdot x} \]
      3. mul-1-negN/A

        \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      4. associate-*r/N/A

        \[\leadsto \frac{e^{\mathsf{neg}\left(-1 \cdot \frac{\log x}{n}\right)}}{n \cdot x} \]
      5. mul-1-negN/A

        \[\leadsto \frac{e^{\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{\log x}{n}\right)\right)\right)}}{n \cdot x} \]
      6. remove-double-negN/A

        \[\leadsto \frac{e^{\frac{\log x}{n}}}{n \cdot x} \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(e^{\frac{\log x}{n}}\right), \color{blue}{\left(n \cdot x\right)}\right) \]
      8. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\left(\frac{\log x}{n}\right)\right), \left(\color{blue}{n} \cdot x\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log x, n\right)\right), \left(n \cdot x\right)\right) \]
      10. log-lowering-log.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \left(n \cdot x\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \left(x \cdot \color{blue}{n}\right)\right) \]
      12. *-lowering-*.f6496.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \mathsf{*.f64}\left(x, \color{blue}{n}\right)\right) \]
    7. Simplified96.0%

      \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
    8. Step-by-step derivation
      1. div-invN/A

        \[\leadsto \mathsf{/.f64}\left(\left(e^{\log x \cdot \frac{1}{n}}\right), \mathsf{*.f64}\left(x, n\right)\right) \]
      2. exp-to-powN/A

        \[\leadsto \mathsf{/.f64}\left(\left({x}^{\left(\frac{1}{n}\right)}\right), \mathsf{*.f64}\left(\color{blue}{x}, n\right)\right) \]
      3. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(x, \left(\frac{1}{n}\right)\right), \mathsf{*.f64}\left(\color{blue}{x}, n\right)\right) \]
      4. /-lowering-/.f6496.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right), \mathsf{*.f64}\left(x, n\right)\right) \]
    9. Applied egg-rr96.0%

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

    if -1.99999999999999988e-11 < (/.f64 #s(literal 1 binary64) n) < 1e18

    1. Initial program 29.9%

      \[{\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

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

      \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
    5. Applied egg-rr59.2%

      \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
    6. Taylor expanded in n around inf

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
    7. Step-by-step derivation
      1. log-lowering-log.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
      3. +-lowering-+.f6478.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
    8. Simplified78.3%

      \[\leadsto \frac{-1}{n} \cdot \color{blue}{\log \left(\frac{x}{1 + x}\right)} \]
    9. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \frac{-1 \cdot \log \left(\frac{x}{1 + x}\right)}{\color{blue}{n}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(-1 \cdot \log \left(\frac{x}{1 + x}\right)\right), \color{blue}{n}\right) \]
      3. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\log \left(\frac{x}{1 + x}\right)\right)\right), n\right) \]
      4. neg-logN/A

        \[\leadsto \mathsf{/.f64}\left(\log \left(\frac{1}{\frac{x}{1 + x}}\right), n\right) \]
      5. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(\log \left(\frac{1 + x}{x}\right), n\right) \]
      6. log-lowering-log.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\left(\frac{1 + x}{x}\right)\right), n\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\left(1 + x\right), x\right)\right), n\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\left(x + 1\right), x\right)\right), n\right) \]
      9. +-lowering-+.f6478.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, 1\right), x\right)\right), n\right) \]
    10. Applied egg-rr78.3%

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

    if 1e18 < (/.f64 #s(literal 1 binary64) n) < 5e163

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

      \[\leadsto \mathsf{\_.f64}\left(\color{blue}{1}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
    4. Step-by-step derivation
      1. Simplified80.4%

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

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

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

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

        \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
      5. Applied egg-rr0.0%

        \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
      6. Taylor expanded in n around inf

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
      7. Step-by-step derivation
        1. log-lowering-log.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
        2. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
        3. +-lowering-+.f646.9%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
      8. Simplified6.9%

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\left(\frac{\frac{1}{2} \cdot \frac{1}{x} - \left(1 + \frac{\frac{1}{3}}{{x}^{2}}\right)}{x}\right)}\right) \]
      10. Step-by-step derivation
        1. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{/.f64}\left(\left(\frac{1}{2} \cdot \frac{1}{x} - \left(1 + \frac{\frac{1}{3}}{{x}^{2}}\right)\right), \color{blue}{x}\right)\right) \]
      11. Simplified94.6%

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

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

    Alternative 9: 80.7% accurate, 1.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\ \;\;\;\;\frac{\frac{t\_0}{x}}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{+18}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+163}:\\ \;\;\;\;1 - t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{n} \cdot \frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}\\ \end{array} \end{array} \]
    (FPCore (x n)
     :precision binary64
     (let* ((t_0 (pow x (/ 1.0 n))))
       (if (<= (/ 1.0 n) -2e-11)
         (/ (/ t_0 x) n)
         (if (<= (/ 1.0 n) 1e+18)
           (/ (log (/ (+ x 1.0) x)) n)
           (if (<= (/ 1.0 n) 5e+163)
             (- 1.0 t_0)
             (*
              (/ 1.0 n)
              (/ (- 1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) x)))))))
    double code(double x, double n) {
    	double t_0 = pow(x, (1.0 / n));
    	double tmp;
    	if ((1.0 / n) <= -2e-11) {
    		tmp = (t_0 / x) / n;
    	} else if ((1.0 / n) <= 1e+18) {
    		tmp = log(((x + 1.0) / x)) / n;
    	} else if ((1.0 / n) <= 5e+163) {
    		tmp = 1.0 - t_0;
    	} else {
    		tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x);
    	}
    	return tmp;
    }
    
    real(8) function code(x, n)
        real(8), intent (in) :: x
        real(8), intent (in) :: n
        real(8) :: t_0
        real(8) :: tmp
        t_0 = x ** (1.0d0 / n)
        if ((1.0d0 / n) <= (-2d-11)) then
            tmp = (t_0 / x) / n
        else if ((1.0d0 / n) <= 1d+18) then
            tmp = log(((x + 1.0d0) / x)) / n
        else if ((1.0d0 / n) <= 5d+163) then
            tmp = 1.0d0 - t_0
        else
            tmp = (1.0d0 / n) * ((1.0d0 - ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / x)
        end if
        code = tmp
    end function
    
    public static double code(double x, double n) {
    	double t_0 = Math.pow(x, (1.0 / n));
    	double tmp;
    	if ((1.0 / n) <= -2e-11) {
    		tmp = (t_0 / x) / n;
    	} else if ((1.0 / n) <= 1e+18) {
    		tmp = Math.log(((x + 1.0) / x)) / n;
    	} else if ((1.0 / n) <= 5e+163) {
    		tmp = 1.0 - t_0;
    	} else {
    		tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x);
    	}
    	return tmp;
    }
    
    def code(x, n):
    	t_0 = math.pow(x, (1.0 / n))
    	tmp = 0
    	if (1.0 / n) <= -2e-11:
    		tmp = (t_0 / x) / n
    	elif (1.0 / n) <= 1e+18:
    		tmp = math.log(((x + 1.0) / x)) / n
    	elif (1.0 / n) <= 5e+163:
    		tmp = 1.0 - t_0
    	else:
    		tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x)
    	return tmp
    
    function code(x, n)
    	t_0 = x ^ Float64(1.0 / n)
    	tmp = 0.0
    	if (Float64(1.0 / n) <= -2e-11)
    		tmp = Float64(Float64(t_0 / x) / n);
    	elseif (Float64(1.0 / n) <= 1e+18)
    		tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n);
    	elseif (Float64(1.0 / n) <= 5e+163)
    		tmp = Float64(1.0 - t_0);
    	else
    		tmp = Float64(Float64(1.0 / n) * Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / x));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, n)
    	t_0 = x ^ (1.0 / n);
    	tmp = 0.0;
    	if ((1.0 / n) <= -2e-11)
    		tmp = (t_0 / x) / n;
    	elseif ((1.0 / n) <= 1e+18)
    		tmp = log(((x + 1.0) / x)) / n;
    	elseif ((1.0 / n) <= 5e+163)
    		tmp = 1.0 - t_0;
    	else
    		tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x);
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], N[(N[(t$95$0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+18], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+163], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] * N[(N[(1.0 - N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := {x}^{\left(\frac{1}{n}\right)}\\
    \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
    \;\;\;\;\frac{\frac{t\_0}{x}}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 10^{+18}:\\
    \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
    
    \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+163}:\\
    \;\;\;\;1 - t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1}{n} \cdot \frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999988e-11

      1. Initial program 98.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. pow-to-expN/A

          \[\leadsto \mathsf{\_.f64}\left(\left(e^{\log \left(x + 1\right) \cdot \frac{1}{n}}\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
        2. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\log \left(x + 1\right) \cdot \frac{1}{n}\right)\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
        3. un-div-invN/A

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\frac{\log \left(x + 1\right)}{n}\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
        4. /-lowering-/.f64N/A

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(x + 1\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
        5. +-commutativeN/A

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(1 + x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
        6. log1p-defineN/A

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{log1p}\left(x\right)\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
        7. log1p-lowering-log1p.f6498.4%

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log1p.f64}\left(x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      4. Applied egg-rr98.4%

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

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

          \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{\log \left(\frac{1}{x}\right)}{n}\right)}}{n \cdot x} \]
        2. log-recN/A

          \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{\mathsf{neg}\left(\log x\right)}{n}\right)}}{n \cdot x} \]
        3. mul-1-negN/A

          \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
        4. associate-*r/N/A

          \[\leadsto \frac{e^{\mathsf{neg}\left(-1 \cdot \frac{\log x}{n}\right)}}{n \cdot x} \]
        5. mul-1-negN/A

          \[\leadsto \frac{e^{\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{\log x}{n}\right)\right)\right)}}{n \cdot x} \]
        6. remove-double-negN/A

          \[\leadsto \frac{e^{\frac{\log x}{n}}}{n \cdot x} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(e^{\frac{\log x}{n}}\right), \color{blue}{\left(n \cdot x\right)}\right) \]
        8. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\left(\frac{\log x}{n}\right)\right), \left(\color{blue}{n} \cdot x\right)\right) \]
        9. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log x, n\right)\right), \left(n \cdot x\right)\right) \]
        10. log-lowering-log.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \left(n \cdot x\right)\right) \]
        11. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \left(x \cdot \color{blue}{n}\right)\right) \]
        12. *-lowering-*.f6496.0%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \mathsf{*.f64}\left(x, \color{blue}{n}\right)\right) \]
      7. Simplified96.0%

        \[\leadsto \color{blue}{\frac{e^{\frac{\log x}{n}}}{x \cdot n}} \]
      8. Step-by-step derivation
        1. associate-/r*N/A

          \[\leadsto \frac{\frac{e^{\frac{\log x}{n}}}{x}}{\color{blue}{n}} \]
        2. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{e^{\frac{\log x}{n}}}{x}\right), \color{blue}{n}\right) \]
        3. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(e^{\frac{\log x}{n}}\right), x\right), n\right) \]
        4. div-invN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(e^{\log x \cdot \frac{1}{n}}\right), x\right), n\right) \]
        5. exp-to-powN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left({x}^{\left(\frac{1}{n}\right)}\right), x\right), n\right) \]
        6. pow-lowering-pow.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(x, \left(\frac{1}{n}\right)\right), x\right), n\right) \]
        7. /-lowering-/.f6496.0%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right), x\right), n\right) \]
      9. Applied egg-rr96.0%

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

      if -1.99999999999999988e-11 < (/.f64 #s(literal 1 binary64) n) < 1e18

      1. Initial program 29.9%

        \[{\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

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

        \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
      5. Applied egg-rr59.2%

        \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
      6. Taylor expanded in n around inf

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
      7. Step-by-step derivation
        1. log-lowering-log.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
        2. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
        3. +-lowering-+.f6478.3%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
      8. Simplified78.3%

        \[\leadsto \frac{-1}{n} \cdot \color{blue}{\log \left(\frac{x}{1 + x}\right)} \]
      9. Step-by-step derivation
        1. associate-*l/N/A

          \[\leadsto \frac{-1 \cdot \log \left(\frac{x}{1 + x}\right)}{\color{blue}{n}} \]
        2. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(-1 \cdot \log \left(\frac{x}{1 + x}\right)\right), \color{blue}{n}\right) \]
        3. mul-1-negN/A

          \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\log \left(\frac{x}{1 + x}\right)\right)\right), n\right) \]
        4. neg-logN/A

          \[\leadsto \mathsf{/.f64}\left(\log \left(\frac{1}{\frac{x}{1 + x}}\right), n\right) \]
        5. clear-numN/A

          \[\leadsto \mathsf{/.f64}\left(\log \left(\frac{1 + x}{x}\right), n\right) \]
        6. log-lowering-log.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\left(\frac{1 + x}{x}\right)\right), n\right) \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\left(1 + x\right), x\right)\right), n\right) \]
        8. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\left(x + 1\right), x\right)\right), n\right) \]
        9. +-lowering-+.f6478.3%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, 1\right), x\right)\right), n\right) \]
      10. Applied egg-rr78.3%

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

      if 1e18 < (/.f64 #s(literal 1 binary64) n) < 5e163

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

        \[\leadsto \mathsf{\_.f64}\left(\color{blue}{1}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
      4. Step-by-step derivation
        1. Simplified80.4%

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

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

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

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

          \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
        5. Applied egg-rr0.0%

          \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
        6. Taylor expanded in n around inf

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
        7. Step-by-step derivation
          1. log-lowering-log.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
          2. /-lowering-/.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
          3. +-lowering-+.f646.9%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
        8. Simplified6.9%

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\left(\frac{\frac{1}{2} \cdot \frac{1}{x} - \left(1 + \frac{\frac{1}{3}}{{x}^{2}}\right)}{x}\right)}\right) \]
        10. Step-by-step derivation
          1. /-lowering-/.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{/.f64}\left(\left(\frac{1}{2} \cdot \frac{1}{x} - \left(1 + \frac{\frac{1}{3}}{{x}^{2}}\right)\right), \color{blue}{x}\right)\right) \]
        11. Simplified94.6%

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

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

      Alternative 10: 67.2% accurate, 1.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-7}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{+18}:\\ \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\ \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+163}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{n} \cdot \frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}\\ \end{array} \end{array} \]
      (FPCore (x n)
       :precision binary64
       (let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
         (if (<= (/ 1.0 n) -2e-7)
           t_0
           (if (<= (/ 1.0 n) 1e+18)
             (/ (log (/ (+ x 1.0) x)) n)
             (if (<= (/ 1.0 n) 5e+163)
               t_0
               (*
                (/ 1.0 n)
                (/ (- 1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) x)))))))
      double code(double x, double n) {
      	double t_0 = 1.0 - pow(x, (1.0 / n));
      	double tmp;
      	if ((1.0 / n) <= -2e-7) {
      		tmp = t_0;
      	} else if ((1.0 / n) <= 1e+18) {
      		tmp = log(((x + 1.0) / x)) / n;
      	} else if ((1.0 / n) <= 5e+163) {
      		tmp = t_0;
      	} else {
      		tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x);
      	}
      	return tmp;
      }
      
      real(8) function code(x, n)
          real(8), intent (in) :: x
          real(8), intent (in) :: n
          real(8) :: t_0
          real(8) :: tmp
          t_0 = 1.0d0 - (x ** (1.0d0 / n))
          if ((1.0d0 / n) <= (-2d-7)) then
              tmp = t_0
          else if ((1.0d0 / n) <= 1d+18) then
              tmp = log(((x + 1.0d0) / x)) / n
          else if ((1.0d0 / n) <= 5d+163) then
              tmp = t_0
          else
              tmp = (1.0d0 / n) * ((1.0d0 - ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / x)
          end if
          code = tmp
      end function
      
      public static double code(double x, double n) {
      	double t_0 = 1.0 - Math.pow(x, (1.0 / n));
      	double tmp;
      	if ((1.0 / n) <= -2e-7) {
      		tmp = t_0;
      	} else if ((1.0 / n) <= 1e+18) {
      		tmp = Math.log(((x + 1.0) / x)) / n;
      	} else if ((1.0 / n) <= 5e+163) {
      		tmp = t_0;
      	} else {
      		tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x);
      	}
      	return tmp;
      }
      
      def code(x, n):
      	t_0 = 1.0 - math.pow(x, (1.0 / n))
      	tmp = 0
      	if (1.0 / n) <= -2e-7:
      		tmp = t_0
      	elif (1.0 / n) <= 1e+18:
      		tmp = math.log(((x + 1.0) / x)) / n
      	elif (1.0 / n) <= 5e+163:
      		tmp = t_0
      	else:
      		tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x)
      	return tmp
      
      function code(x, n)
      	t_0 = Float64(1.0 - (x ^ Float64(1.0 / n)))
      	tmp = 0.0
      	if (Float64(1.0 / n) <= -2e-7)
      		tmp = t_0;
      	elseif (Float64(1.0 / n) <= 1e+18)
      		tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n);
      	elseif (Float64(1.0 / n) <= 5e+163)
      		tmp = t_0;
      	else
      		tmp = Float64(Float64(1.0 / n) * Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / x));
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, n)
      	t_0 = 1.0 - (x ^ (1.0 / n));
      	tmp = 0.0;
      	if ((1.0 / n) <= -2e-7)
      		tmp = t_0;
      	elseif ((1.0 / n) <= 1e+18)
      		tmp = log(((x + 1.0) / x)) / n;
      	elseif ((1.0 / n) <= 5e+163)
      		tmp = t_0;
      	else
      		tmp = (1.0 / n) * ((1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / x);
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-7], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+18], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+163], t$95$0, N[(N[(1.0 / n), $MachinePrecision] * N[(N[(1.0 - N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
      \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-7}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;\frac{1}{n} \leq 10^{+18}:\\
      \;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
      
      \mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+163}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{1}{n} \cdot \frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e-7 or 1e18 < (/.f64 #s(literal 1 binary64) n) < 5e163

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

          \[\leadsto \mathsf{\_.f64}\left(\color{blue}{1}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
        4. Step-by-step derivation
          1. Simplified64.1%

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

          if -1.9999999999999999e-7 < (/.f64 #s(literal 1 binary64) n) < 1e18

          1. Initial program 29.8%

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

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

            \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
          5. Applied egg-rr58.7%

            \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
          6. Taylor expanded in n around inf

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
          7. Step-by-step derivation
            1. log-lowering-log.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
            2. /-lowering-/.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
            3. +-lowering-+.f6477.8%

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
          8. Simplified77.8%

            \[\leadsto \frac{-1}{n} \cdot \color{blue}{\log \left(\frac{x}{1 + x}\right)} \]
          9. Step-by-step derivation
            1. associate-*l/N/A

              \[\leadsto \frac{-1 \cdot \log \left(\frac{x}{1 + x}\right)}{\color{blue}{n}} \]
            2. /-lowering-/.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\left(-1 \cdot \log \left(\frac{x}{1 + x}\right)\right), \color{blue}{n}\right) \]
            3. mul-1-negN/A

              \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\log \left(\frac{x}{1 + x}\right)\right)\right), n\right) \]
            4. neg-logN/A

              \[\leadsto \mathsf{/.f64}\left(\log \left(\frac{1}{\frac{x}{1 + x}}\right), n\right) \]
            5. clear-numN/A

              \[\leadsto \mathsf{/.f64}\left(\log \left(\frac{1 + x}{x}\right), n\right) \]
            6. log-lowering-log.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\left(\frac{1 + x}{x}\right)\right), n\right) \]
            7. /-lowering-/.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\left(1 + x\right), x\right)\right), n\right) \]
            8. +-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\left(x + 1\right), x\right)\right), n\right) \]
            9. +-lowering-+.f6477.8%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{log.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, 1\right), x\right)\right), n\right) \]
          10. Applied egg-rr77.8%

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

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

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

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

            \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
          5. Applied egg-rr0.0%

            \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
          6. Taylor expanded in n around inf

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
          7. Step-by-step derivation
            1. log-lowering-log.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
            2. /-lowering-/.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
            3. +-lowering-+.f646.9%

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
          8. Simplified6.9%

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\left(\frac{\frac{1}{2} \cdot \frac{1}{x} - \left(1 + \frac{\frac{1}{3}}{{x}^{2}}\right)}{x}\right)}\right) \]
          10. Step-by-step derivation
            1. /-lowering-/.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{/.f64}\left(\left(\frac{1}{2} \cdot \frac{1}{x} - \left(1 + \frac{\frac{1}{3}}{{x}^{2}}\right)\right), \color{blue}{x}\right)\right) \]
          11. Simplified94.6%

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

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

        Alternative 11: 59.8% accurate, 1.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 4 \cdot 10^{-207}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.0038:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{+231}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{n \cdot x}}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
        (FPCore (x n)
         :precision binary64
         (if (<= x 4e-207)
           (- 1.0 (pow x (/ 1.0 n)))
           (if (<= x 0.0038)
             (/ (- x (log x)) n)
             (if (<= x 4.8e+231)
               (/ (+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ 0.3333333333333333 (* n x))) x)) x)
               0.0))))
        double code(double x, double n) {
        	double tmp;
        	if (x <= 4e-207) {
        		tmp = 1.0 - pow(x, (1.0 / n));
        	} else if (x <= 0.0038) {
        		tmp = (x - log(x)) / n;
        	} else if (x <= 4.8e+231) {
        		tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x;
        	} else {
        		tmp = 0.0;
        	}
        	return tmp;
        }
        
        real(8) function code(x, n)
            real(8), intent (in) :: x
            real(8), intent (in) :: n
            real(8) :: tmp
            if (x <= 4d-207) then
                tmp = 1.0d0 - (x ** (1.0d0 / n))
            else if (x <= 0.0038d0) then
                tmp = (x - log(x)) / n
            else if (x <= 4.8d+231) then
                tmp = ((1.0d0 / n) + ((((-0.5d0) / n) + (0.3333333333333333d0 / (n * x))) / x)) / x
            else
                tmp = 0.0d0
            end if
            code = tmp
        end function
        
        public static double code(double x, double n) {
        	double tmp;
        	if (x <= 4e-207) {
        		tmp = 1.0 - Math.pow(x, (1.0 / n));
        	} else if (x <= 0.0038) {
        		tmp = (x - Math.log(x)) / n;
        	} else if (x <= 4.8e+231) {
        		tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x;
        	} else {
        		tmp = 0.0;
        	}
        	return tmp;
        }
        
        def code(x, n):
        	tmp = 0
        	if x <= 4e-207:
        		tmp = 1.0 - math.pow(x, (1.0 / n))
        	elif x <= 0.0038:
        		tmp = (x - math.log(x)) / n
        	elif x <= 4.8e+231:
        		tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x
        	else:
        		tmp = 0.0
        	return tmp
        
        function code(x, n)
        	tmp = 0.0
        	if (x <= 4e-207)
        		tmp = Float64(1.0 - (x ^ Float64(1.0 / n)));
        	elseif (x <= 0.0038)
        		tmp = Float64(Float64(x - log(x)) / n);
        	elseif (x <= 4.8e+231)
        		tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(0.3333333333333333 / Float64(n * x))) / x)) / x);
        	else
        		tmp = 0.0;
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, n)
        	tmp = 0.0;
        	if (x <= 4e-207)
        		tmp = 1.0 - (x ^ (1.0 / n));
        	elseif (x <= 0.0038)
        		tmp = (x - log(x)) / n;
        	elseif (x <= 4.8e+231)
        		tmp = ((1.0 / n) + (((-0.5 / n) + (0.3333333333333333 / (n * x))) / x)) / x;
        	else
        		tmp = 0.0;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, n_] := If[LessEqual[x, 4e-207], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.0038], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 4.8e+231], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;x \leq 4 \cdot 10^{-207}:\\
        \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
        
        \mathbf{elif}\;x \leq 0.0038:\\
        \;\;\;\;\frac{x - \log x}{n}\\
        
        \mathbf{elif}\;x \leq 4.8 \cdot 10^{+231}:\\
        \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{n \cdot x}}{x}}{x}\\
        
        \mathbf{else}:\\
        \;\;\;\;0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 4 regimes
        2. if x < 3.9999999999999997e-207

          1. Initial program 57.3%

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

            \[\leadsto \mathsf{\_.f64}\left(\color{blue}{1}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
          4. Step-by-step derivation
            1. Simplified57.3%

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

            if 3.9999999999999997e-207 < x < 0.00379999999999999999

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

              \[\leadsto \mathsf{\_.f64}\left(\color{blue}{\left(1 + x \cdot \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right) + \frac{1}{n}\right)\right)}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
            4. Step-by-step derivation
              1. +-lowering-+.f64N/A

                \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \left(x \cdot \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right) + \frac{1}{n}\right)\right)\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
              2. *-lowering-*.f64N/A

                \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right) + \frac{1}{n}\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
              3. +-commutativeN/A

                \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(\frac{1}{n} + x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
              4. +-lowering-+.f64N/A

                \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{1}{n}\right), \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
              5. /-lowering-/.f64N/A

                \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
              6. *-lowering-*.f64N/A

                \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
              7. sub-negN/A

                \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} + \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
              8. +-lowering-+.f64N/A

                \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{1}{2} \cdot \frac{1}{{n}^{2}}\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
              9. associate-*r/N/A

                \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{\frac{1}{2} \cdot 1}{{n}^{2}}\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
              10. metadata-evalN/A

                \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{\frac{1}{2}}{{n}^{2}}\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
              11. /-lowering-/.f64N/A

                \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \left({n}^{2}\right)\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
              12. unpow2N/A

                \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \left(n \cdot n\right)\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
              13. *-lowering-*.f64N/A

                \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
              14. associate-*r/N/A

                \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot 1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
              15. metadata-evalN/A

                \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\mathsf{neg}\left(\frac{\frac{1}{2}}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
              16. distribute-neg-fracN/A

                \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\frac{\mathsf{neg}\left(\frac{1}{2}\right)}{n}\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
              17. metadata-evalN/A

                \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\frac{\frac{-1}{2}}{n}\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
              18. /-lowering-/.f6435.6%

                \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \mathsf{/.f64}\left(\frac{-1}{2}, n\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
            5. Simplified35.6%

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

              \[\leadsto \color{blue}{\frac{x \cdot \left(1 + \frac{-1}{2} \cdot x\right) - \log x}{n}} \]
            7. Step-by-step derivation
              1. /-lowering-/.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\left(x \cdot \left(1 + \frac{-1}{2} \cdot x\right) - \log x\right), \color{blue}{n}\right) \]
              2. --lowering--.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(x \cdot \left(1 + \frac{-1}{2} \cdot x\right)\right), \log x\right), n\right) \]
              3. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \left(1 + \frac{-1}{2} \cdot x\right)\right), \log x\right), n\right) \]
              4. +-lowering-+.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot x\right)\right)\right), \log x\right), n\right) \]
              5. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left(x \cdot \frac{-1}{2}\right)\right)\right), \log x\right), n\right) \]
              6. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \log x\right), n\right) \]
              7. log-lowering-log.f6455.7%

                \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{log.f64}\left(x\right)\right), n\right) \]
            8. Simplified55.7%

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

              \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(x - \log x\right)}, n\right) \]
            10. Step-by-step derivation
              1. --lowering--.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x, \log x\right), n\right) \]
              2. log-lowering-log.f6455.3%

                \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(x\right)\right), n\right) \]
            11. Simplified55.3%

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

            if 0.00379999999999999999 < x < 4.80000000000000013e231

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

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

              \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
            5. Applied egg-rr33.8%

              \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
            6. Taylor expanded in n around inf

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
            7. Step-by-step derivation
              1. log-lowering-log.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
              2. /-lowering-/.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
              3. +-lowering-+.f6458.1%

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
            8. Simplified58.1%

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

              \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
            10. Step-by-step derivation
              1. associate-*r/N/A

                \[\leadsto \frac{-1 \cdot \left(-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}{\color{blue}{x}} \]
              2. mul-1-negN/A

                \[\leadsto \frac{\mathsf{neg}\left(\left(-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)\right)}{x} \]
              3. sub-negN/A

                \[\leadsto \frac{\mathsf{neg}\left(\left(-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \left(\mathsf{neg}\left(\frac{1}{n}\right)\right)\right)\right)}{x} \]
              4. mul-1-negN/A

                \[\leadsto \frac{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x}\right)\right) + \left(\mathsf{neg}\left(\frac{1}{n}\right)\right)\right)\right)}{x} \]
              5. distribute-neg-outN/A

                \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \frac{1}{n}\right)\right)\right)\right)}{x} \]
              6. remove-double-negN/A

                \[\leadsto \frac{\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \frac{1}{n}}{x} \]
              7. /-lowering-/.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \frac{1}{n}\right), \color{blue}{x}\right) \]
            11. Simplified71.4%

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

            if 4.80000000000000013e231 < x

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

              \[\leadsto \mathsf{\_.f64}\left(\color{blue}{1}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
            4. Step-by-step derivation
              1. Simplified59.1%

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

                \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{1}\right) \]
              3. Step-by-step derivation
                1. Simplified95.2%

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

                    \[\leadsto 0 \]
                3. Applied egg-rr95.2%

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4 \cdot 10^{-207}:\\ \;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;x \leq 0.0038:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{+231}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{n \cdot x}}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
              6. Add Preprocessing

              Alternative 12: 59.8% accurate, 1.9× speedup?

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

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

                  \[\leadsto \mathsf{\_.f64}\left(\color{blue}{\left(1 + x \cdot \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right) + \frac{1}{n}\right)\right)}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                4. Step-by-step derivation
                  1. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \left(x \cdot \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right) + \frac{1}{n}\right)\right)\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                  2. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right) + \frac{1}{n}\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                  3. +-commutativeN/A

                    \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(\frac{1}{n} + x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                  4. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{1}{n}\right), \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                  5. /-lowering-/.f64N/A

                    \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                  6. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                  7. sub-negN/A

                    \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \left(\frac{1}{2} \cdot \frac{1}{{n}^{2}} + \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                  8. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{1}{2} \cdot \frac{1}{{n}^{2}}\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                  9. associate-*r/N/A

                    \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{\frac{1}{2} \cdot 1}{{n}^{2}}\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                  10. metadata-evalN/A

                    \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{\frac{1}{2}}{{n}^{2}}\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                  11. /-lowering-/.f64N/A

                    \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \left({n}^{2}\right)\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                  12. unpow2N/A

                    \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \left(n \cdot n\right)\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                  13. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                  14. associate-*r/N/A

                    \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot 1}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                  15. metadata-evalN/A

                    \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\mathsf{neg}\left(\frac{\frac{1}{2}}{n}\right)\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                  16. distribute-neg-fracN/A

                    \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\frac{\mathsf{neg}\left(\frac{1}{2}\right)}{n}\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                  17. metadata-evalN/A

                    \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \left(\frac{\frac{-1}{2}}{n}\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                  18. /-lowering-/.f6438.0%

                    \[\leadsto \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, n\right), \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, n\right)\right), \mathsf{/.f64}\left(\frac{-1}{2}, n\right)\right)\right)\right)\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                5. Simplified38.0%

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

                  \[\leadsto \color{blue}{\frac{x \cdot \left(1 + \frac{-1}{2} \cdot x\right) - \log x}{n}} \]
                7. Step-by-step derivation
                  1. /-lowering-/.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(\left(x \cdot \left(1 + \frac{-1}{2} \cdot x\right) - \log x\right), \color{blue}{n}\right) \]
                  2. --lowering--.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(x \cdot \left(1 + \frac{-1}{2} \cdot x\right)\right), \log x\right), n\right) \]
                  3. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \left(1 + \frac{-1}{2} \cdot x\right)\right), \log x\right), n\right) \]
                  4. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot x\right)\right)\right), \log x\right), n\right) \]
                  5. *-commutativeN/A

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left(x \cdot \frac{-1}{2}\right)\right)\right), \log x\right), n\right) \]
                  6. *-lowering-*.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \log x\right), n\right) \]
                  7. log-lowering-log.f6450.7%

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{log.f64}\left(x\right)\right), n\right) \]
                8. Simplified50.7%

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

                  \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(x - \log x\right)}, n\right) \]
                10. Step-by-step derivation
                  1. --lowering--.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x, \log x\right), n\right) \]
                  2. log-lowering-log.f6450.4%

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x, \mathsf{log.f64}\left(x\right)\right), n\right) \]
                11. Simplified50.4%

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

                if 0.00379999999999999999 < x < 4.39999999999999983e231

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

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

                  \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
                5. Applied egg-rr33.8%

                  \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
                6. Taylor expanded in n around inf

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
                7. Step-by-step derivation
                  1. log-lowering-log.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
                  2. /-lowering-/.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
                  3. +-lowering-+.f6458.1%

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
                8. Simplified58.1%

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

                  \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
                10. Step-by-step derivation
                  1. associate-*r/N/A

                    \[\leadsto \frac{-1 \cdot \left(-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}{\color{blue}{x}} \]
                  2. mul-1-negN/A

                    \[\leadsto \frac{\mathsf{neg}\left(\left(-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)\right)}{x} \]
                  3. sub-negN/A

                    \[\leadsto \frac{\mathsf{neg}\left(\left(-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \left(\mathsf{neg}\left(\frac{1}{n}\right)\right)\right)\right)}{x} \]
                  4. mul-1-negN/A

                    \[\leadsto \frac{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x}\right)\right) + \left(\mathsf{neg}\left(\frac{1}{n}\right)\right)\right)\right)}{x} \]
                  5. distribute-neg-outN/A

                    \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \frac{1}{n}\right)\right)\right)\right)}{x} \]
                  6. remove-double-negN/A

                    \[\leadsto \frac{\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \frac{1}{n}}{x} \]
                  7. /-lowering-/.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \frac{1}{n}\right), \color{blue}{x}\right) \]
                11. Simplified71.4%

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

                if 4.39999999999999983e231 < x

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

                  \[\leadsto \mathsf{\_.f64}\left(\color{blue}{1}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                4. Step-by-step derivation
                  1. Simplified59.1%

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

                    \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{1}\right) \]
                  3. Step-by-step derivation
                    1. Simplified95.2%

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

                        \[\leadsto 0 \]
                    3. Applied egg-rr95.2%

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

                    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.0038:\\ \;\;\;\;\frac{x - \log x}{n}\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{+231}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{n \cdot x}}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
                  6. Add Preprocessing

                  Alternative 13: 59.6% accurate, 1.9× speedup?

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

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

                      \[\leadsto \mathsf{\_.f64}\left(\color{blue}{1}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                    4. Step-by-step derivation
                      1. Simplified41.2%

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

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

                          \[\leadsto \frac{-1 \cdot \log x}{\color{blue}{n}} \]
                        2. mul-1-negN/A

                          \[\leadsto \frac{\mathsf{neg}\left(\log x\right)}{n} \]
                        3. log-recN/A

                          \[\leadsto \frac{\log \left(\frac{1}{x}\right)}{n} \]
                        4. /-lowering-/.f64N/A

                          \[\leadsto \mathsf{/.f64}\left(\log \left(\frac{1}{x}\right), \color{blue}{n}\right) \]
                        5. log-recN/A

                          \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\log x\right)\right), n\right) \]
                        6. mul-1-negN/A

                          \[\leadsto \mathsf{/.f64}\left(\left(-1 \cdot \log x\right), n\right) \]
                        7. *-lowering-*.f64N/A

                          \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(-1, \log x\right), n\right) \]
                        8. log-lowering-log.f6449.6%

                          \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{log.f64}\left(x\right)\right), n\right) \]
                      4. Simplified49.6%

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

                      if 0.00379999999999999999 < x < 4.39999999999999983e231

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

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

                        \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
                      5. Applied egg-rr33.8%

                        \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
                      6. Taylor expanded in n around inf

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
                      7. Step-by-step derivation
                        1. log-lowering-log.f64N/A

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
                        2. /-lowering-/.f64N/A

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
                        3. +-lowering-+.f6458.1%

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
                      8. Simplified58.1%

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

                        \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
                      10. Step-by-step derivation
                        1. associate-*r/N/A

                          \[\leadsto \frac{-1 \cdot \left(-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}{\color{blue}{x}} \]
                        2. mul-1-negN/A

                          \[\leadsto \frac{\mathsf{neg}\left(\left(-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)\right)}{x} \]
                        3. sub-negN/A

                          \[\leadsto \frac{\mathsf{neg}\left(\left(-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \left(\mathsf{neg}\left(\frac{1}{n}\right)\right)\right)\right)}{x} \]
                        4. mul-1-negN/A

                          \[\leadsto \frac{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x}\right)\right) + \left(\mathsf{neg}\left(\frac{1}{n}\right)\right)\right)\right)}{x} \]
                        5. distribute-neg-outN/A

                          \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \frac{1}{n}\right)\right)\right)\right)}{x} \]
                        6. remove-double-negN/A

                          \[\leadsto \frac{\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \frac{1}{n}}{x} \]
                        7. /-lowering-/.f64N/A

                          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \frac{1}{n}\right), \color{blue}{x}\right) \]
                      11. Simplified71.4%

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

                      if 4.39999999999999983e231 < x

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

                        \[\leadsto \mathsf{\_.f64}\left(\color{blue}{1}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                      4. Step-by-step derivation
                        1. Simplified59.1%

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

                          \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{1}\right) \]
                        3. Step-by-step derivation
                          1. Simplified95.2%

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

                              \[\leadsto 0 \]
                          3. Applied egg-rr95.2%

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

                          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.0038:\\ \;\;\;\;0 - \frac{\log x}{n}\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{+231}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{n \cdot x}}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
                        6. Add Preprocessing

                        Alternative 14: 59.5% accurate, 1.9× speedup?

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

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

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

                            \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
                          5. Applied egg-rr65.6%

                            \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
                          6. Taylor expanded in n around inf

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
                          7. Step-by-step derivation
                            1. log-lowering-log.f64N/A

                              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
                            2. /-lowering-/.f64N/A

                              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
                            3. +-lowering-+.f6450.8%

                              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
                          8. Simplified50.8%

                            \[\leadsto \frac{-1}{n} \cdot \color{blue}{\log \left(\frac{x}{1 + x}\right)} \]
                          9. Taylor expanded in x around 0

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log x}\right) \]
                          10. Step-by-step derivation
                            1. log-lowering-log.f6449.5%

                              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(x\right)\right) \]
                          11. Simplified49.5%

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

                          if 0.00379999999999999999 < x < 4.39999999999999983e231

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

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

                            \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
                          5. Applied egg-rr33.8%

                            \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
                          6. Taylor expanded in n around inf

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
                          7. Step-by-step derivation
                            1. log-lowering-log.f64N/A

                              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
                            2. /-lowering-/.f64N/A

                              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
                            3. +-lowering-+.f6458.1%

                              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
                          8. Simplified58.1%

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

                            \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
                          10. Step-by-step derivation
                            1. associate-*r/N/A

                              \[\leadsto \frac{-1 \cdot \left(-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}{\color{blue}{x}} \]
                            2. mul-1-negN/A

                              \[\leadsto \frac{\mathsf{neg}\left(\left(-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)\right)}{x} \]
                            3. sub-negN/A

                              \[\leadsto \frac{\mathsf{neg}\left(\left(-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \left(\mathsf{neg}\left(\frac{1}{n}\right)\right)\right)\right)}{x} \]
                            4. mul-1-negN/A

                              \[\leadsto \frac{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x}\right)\right) + \left(\mathsf{neg}\left(\frac{1}{n}\right)\right)\right)\right)}{x} \]
                            5. distribute-neg-outN/A

                              \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \frac{1}{n}\right)\right)\right)\right)}{x} \]
                            6. remove-double-negN/A

                              \[\leadsto \frac{\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \frac{1}{n}}{x} \]
                            7. /-lowering-/.f64N/A

                              \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \frac{1}{n}\right), \color{blue}{x}\right) \]
                          11. Simplified71.4%

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

                          if 4.39999999999999983e231 < x

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

                            \[\leadsto \mathsf{\_.f64}\left(\color{blue}{1}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                          4. Step-by-step derivation
                            1. Simplified59.1%

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

                              \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{1}\right) \]
                            3. Step-by-step derivation
                              1. Simplified95.2%

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

                                  \[\leadsto 0 \]
                              3. Applied egg-rr95.2%

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

                              \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.0038:\\ \;\;\;\;\log x \cdot \frac{-1}{n}\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{+231}:\\ \;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{0.3333333333333333}{n \cdot x}}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
                            6. Add Preprocessing

                            Alternative 15: 48.6% accurate, 9.6× speedup?

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

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

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

                                \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
                              5. Applied egg-rr55.5%

                                \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
                              6. Taylor expanded in n around inf

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
                              7. Step-by-step derivation
                                1. log-lowering-log.f64N/A

                                  \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
                                2. /-lowering-/.f64N/A

                                  \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
                                3. +-lowering-+.f6453.1%

                                  \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
                              8. Simplified53.1%

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

                                \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
                              10. Step-by-step derivation
                                1. associate-*r/N/A

                                  \[\leadsto \frac{-1 \cdot \left(-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)}{\color{blue}{x}} \]
                                2. mul-1-negN/A

                                  \[\leadsto \frac{\mathsf{neg}\left(\left(-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} - \frac{1}{n}\right)\right)}{x} \]
                                3. sub-negN/A

                                  \[\leadsto \frac{\mathsf{neg}\left(\left(-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \left(\mathsf{neg}\left(\frac{1}{n}\right)\right)\right)\right)}{x} \]
                                4. mul-1-negN/A

                                  \[\leadsto \frac{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x}\right)\right) + \left(\mathsf{neg}\left(\frac{1}{n}\right)\right)\right)\right)}{x} \]
                                5. distribute-neg-outN/A

                                  \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \frac{1}{n}\right)\right)\right)\right)}{x} \]
                                6. remove-double-negN/A

                                  \[\leadsto \frac{\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \frac{1}{n}}{x} \]
                                7. /-lowering-/.f64N/A

                                  \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} + \frac{1}{n}\right), \color{blue}{x}\right) \]
                              11. Simplified47.2%

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

                              if 2.1e234 < x

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

                                \[\leadsto \mathsf{\_.f64}\left(\color{blue}{1}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                              4. Step-by-step derivation
                                1. Simplified59.1%

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

                                  \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{1}\right) \]
                                3. Step-by-step derivation
                                  1. Simplified95.2%

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

                                      \[\leadsto 0 \]
                                  3. Applied egg-rr95.2%

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

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

                                Alternative 16: 48.7% accurate, 10.5× speedup?

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

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

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

                                    \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
                                  5. Applied egg-rr55.5%

                                    \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
                                  6. Taylor expanded in n around inf

                                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
                                  7. Step-by-step derivation
                                    1. log-lowering-log.f64N/A

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
                                    2. /-lowering-/.f64N/A

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
                                    3. +-lowering-+.f6453.1%

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
                                  8. Simplified53.1%

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

                                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\left(\frac{\frac{1}{2} \cdot \frac{1}{x} - \left(1 + \frac{\frac{1}{3}}{{x}^{2}}\right)}{x}\right)}\right) \]
                                  10. Step-by-step derivation
                                    1. /-lowering-/.f64N/A

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{/.f64}\left(\left(\frac{1}{2} \cdot \frac{1}{x} - \left(1 + \frac{\frac{1}{3}}{{x}^{2}}\right)\right), \color{blue}{x}\right)\right) \]
                                  11. Simplified47.1%

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

                                  if 9.5000000000000002e231 < x

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

                                    \[\leadsto \mathsf{\_.f64}\left(\color{blue}{1}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                                  4. Step-by-step derivation
                                    1. Simplified59.1%

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

                                      \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{1}\right) \]
                                    3. Step-by-step derivation
                                      1. Simplified95.2%

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

                                          \[\leadsto 0 \]
                                      3. Applied egg-rr95.2%

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

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

                                    Alternative 17: 46.0% accurate, 14.0× speedup?

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

                                      1. Initial program 41.4%

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

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

                                        \[\leadsto \color{blue}{\frac{\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) - \frac{0.041666666666666664}{n} \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right)}{n}}{n}}{0 - n}} \]
                                      5. Applied egg-rr46.5%

                                        \[\leadsto \color{blue}{\frac{-1}{n} \cdot \left(\log \left(\frac{x}{x + 1}\right) - \frac{0.5 \cdot \left(\log \left(x \cdot \left(x + 1\right)\right) \cdot \log \left(\frac{x + 1}{x}\right)\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + \left({\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}\right) \cdot \frac{-0.041666666666666664}{n}}{n}}{n}\right)} \]
                                      6. Taylor expanded in n around inf

                                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \color{blue}{\log \left(\frac{x}{1 + x}\right)}\right) \]
                                      7. Step-by-step derivation
                                        1. log-lowering-log.f64N/A

                                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\left(\frac{x}{1 + x}\right)\right)\right) \]
                                        2. /-lowering-/.f64N/A

                                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \left(1 + x\right)\right)\right)\right) \]
                                        3. +-lowering-+.f6465.7%

                                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, n\right), \mathsf{log.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(1, x\right)\right)\right)\right) \]
                                      8. Simplified65.7%

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

                                        \[\leadsto \color{blue}{\frac{1}{n \cdot x}} \]
                                      10. Step-by-step derivation
                                        1. associate-/r*N/A

                                          \[\leadsto \frac{\frac{1}{n}}{\color{blue}{x}} \]
                                        2. /-lowering-/.f64N/A

                                          \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{n}\right), \color{blue}{x}\right) \]
                                        3. /-lowering-/.f6453.3%

                                          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, n\right), x\right) \]
                                      11. Simplified53.3%

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

                                      if -3.40000000000000006e-6 < n < -9.4999999999999999e-234

                                      1. Initial program 100.0%

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

                                        \[\leadsto \mathsf{\_.f64}\left(\color{blue}{1}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                                      4. Step-by-step derivation
                                        1. Simplified49.4%

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

                                          \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{1}\right) \]
                                        3. Step-by-step derivation
                                          1. Simplified53.0%

                                            \[\leadsto 1 - \color{blue}{1} \]
                                          2. Step-by-step derivation
                                            1. metadata-eval53.0%

                                              \[\leadsto 0 \]
                                          3. Applied egg-rr53.0%

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

                                          if -9.4999999999999999e-234 < n

                                          1. Initial program 42.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. pow-to-expN/A

                                              \[\leadsto \mathsf{\_.f64}\left(\left(e^{\log \left(x + 1\right) \cdot \frac{1}{n}}\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                                            2. exp-lowering-exp.f64N/A

                                              \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\log \left(x + 1\right) \cdot \frac{1}{n}\right)\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                                            3. un-div-invN/A

                                              \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\frac{\log \left(x + 1\right)}{n}\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                                            4. /-lowering-/.f64N/A

                                              \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(x + 1\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                                            5. +-commutativeN/A

                                              \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(1 + x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                                            6. log1p-defineN/A

                                              \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{log1p}\left(x\right)\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                                            7. log1p-lowering-log1p.f6457.3%

                                              \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log1p.f64}\left(x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                                          4. Applied egg-rr57.3%

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

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

                                              \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{\log \left(\frac{1}{x}\right)}{n}\right)}}{n \cdot x} \]
                                            2. log-recN/A

                                              \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{\mathsf{neg}\left(\log x\right)}{n}\right)}}{n \cdot x} \]
                                            3. mul-1-negN/A

                                              \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
                                            4. associate-*r/N/A

                                              \[\leadsto \frac{e^{\mathsf{neg}\left(-1 \cdot \frac{\log x}{n}\right)}}{n \cdot x} \]
                                            5. mul-1-negN/A

                                              \[\leadsto \frac{e^{\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{\log x}{n}\right)\right)\right)}}{n \cdot x} \]
                                            6. remove-double-negN/A

                                              \[\leadsto \frac{e^{\frac{\log x}{n}}}{n \cdot x} \]
                                            7. /-lowering-/.f64N/A

                                              \[\leadsto \mathsf{/.f64}\left(\left(e^{\frac{\log x}{n}}\right), \color{blue}{\left(n \cdot x\right)}\right) \]
                                            8. exp-lowering-exp.f64N/A

                                              \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\left(\frac{\log x}{n}\right)\right), \left(\color{blue}{n} \cdot x\right)\right) \]
                                            9. /-lowering-/.f64N/A

                                              \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log x, n\right)\right), \left(n \cdot x\right)\right) \]
                                            10. log-lowering-log.f64N/A

                                              \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \left(n \cdot x\right)\right) \]
                                            11. *-commutativeN/A

                                              \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \left(x \cdot \color{blue}{n}\right)\right) \]
                                            12. *-lowering-*.f6438.6%

                                              \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \mathsf{*.f64}\left(x, \color{blue}{n}\right)\right) \]
                                          7. Simplified38.6%

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

                                            \[\leadsto \mathsf{/.f64}\left(\color{blue}{1}, \mathsf{*.f64}\left(x, n\right)\right) \]
                                          9. Step-by-step derivation
                                            1. Simplified41.3%

                                              \[\leadsto \frac{\color{blue}{1}}{x \cdot n} \]
                                          10. Recombined 3 regimes into one program.
                                          11. Final simplification46.7%

                                            \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -3.4 \cdot 10^{-6}:\\ \;\;\;\;\frac{\frac{1}{n}}{x}\\ \mathbf{elif}\;n \leq -9.5 \cdot 10^{-234}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{n \cdot x}\\ \end{array} \]
                                          12. Add Preprocessing

                                          Alternative 18: 45.7% accurate, 14.0× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{n \cdot x}\\ \mathbf{if}\;n \leq -3.3 \cdot 10^{-6}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;n \leq -4.8 \cdot 10^{-234}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                                          (FPCore (x n)
                                           :precision binary64
                                           (let* ((t_0 (/ 1.0 (* n x))))
                                             (if (<= n -3.3e-6) t_0 (if (<= n -4.8e-234) 0.0 t_0))))
                                          double code(double x, double n) {
                                          	double t_0 = 1.0 / (n * x);
                                          	double tmp;
                                          	if (n <= -3.3e-6) {
                                          		tmp = t_0;
                                          	} else if (n <= -4.8e-234) {
                                          		tmp = 0.0;
                                          	} 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) :: tmp
                                              t_0 = 1.0d0 / (n * x)
                                              if (n <= (-3.3d-6)) then
                                                  tmp = t_0
                                              else if (n <= (-4.8d-234)) then
                                                  tmp = 0.0d0
                                              else
                                                  tmp = t_0
                                              end if
                                              code = tmp
                                          end function
                                          
                                          public static double code(double x, double n) {
                                          	double t_0 = 1.0 / (n * x);
                                          	double tmp;
                                          	if (n <= -3.3e-6) {
                                          		tmp = t_0;
                                          	} else if (n <= -4.8e-234) {
                                          		tmp = 0.0;
                                          	} else {
                                          		tmp = t_0;
                                          	}
                                          	return tmp;
                                          }
                                          
                                          def code(x, n):
                                          	t_0 = 1.0 / (n * x)
                                          	tmp = 0
                                          	if n <= -3.3e-6:
                                          		tmp = t_0
                                          	elif n <= -4.8e-234:
                                          		tmp = 0.0
                                          	else:
                                          		tmp = t_0
                                          	return tmp
                                          
                                          function code(x, n)
                                          	t_0 = Float64(1.0 / Float64(n * x))
                                          	tmp = 0.0
                                          	if (n <= -3.3e-6)
                                          		tmp = t_0;
                                          	elseif (n <= -4.8e-234)
                                          		tmp = 0.0;
                                          	else
                                          		tmp = t_0;
                                          	end
                                          	return tmp
                                          end
                                          
                                          function tmp_2 = code(x, n)
                                          	t_0 = 1.0 / (n * x);
                                          	tmp = 0.0;
                                          	if (n <= -3.3e-6)
                                          		tmp = t_0;
                                          	elseif (n <= -4.8e-234)
                                          		tmp = 0.0;
                                          	else
                                          		tmp = t_0;
                                          	end
                                          	tmp_2 = tmp;
                                          end
                                          
                                          code[x_, n_] := Block[{t$95$0 = N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -3.3e-6], t$95$0, If[LessEqual[n, -4.8e-234], 0.0, t$95$0]]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          t_0 := \frac{1}{n \cdot x}\\
                                          \mathbf{if}\;n \leq -3.3 \cdot 10^{-6}:\\
                                          \;\;\;\;t\_0\\
                                          
                                          \mathbf{elif}\;n \leq -4.8 \cdot 10^{-234}:\\
                                          \;\;\;\;0\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;t\_0\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if n < -3.30000000000000017e-6 or -4.7999999999999998e-234 < n

                                            1. Initial program 42.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. pow-to-expN/A

                                                \[\leadsto \mathsf{\_.f64}\left(\left(e^{\log \left(x + 1\right) \cdot \frac{1}{n}}\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                                              2. exp-lowering-exp.f64N/A

                                                \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\log \left(x + 1\right) \cdot \frac{1}{n}\right)\right), \mathsf{pow.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                                              3. un-div-invN/A

                                                \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\left(\frac{\log \left(x + 1\right)}{n}\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                                              4. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(x + 1\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                                              5. +-commutativeN/A

                                                \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log \left(1 + x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                                              6. log1p-defineN/A

                                                \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{log1p}\left(x\right)\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                                              7. log1p-lowering-log1p.f6451.8%

                                                \[\leadsto \mathsf{\_.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log1p.f64}\left(x\right), n\right)\right), \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                                            4. Applied egg-rr51.8%

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

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

                                                \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{\log \left(\frac{1}{x}\right)}{n}\right)}}{n \cdot x} \]
                                              2. log-recN/A

                                                \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{\mathsf{neg}\left(\log x\right)}{n}\right)}}{n \cdot x} \]
                                              3. mul-1-negN/A

                                                \[\leadsto \frac{e^{\mathsf{neg}\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
                                              4. associate-*r/N/A

                                                \[\leadsto \frac{e^{\mathsf{neg}\left(-1 \cdot \frac{\log x}{n}\right)}}{n \cdot x} \]
                                              5. mul-1-negN/A

                                                \[\leadsto \frac{e^{\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{\log x}{n}\right)\right)\right)}}{n \cdot x} \]
                                              6. remove-double-negN/A

                                                \[\leadsto \frac{e^{\frac{\log x}{n}}}{n \cdot x} \]
                                              7. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\left(e^{\frac{\log x}{n}}\right), \color{blue}{\left(n \cdot x\right)}\right) \]
                                              8. exp-lowering-exp.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\left(\frac{\log x}{n}\right)\right), \left(\color{blue}{n} \cdot x\right)\right) \]
                                              9. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\log x, n\right)\right), \left(n \cdot x\right)\right) \]
                                              10. log-lowering-log.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \left(n \cdot x\right)\right) \]
                                              11. *-commutativeN/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \left(x \cdot \color{blue}{n}\right)\right) \]
                                              12. *-lowering-*.f6445.4%

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{log.f64}\left(x\right), n\right)\right), \mathsf{*.f64}\left(x, \color{blue}{n}\right)\right) \]
                                            7. Simplified45.4%

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

                                              \[\leadsto \mathsf{/.f64}\left(\color{blue}{1}, \mathsf{*.f64}\left(x, n\right)\right) \]
                                            9. Step-by-step derivation
                                              1. Simplified44.9%

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

                                              if -3.30000000000000017e-6 < n < -4.7999999999999998e-234

                                              1. Initial program 100.0%

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

                                                \[\leadsto \mathsf{\_.f64}\left(\color{blue}{1}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                                              4. Step-by-step derivation
                                                1. Simplified49.4%

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

                                                  \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{1}\right) \]
                                                3. Step-by-step derivation
                                                  1. Simplified53.0%

                                                    \[\leadsto 1 - \color{blue}{1} \]
                                                  2. Step-by-step derivation
                                                    1. metadata-eval53.0%

                                                      \[\leadsto 0 \]
                                                  3. Applied egg-rr53.0%

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

                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -3.3 \cdot 10^{-6}:\\ \;\;\;\;\frac{1}{n \cdot x}\\ \mathbf{elif}\;n \leq -4.8 \cdot 10^{-234}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{n \cdot x}\\ \end{array} \]
                                                6. Add Preprocessing

                                                Alternative 19: 30.7% 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 52.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

                                                  \[\leadsto \mathsf{\_.f64}\left(\color{blue}{1}, \mathsf{pow.f64}\left(x, \mathsf{/.f64}\left(1, n\right)\right)\right) \]
                                                4. Step-by-step derivation
                                                  1. Simplified40.3%

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

                                                    \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{1}\right) \]
                                                  3. Step-by-step derivation
                                                    1. Simplified28.3%

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

                                                        \[\leadsto 0 \]
                                                    3. Applied egg-rr28.3%

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

                                                    Reproduce

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