2nthrt (problem 3.4.6)

Percentage Accurate: 53.6% → 86.7%
Time: 1.6min
Alternatives: 9
Speedup: N/A×

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));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, n)
use fmin_fmax_functions
    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}

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 9 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.6% 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));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, n)
use fmin_fmax_functions
    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.7% accurate, N/A× speedup?

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

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

\mathbf{elif}\;\frac{1}{n} \leq 10^{-15}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n}, 0.5, \mathsf{log1p}\left(x\right)\right)}{n} - \frac{\mathsf{fma}\left(\frac{{\log x}^{2}}{n}, 0.5, \log x\right)}{n}\\

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


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

    1. Initial program 99.5%

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

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

    1. Initial program 29.2%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. 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}} \]
    3. Step-by-step derivation
      1. div-subN/A

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

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

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

    if 1.0000000000000001e-15 < (/.f64 #s(literal 1 binary64) n)

    1. Initial program 51.1%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto {\left(x + 1\right)}^{\color{blue}{\left(\frac{1}{n}\right)}} - {x}^{\left(\frac{1}{n}\right)} \]
      3. lift-pow.f64N/A

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} - {x}^{\left(\frac{1}{n}\right)} \]
      4. pow-to-expN/A

        \[\leadsto \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}} - {x}^{\left(\frac{1}{n}\right)} \]
      5. lower-exp.f64N/A

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

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

        \[\leadsto e^{\color{blue}{\log \left(1 + x\right) \cdot \frac{1}{n}}} - {x}^{\left(\frac{1}{n}\right)} \]
      8. lower-log1p.f64N/A

        \[\leadsto e^{\color{blue}{\mathsf{log1p}\left(x\right)} \cdot \frac{1}{n}} - {x}^{\left(\frac{1}{n}\right)} \]
      9. inv-powN/A

        \[\leadsto e^{\mathsf{log1p}\left(x\right) \cdot \color{blue}{{n}^{-1}}} - {x}^{\left(\frac{1}{n}\right)} \]
      10. lower-pow.f6494.5

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

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

Alternative 2: 86.6% accurate, N/A× speedup?

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

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

\mathbf{elif}\;\frac{1}{n} \leq 10^{-15}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n}, 0.5, \mathsf{log1p}\left(x\right)\right)}{n} - \frac{\mathsf{fma}\left(\frac{{\log x}^{2}}{n}, 0.5, \log x\right)}{n}\\

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


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

    1. Initial program 82.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto {\left(x + 1\right)}^{\color{blue}{\left(\frac{1}{n}\right)}} - {x}^{\left(\frac{1}{n}\right)} \]
      3. lift-pow.f64N/A

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} - {x}^{\left(\frac{1}{n}\right)} \]
      4. pow-to-expN/A

        \[\leadsto \color{blue}{e^{\log \left(x + 1\right) \cdot \frac{1}{n}}} - {x}^{\left(\frac{1}{n}\right)} \]
      5. lower-exp.f64N/A

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

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

        \[\leadsto e^{\color{blue}{\log \left(1 + x\right) \cdot \frac{1}{n}}} - {x}^{\left(\frac{1}{n}\right)} \]
      8. lower-log1p.f64N/A

        \[\leadsto e^{\color{blue}{\mathsf{log1p}\left(x\right)} \cdot \frac{1}{n}} - {x}^{\left(\frac{1}{n}\right)} \]
      9. inv-powN/A

        \[\leadsto e^{\mathsf{log1p}\left(x\right) \cdot \color{blue}{{n}^{-1}}} - {x}^{\left(\frac{1}{n}\right)} \]
      10. lower-pow.f6497.7

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

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

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

    1. Initial program 29.2%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. 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}} \]
    3. Step-by-step derivation
      1. div-subN/A

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

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

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

Alternative 3: 83.2% accurate, N/A× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\mathsf{log1p}\left(x\right)}{n}\\
t_1 := \frac{\log x}{n}\\
t_2 := -1 \cdot \log x\\
t_3 := e^{t\_1}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-30}:\\
\;\;\;\;\frac{{\left(e^{-1}\right)}^{\left(\frac{t\_2}{n}\right)}}{n \cdot x}\\

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

\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+173}:\\
\;\;\;\;\frac{{\left(e^{3}\right)}^{t\_0} - e^{t\_1 \cdot 3}}{\mathsf{fma}\left(t\_3, e^{t\_0}, \mathsf{fma}\left(t\_3, t\_3, e^{t\_0 \cdot 2}\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{\left(-3 \cdot \mathsf{log1p}\left(x\right)\right) \cdot n - n \cdot \mathsf{fma}\left(-2, \log x, t\_2\right)}{n \cdot n}\\


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

    1. Initial program 93.1%

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

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

        \[\leadsto \frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{\color{blue}{n \cdot x}} \]
      2. exp-prodN/A

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

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

        \[\leadsto \frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      5. lower-pow.f64N/A

        \[\leadsto \frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{\color{blue}{n} \cdot x} \]
      6. lower-exp.f64N/A

        \[\leadsto \frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      7. lower-/.f64N/A

        \[\leadsto \frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      8. lower-*.f64N/A

        \[\leadsto \frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      9. lower-log.f64N/A

        \[\leadsto \frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      10. lower-*.f6495.6

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

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

    if -4.99999999999999972e-30 < (/.f64 #s(literal 1 binary64) n) < 3.99999999999999992e-12

    1. Initial program 29.6%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. 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}} \]
    3. Step-by-step derivation
      1. div-subN/A

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

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

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

    if 3.99999999999999992e-12 < (/.f64 #s(literal 1 binary64) n) < 5.00000000000000034e173

    1. Initial program 70.3%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Step-by-step derivation
      1. lift--.f64N/A

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

        \[\leadsto {\color{blue}{\left(x + 1\right)}}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
      3. lift-/.f64N/A

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

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} - {x}^{\left(\frac{1}{n}\right)} \]
      5. lift-/.f64N/A

        \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\color{blue}{\left(\frac{1}{n}\right)}} \]
      6. lift-pow.f64N/A

        \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \color{blue}{{x}^{\left(\frac{1}{n}\right)}} \]
      7. flip3--N/A

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

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

      \[\leadsto \color{blue}{\frac{{\left(1 + x\right)}^{\left({n}^{-1} \cdot 3\right)} - {\left({x}^{\left({n}^{-1}\right)}\right)}^{3}}{\mathsf{fma}\left({\left(1 + x\right)}^{\left({n}^{-1}\right)}, {\left(1 + x\right)}^{\left({n}^{-1}\right)}, \mathsf{fma}\left({x}^{\left({n}^{-1}\right)}, {x}^{\left({n}^{-1}\right)}, {\left(1 + x\right)}^{\left({n}^{-1}\right)} \cdot {x}^{\left({n}^{-1}\right)}\right)\right)}} \]
    4. Taylor expanded in n around 0

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

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

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

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

    1. Initial program 25.1%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Step-by-step derivation
      1. lift--.f64N/A

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

        \[\leadsto {\color{blue}{\left(x + 1\right)}}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
      3. lift-/.f64N/A

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

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} - {x}^{\left(\frac{1}{n}\right)} \]
      5. lift-/.f64N/A

        \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\color{blue}{\left(\frac{1}{n}\right)}} \]
      6. lift-pow.f64N/A

        \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \color{blue}{{x}^{\left(\frac{1}{n}\right)}} \]
      7. flip3--N/A

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

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

      \[\leadsto \color{blue}{\frac{{\left(1 + x\right)}^{\left({n}^{-1} \cdot 3\right)} - {\left({x}^{\left({n}^{-1}\right)}\right)}^{3}}{\mathsf{fma}\left({\left(1 + x\right)}^{\left({n}^{-1}\right)}, {\left(1 + x\right)}^{\left({n}^{-1}\right)}, \mathsf{fma}\left({x}^{\left({n}^{-1}\right)}, {x}^{\left({n}^{-1}\right)}, {\left(1 + x\right)}^{\left({n}^{-1}\right)} \cdot {x}^{\left({n}^{-1}\right)}\right)\right)}} \]
    4. Taylor expanded in n around -inf

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.3333333333333333 \cdot \left(\frac{-3 \cdot \mathsf{log1p}\left(x\right)}{n} - \frac{\mathsf{fma}\left(-2, \log x, -1 \cdot \log x\right)}{n}\right)} \]
    7. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \left(\frac{-3 \cdot \mathsf{log1p}\left(x\right)}{n} - \color{blue}{\frac{\mathsf{fma}\left(-2, \log x, -1 \cdot \log x\right)}{n}}\right) \]
      2. lift-/.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \left(\frac{-3 \cdot \mathsf{log1p}\left(x\right)}{n} - \frac{\color{blue}{\mathsf{fma}\left(-2, \log x, -1 \cdot \log x\right)}}{n}\right) \]
      3. lift-*.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \left(\frac{-3 \cdot \mathsf{log1p}\left(x\right)}{n} - \frac{\mathsf{fma}\left(\color{blue}{-2}, \log x, -1 \cdot \log x\right)}{n}\right) \]
      4. lift-log1p.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \left(\frac{-3 \cdot \log \left(1 + x\right)}{n} - \frac{\mathsf{fma}\left(-2, \log x, -1 \cdot \log x\right)}{n}\right) \]
      5. lift-/.f64N/A

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

        \[\leadsto \frac{-1}{3} \cdot \left(\frac{-3 \cdot \log \left(1 + x\right)}{n} - \frac{\mathsf{fma}\left(-2, \log x, -1 \cdot \log x\right)}{n}\right) \]
      7. lift-fma.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \left(\frac{-3 \cdot \log \left(1 + x\right)}{n} - \frac{-2 \cdot \log x + -1 \cdot \log x}{n}\right) \]
      8. lift-*.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \left(\frac{-3 \cdot \log \left(1 + x\right)}{n} - \frac{-2 \cdot \log x + -1 \cdot \log x}{n}\right) \]
      9. lift-log.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \left(\frac{-3 \cdot \log \left(1 + x\right)}{n} - \frac{-2 \cdot \log x + -1 \cdot \log x}{n}\right) \]
      10. frac-subN/A

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

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

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

      \[\leadsto -0.3333333333333333 \cdot \frac{\left(-3 \cdot \mathsf{log1p}\left(x\right)\right) \cdot n - n \cdot \mathsf{fma}\left(-2, \log x, -1 \cdot \log x\right)}{\color{blue}{n \cdot n}} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 4: 77.3% accurate, N/A× speedup?

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

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

\mathbf{elif}\;\frac{1}{n} \leq 10^{-98}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n}, 0.5, \mathsf{log1p}\left(x\right)\right)}{n} - \frac{\mathsf{fma}\left(\frac{{\log x}^{2}}{n}, 0.5, \log x\right)}{n}\\

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

\mathbf{else}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{\left(-3 \cdot \mathsf{log1p}\left(x\right)\right) \cdot n - n \cdot \mathsf{fma}\left(-2, \log x, t\_0\right)}{n \cdot n}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 #s(literal 1 binary64) n) < -4.99999999999999972e-30 or 9.99999999999999939e-99 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999943e-68

    1. Initial program 87.9%

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

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

        \[\leadsto \frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{\color{blue}{n \cdot x}} \]
      2. exp-prodN/A

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

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

        \[\leadsto \frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      5. lower-pow.f64N/A

        \[\leadsto \frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{\color{blue}{n} \cdot x} \]
      6. lower-exp.f64N/A

        \[\leadsto \frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      7. lower-/.f64N/A

        \[\leadsto \frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      8. lower-*.f64N/A

        \[\leadsto \frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      9. lower-log.f64N/A

        \[\leadsto \frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      10. lower-*.f6492.5

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

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

    if -4.99999999999999972e-30 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999939e-99

    1. Initial program 32.4%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. 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}} \]
    3. Step-by-step derivation
      1. div-subN/A

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

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

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

    if 9.99999999999999943e-68 < (/.f64 #s(literal 1 binary64) n)

    1. Initial program 41.3%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. Step-by-step derivation
      1. lift--.f64N/A

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

        \[\leadsto {\color{blue}{\left(x + 1\right)}}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
      3. lift-/.f64N/A

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

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} - {x}^{\left(\frac{1}{n}\right)} \]
      5. lift-/.f64N/A

        \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\color{blue}{\left(\frac{1}{n}\right)}} \]
      6. lift-pow.f64N/A

        \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \color{blue}{{x}^{\left(\frac{1}{n}\right)}} \]
      7. flip3--N/A

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

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

      \[\leadsto \color{blue}{\frac{{\left(1 + x\right)}^{\left({n}^{-1} \cdot 3\right)} - {\left({x}^{\left({n}^{-1}\right)}\right)}^{3}}{\mathsf{fma}\left({\left(1 + x\right)}^{\left({n}^{-1}\right)}, {\left(1 + x\right)}^{\left({n}^{-1}\right)}, \mathsf{fma}\left({x}^{\left({n}^{-1}\right)}, {x}^{\left({n}^{-1}\right)}, {\left(1 + x\right)}^{\left({n}^{-1}\right)} \cdot {x}^{\left({n}^{-1}\right)}\right)\right)}} \]
    4. Taylor expanded in n around -inf

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{3} \cdot \left(\frac{-3 \cdot \mathsf{log1p}\left(x\right)}{n} - \frac{-2 \cdot \log x + -1 \cdot \log x}{\color{blue}{n}}\right) \]
    6. Applied rewrites20.4%

      \[\leadsto \color{blue}{-0.3333333333333333 \cdot \left(\frac{-3 \cdot \mathsf{log1p}\left(x\right)}{n} - \frac{\mathsf{fma}\left(-2, \log x, -1 \cdot \log x\right)}{n}\right)} \]
    7. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \left(\frac{-3 \cdot \mathsf{log1p}\left(x\right)}{n} - \color{blue}{\frac{\mathsf{fma}\left(-2, \log x, -1 \cdot \log x\right)}{n}}\right) \]
      2. lift-/.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \left(\frac{-3 \cdot \mathsf{log1p}\left(x\right)}{n} - \frac{\color{blue}{\mathsf{fma}\left(-2, \log x, -1 \cdot \log x\right)}}{n}\right) \]
      3. lift-*.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \left(\frac{-3 \cdot \mathsf{log1p}\left(x\right)}{n} - \frac{\mathsf{fma}\left(\color{blue}{-2}, \log x, -1 \cdot \log x\right)}{n}\right) \]
      4. lift-log1p.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \left(\frac{-3 \cdot \log \left(1 + x\right)}{n} - \frac{\mathsf{fma}\left(-2, \log x, -1 \cdot \log x\right)}{n}\right) \]
      5. lift-/.f64N/A

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

        \[\leadsto \frac{-1}{3} \cdot \left(\frac{-3 \cdot \log \left(1 + x\right)}{n} - \frac{\mathsf{fma}\left(-2, \log x, -1 \cdot \log x\right)}{n}\right) \]
      7. lift-fma.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \left(\frac{-3 \cdot \log \left(1 + x\right)}{n} - \frac{-2 \cdot \log x + -1 \cdot \log x}{n}\right) \]
      8. lift-*.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \left(\frac{-3 \cdot \log \left(1 + x\right)}{n} - \frac{-2 \cdot \log x + -1 \cdot \log x}{n}\right) \]
      9. lift-log.f64N/A

        \[\leadsto \frac{-1}{3} \cdot \left(\frac{-3 \cdot \log \left(1 + x\right)}{n} - \frac{-2 \cdot \log x + -1 \cdot \log x}{n}\right) \]
      10. frac-subN/A

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

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

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

      \[\leadsto -0.3333333333333333 \cdot \frac{\left(-3 \cdot \mathsf{log1p}\left(x\right)\right) \cdot n - n \cdot \mathsf{fma}\left(-2, \log x, -1 \cdot \log x\right)}{\color{blue}{n \cdot n}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 74.5% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\log x}^{3}\\ t_1 := {\left(x \cdot x\right)}^{-1}\\ t_2 := \frac{\log x}{{x}^{4}}\\ t_3 := {\log x}^{2}\\ t_4 := \frac{t\_3}{{x}^{4}}\\ t_5 := \frac{\log x}{x \cdot x}\\ t_6 := \left(x \cdot x\right) \cdot x\\ t_7 := \frac{\log x}{t\_6}\\ t_8 := \frac{t\_3}{t\_6}\\ t_9 := {t\_6}^{-1}\\ t_10 := \frac{\log x}{x}\\ t_11 := {\left({x}^{4}\right)}^{-1}\\ t_12 := \frac{t\_3}{x \cdot x}\\ \mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-30}:\\ \;\;\;\;\frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x}\\ \mathbf{elif}\;\frac{1}{n} \leq 10^{-98}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n}, 0.5, \mathsf{log1p}\left(x\right)\right)}{n} - \frac{\mathsf{fma}\left(\frac{t\_3}{n}, 0.5, \log x\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.25, t\_2, \mathsf{fma}\left(-0.25, t\_8, \mathsf{fma}\left(-0.08333333333333333, \frac{t\_0}{x \cdot x}, \mathsf{fma}\left(-0.041666666666666664, \frac{t\_0}{{x}^{4}}, \mathsf{fma}\left(0.041666666666666664, t\_11, \mathsf{fma}\left(0.05555555555555555, {t\_10}^{3}, 0.16666666666666666 \cdot t\_7 + \mathsf{fma}\left(0.16666666666666666, \frac{t\_0}{x}, \mathsf{fma}\left(0.22916666666666666, t\_4, 0.25 \cdot t\_12\right)\right)\right)\right)\right)\right)\right)\right)}{n}, \mathsf{fma}\left(-0.5, t\_5, \mathsf{fma}\left(-0.5, \frac{t\_3}{x}, -0.4583333333333333 \cdot t\_2 + \left(-0.16666666666666666 \cdot t\_8 + \left(0.125 \cdot t\_4 + \mathsf{fma}\left(0.25, t\_11, \mathsf{fma}\left(0.25, t\_12, 0.5 \cdot t\_7\right)\right)\right)\right)\right)\right)\right) - 0.16666666666666666 \cdot t\_9}{n}, \mathsf{fma}\left(-0.5, t\_5, \mathsf{fma}\left(-0.25, t\_2, \mathsf{fma}\left(0.3333333333333333, t\_7, \mathsf{fma}\left(0.4583333333333333, t\_11, \mathsf{fma}\left(0.5, t\_1, t\_10\right)\right)\right)\right)\right)\right) - 0.5 \cdot t\_9}{n}, \frac{-1}{x} + \left(\frac{\mathsf{fma}\left(0.25, t\_9, 0.5 \cdot {x}^{-1}\right)}{x} - \frac{0.3333333333333333 \cdot t\_1}{x}\right)\right)}{n}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (pow (log x) 3.0))
        (t_1 (pow (* x x) -1.0))
        (t_2 (/ (log x) (pow x 4.0)))
        (t_3 (pow (log x) 2.0))
        (t_4 (/ t_3 (pow x 4.0)))
        (t_5 (/ (log x) (* x x)))
        (t_6 (* (* x x) x))
        (t_7 (/ (log x) t_6))
        (t_8 (/ t_3 t_6))
        (t_9 (pow t_6 -1.0))
        (t_10 (/ (log x) x))
        (t_11 (pow (pow x 4.0) -1.0))
        (t_12 (/ t_3 (* x x))))
   (if (<= (/ 1.0 n) -5e-30)
     (/ (pow (exp -1.0) (/ (* -1.0 (log x)) n)) (* n x))
     (if (<= (/ 1.0 n) 1e-98)
       (-
        (/ (fma (/ (pow (log1p x) 2.0) n) 0.5 (log1p x)) n)
        (/ (fma (/ t_3 n) 0.5 (log x)) n))
       (*
        -1.0
        (/
         (fma
          -1.0
          (/
           (-
            (fma
             -1.0
             (/
              (-
               (fma
                -1.0
                (/
                 (fma
                  -0.25
                  t_2
                  (fma
                   -0.25
                   t_8
                   (fma
                    -0.08333333333333333
                    (/ t_0 (* x x))
                    (fma
                     -0.041666666666666664
                     (/ t_0 (pow x 4.0))
                     (fma
                      0.041666666666666664
                      t_11
                      (fma
                       0.05555555555555555
                       (pow t_10 3.0)
                       (+
                        (* 0.16666666666666666 t_7)
                        (fma
                         0.16666666666666666
                         (/ t_0 x)
                         (fma 0.22916666666666666 t_4 (* 0.25 t_12))))))))))
                 n)
                (fma
                 -0.5
                 t_5
                 (fma
                  -0.5
                  (/ t_3 x)
                  (+
                   (* -0.4583333333333333 t_2)
                   (+
                    (* -0.16666666666666666 t_8)
                    (+
                     (* 0.125 t_4)
                     (fma 0.25 t_11 (fma 0.25 t_12 (* 0.5 t_7)))))))))
               (* 0.16666666666666666 t_9))
              n)
             (fma
              -0.5
              t_5
              (fma
               -0.25
               t_2
               (fma
                0.3333333333333333
                t_7
                (fma 0.4583333333333333 t_11 (fma 0.5 t_1 t_10))))))
            (* 0.5 t_9))
           n)
          (+
           (/ -1.0 x)
           (-
            (/ (fma 0.25 t_9 (* 0.5 (pow x -1.0))) x)
            (/ (* 0.3333333333333333 t_1) x))))
         n))))))
double code(double x, double n) {
	double t_0 = pow(log(x), 3.0);
	double t_1 = pow((x * x), -1.0);
	double t_2 = log(x) / pow(x, 4.0);
	double t_3 = pow(log(x), 2.0);
	double t_4 = t_3 / pow(x, 4.0);
	double t_5 = log(x) / (x * x);
	double t_6 = (x * x) * x;
	double t_7 = log(x) / t_6;
	double t_8 = t_3 / t_6;
	double t_9 = pow(t_6, -1.0);
	double t_10 = log(x) / x;
	double t_11 = pow(pow(x, 4.0), -1.0);
	double t_12 = t_3 / (x * x);
	double tmp;
	if ((1.0 / n) <= -5e-30) {
		tmp = pow(exp(-1.0), ((-1.0 * log(x)) / n)) / (n * x);
	} else if ((1.0 / n) <= 1e-98) {
		tmp = (fma((pow(log1p(x), 2.0) / n), 0.5, log1p(x)) / n) - (fma((t_3 / n), 0.5, log(x)) / n);
	} else {
		tmp = -1.0 * (fma(-1.0, ((fma(-1.0, ((fma(-1.0, (fma(-0.25, t_2, fma(-0.25, t_8, fma(-0.08333333333333333, (t_0 / (x * x)), fma(-0.041666666666666664, (t_0 / pow(x, 4.0)), fma(0.041666666666666664, t_11, fma(0.05555555555555555, pow(t_10, 3.0), ((0.16666666666666666 * t_7) + fma(0.16666666666666666, (t_0 / x), fma(0.22916666666666666, t_4, (0.25 * t_12)))))))))) / n), fma(-0.5, t_5, fma(-0.5, (t_3 / x), ((-0.4583333333333333 * t_2) + ((-0.16666666666666666 * t_8) + ((0.125 * t_4) + fma(0.25, t_11, fma(0.25, t_12, (0.5 * t_7))))))))) - (0.16666666666666666 * t_9)) / n), fma(-0.5, t_5, fma(-0.25, t_2, fma(0.3333333333333333, t_7, fma(0.4583333333333333, t_11, fma(0.5, t_1, t_10)))))) - (0.5 * t_9)) / n), ((-1.0 / x) + ((fma(0.25, t_9, (0.5 * pow(x, -1.0))) / x) - ((0.3333333333333333 * t_1) / x)))) / n);
	}
	return tmp;
}
function code(x, n)
	t_0 = log(x) ^ 3.0
	t_1 = Float64(x * x) ^ -1.0
	t_2 = Float64(log(x) / (x ^ 4.0))
	t_3 = log(x) ^ 2.0
	t_4 = Float64(t_3 / (x ^ 4.0))
	t_5 = Float64(log(x) / Float64(x * x))
	t_6 = Float64(Float64(x * x) * x)
	t_7 = Float64(log(x) / t_6)
	t_8 = Float64(t_3 / t_6)
	t_9 = t_6 ^ -1.0
	t_10 = Float64(log(x) / x)
	t_11 = (x ^ 4.0) ^ -1.0
	t_12 = Float64(t_3 / Float64(x * x))
	tmp = 0.0
	if (Float64(1.0 / n) <= -5e-30)
		tmp = Float64((exp(-1.0) ^ Float64(Float64(-1.0 * log(x)) / n)) / Float64(n * x));
	elseif (Float64(1.0 / n) <= 1e-98)
		tmp = Float64(Float64(fma(Float64((log1p(x) ^ 2.0) / n), 0.5, log1p(x)) / n) - Float64(fma(Float64(t_3 / n), 0.5, log(x)) / n));
	else
		tmp = Float64(-1.0 * Float64(fma(-1.0, Float64(Float64(fma(-1.0, Float64(Float64(fma(-1.0, Float64(fma(-0.25, t_2, fma(-0.25, t_8, fma(-0.08333333333333333, Float64(t_0 / Float64(x * x)), fma(-0.041666666666666664, Float64(t_0 / (x ^ 4.0)), fma(0.041666666666666664, t_11, fma(0.05555555555555555, (t_10 ^ 3.0), Float64(Float64(0.16666666666666666 * t_7) + fma(0.16666666666666666, Float64(t_0 / x), fma(0.22916666666666666, t_4, Float64(0.25 * t_12)))))))))) / n), fma(-0.5, t_5, fma(-0.5, Float64(t_3 / x), Float64(Float64(-0.4583333333333333 * t_2) + Float64(Float64(-0.16666666666666666 * t_8) + Float64(Float64(0.125 * t_4) + fma(0.25, t_11, fma(0.25, t_12, Float64(0.5 * t_7))))))))) - Float64(0.16666666666666666 * t_9)) / n), fma(-0.5, t_5, fma(-0.25, t_2, fma(0.3333333333333333, t_7, fma(0.4583333333333333, t_11, fma(0.5, t_1, t_10)))))) - Float64(0.5 * t_9)) / n), Float64(Float64(-1.0 / x) + Float64(Float64(fma(0.25, t_9, Float64(0.5 * (x ^ -1.0))) / x) - Float64(Float64(0.3333333333333333 * t_1) / x)))) / n));
	end
	return tmp
end
code[x_, n_] := Block[{t$95$0 = N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(x * x), $MachinePrecision], -1.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[x], $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[Log[x], $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$7 = N[(N[Log[x], $MachinePrecision] / t$95$6), $MachinePrecision]}, Block[{t$95$8 = N[(t$95$3 / t$95$6), $MachinePrecision]}, Block[{t$95$9 = N[Power[t$95$6, -1.0], $MachinePrecision]}, Block[{t$95$10 = N[(N[Log[x], $MachinePrecision] / x), $MachinePrecision]}, Block[{t$95$11 = N[Power[N[Power[x, 4.0], $MachinePrecision], -1.0], $MachinePrecision]}, Block[{t$95$12 = N[(t$95$3 / N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-30], N[(N[Power[N[Exp[-1.0], $MachinePrecision], N[(N[(-1.0 * N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-98], N[(N[(N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / n), $MachinePrecision] * 0.5 + N[Log[1 + x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[(N[(N[(t$95$3 / n), $MachinePrecision] * 0.5 + N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(-1.0 * N[(N[(N[(-1.0 * N[(N[(N[(-1.0 * N[(N[(-0.25 * t$95$2 + N[(-0.25 * t$95$8 + N[(-0.08333333333333333 * N[(t$95$0 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(-0.041666666666666664 * N[(t$95$0 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(0.041666666666666664 * t$95$11 + N[(0.05555555555555555 * N[Power[t$95$10, 3.0], $MachinePrecision] + N[(N[(0.16666666666666666 * t$95$7), $MachinePrecision] + N[(0.16666666666666666 * N[(t$95$0 / x), $MachinePrecision] + N[(0.22916666666666666 * t$95$4 + N[(0.25 * t$95$12), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(-0.5 * t$95$5 + N[(-0.5 * N[(t$95$3 / x), $MachinePrecision] + N[(N[(-0.4583333333333333 * t$95$2), $MachinePrecision] + N[(N[(-0.16666666666666666 * t$95$8), $MachinePrecision] + N[(N[(0.125 * t$95$4), $MachinePrecision] + N[(0.25 * t$95$11 + N[(0.25 * t$95$12 + N[(0.5 * t$95$7), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.16666666666666666 * t$95$9), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(-0.5 * t$95$5 + N[(-0.25 * t$95$2 + N[(0.3333333333333333 * t$95$7 + N[(0.4583333333333333 * t$95$11 + N[(0.5 * t$95$1 + t$95$10), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 * t$95$9), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(N[(-1.0 / x), $MachinePrecision] + N[(N[(N[(0.25 * t$95$9 + N[(0.5 * N[Power[x, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - N[(N[(0.3333333333333333 * t$95$1), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\log x}^{3}\\
t_1 := {\left(x \cdot x\right)}^{-1}\\
t_2 := \frac{\log x}{{x}^{4}}\\
t_3 := {\log x}^{2}\\
t_4 := \frac{t\_3}{{x}^{4}}\\
t_5 := \frac{\log x}{x \cdot x}\\
t_6 := \left(x \cdot x\right) \cdot x\\
t_7 := \frac{\log x}{t\_6}\\
t_8 := \frac{t\_3}{t\_6}\\
t_9 := {t\_6}^{-1}\\
t_10 := \frac{\log x}{x}\\
t_11 := {\left({x}^{4}\right)}^{-1}\\
t_12 := \frac{t\_3}{x \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-30}:\\
\;\;\;\;\frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x}\\

\mathbf{elif}\;\frac{1}{n} \leq 10^{-98}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n}, 0.5, \mathsf{log1p}\left(x\right)\right)}{n} - \frac{\mathsf{fma}\left(\frac{t\_3}{n}, 0.5, \log x\right)}{n}\\

\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.25, t\_2, \mathsf{fma}\left(-0.25, t\_8, \mathsf{fma}\left(-0.08333333333333333, \frac{t\_0}{x \cdot x}, \mathsf{fma}\left(-0.041666666666666664, \frac{t\_0}{{x}^{4}}, \mathsf{fma}\left(0.041666666666666664, t\_11, \mathsf{fma}\left(0.05555555555555555, {t\_10}^{3}, 0.16666666666666666 \cdot t\_7 + \mathsf{fma}\left(0.16666666666666666, \frac{t\_0}{x}, \mathsf{fma}\left(0.22916666666666666, t\_4, 0.25 \cdot t\_12\right)\right)\right)\right)\right)\right)\right)\right)}{n}, \mathsf{fma}\left(-0.5, t\_5, \mathsf{fma}\left(-0.5, \frac{t\_3}{x}, -0.4583333333333333 \cdot t\_2 + \left(-0.16666666666666666 \cdot t\_8 + \left(0.125 \cdot t\_4 + \mathsf{fma}\left(0.25, t\_11, \mathsf{fma}\left(0.25, t\_12, 0.5 \cdot t\_7\right)\right)\right)\right)\right)\right)\right) - 0.16666666666666666 \cdot t\_9}{n}, \mathsf{fma}\left(-0.5, t\_5, \mathsf{fma}\left(-0.25, t\_2, \mathsf{fma}\left(0.3333333333333333, t\_7, \mathsf{fma}\left(0.4583333333333333, t\_11, \mathsf{fma}\left(0.5, t\_1, t\_10\right)\right)\right)\right)\right)\right) - 0.5 \cdot t\_9}{n}, \frac{-1}{x} + \left(\frac{\mathsf{fma}\left(0.25, t\_9, 0.5 \cdot {x}^{-1}\right)}{x} - \frac{0.3333333333333333 \cdot t\_1}{x}\right)\right)}{n}\\


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

    1. Initial program 93.1%

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

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

        \[\leadsto \frac{e^{-1 \cdot \frac{\log \left(\frac{1}{x}\right)}{n}}}{\color{blue}{n \cdot x}} \]
      2. exp-prodN/A

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

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

        \[\leadsto \frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      5. lower-pow.f64N/A

        \[\leadsto \frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{\color{blue}{n} \cdot x} \]
      6. lower-exp.f64N/A

        \[\leadsto \frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      7. lower-/.f64N/A

        \[\leadsto \frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      8. lower-*.f64N/A

        \[\leadsto \frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      9. lower-log.f64N/A

        \[\leadsto \frac{{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}}{n \cdot x} \]
      10. lower-*.f6495.6

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

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

    if -4.99999999999999972e-30 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999939e-99

    1. Initial program 32.4%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. 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}} \]
    3. Step-by-step derivation
      1. div-subN/A

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

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

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

    if 9.99999999999999939e-99 < (/.f64 #s(literal 1 binary64) n)

    1. Initial program 39.0%

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}, x, \left(-n \cdot x\right) \cdot \mathsf{fma}\left({\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}, \frac{{\left(n \cdot n\right)}^{-1} \cdot 0.5}{x} - \frac{0.5 \cdot {n}^{-1}}{x}, \mathsf{fma}\left({\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}, \frac{\mathsf{fma}\left(0.3333333333333333, {n}^{-1}, {\left(\left(n \cdot n\right) \cdot n\right)}^{-1} \cdot 0.16666666666666666\right) - {\left(n \cdot n\right)}^{-1} \cdot 0.5}{x \cdot x}, {\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)} \cdot \frac{\mathsf{fma}\left(0.4583333333333333, {\left(n \cdot n\right)}^{-1}, {\left({\left(n \cdot n\right)}^{2}\right)}^{-1} \cdot 0.041666666666666664\right) - \mathsf{fma}\left(0.25, {\left(\left(n \cdot n\right) \cdot n\right)}^{-1}, 0.25 \cdot {n}^{-1}\right)}{\left(x \cdot x\right) \cdot x}\right)\right)\right)}{\left(-n \cdot x\right) \cdot x}} \]
    4. Taylor expanded in n around -inf

      \[\leadsto -1 \cdot \color{blue}{\frac{-1 \cdot \frac{\left(-1 \cdot \frac{\left(-1 \cdot \frac{\frac{-1}{4} \cdot \frac{\log x}{{x}^{4}} + \left(\frac{-1}{4} \cdot \frac{{\log x}^{2}}{{x}^{3}} + \left(\frac{-1}{12} \cdot \frac{{\log x}^{3}}{{x}^{2}} + \left(\frac{-1}{24} \cdot \frac{{\log x}^{3}}{{x}^{4}} + \left(\frac{1}{24} \cdot \frac{1}{{x}^{4}} + \left(\frac{1}{18} \cdot \frac{{\log x}^{3}}{{x}^{3}} + \left(\frac{1}{6} \cdot \frac{\log x}{{x}^{3}} + \left(\frac{1}{6} \cdot \frac{{\log x}^{3}}{x} + \left(\frac{11}{48} \cdot \frac{{\log x}^{2}}{{x}^{4}} + \frac{1}{4} \cdot \frac{{\log x}^{2}}{{x}^{2}}\right)\right)\right)\right)\right)\right)\right)\right)}{n} + \left(\frac{-1}{2} \cdot \frac{\log x}{{x}^{2}} + \left(\frac{-1}{2} \cdot \frac{{\log x}^{2}}{x} + \left(\frac{-11}{24} \cdot \frac{\log x}{{x}^{4}} + \left(\frac{-1}{6} \cdot \frac{{\log x}^{2}}{{x}^{3}} + \left(\frac{1}{8} \cdot \frac{{\log x}^{2}}{{x}^{4}} + \left(\frac{1}{4} \cdot \frac{1}{{x}^{4}} + \left(\frac{1}{4} \cdot \frac{{\log x}^{2}}{{x}^{2}} + \frac{1}{2} \cdot \frac{\log x}{{x}^{3}}\right)\right)\right)\right)\right)\right)\right)\right) - \frac{1}{6} \cdot \frac{1}{{x}^{3}}}{n} + \left(\frac{-1}{2} \cdot \frac{\log x}{{x}^{2}} + \left(\frac{-1}{4} \cdot \frac{\log x}{{x}^{4}} + \left(\frac{1}{3} \cdot \frac{\log x}{{x}^{3}} + \left(\frac{11}{24} \cdot \frac{1}{{x}^{4}} + \left(\frac{1}{2} \cdot \frac{1}{{x}^{2}} + \frac{\log x}{x}\right)\right)\right)\right)\right)\right) - \frac{1}{2} \cdot \frac{1}{{x}^{3}}}{n} + \left(\frac{-1}{x} + \frac{\left(\frac{1}{4} \cdot \frac{1}{{x}^{3}} + \frac{1}{2} \cdot \frac{1}{x}\right) - \frac{1}{3} \cdot \frac{1}{{x}^{2}}}{x}\right)}{n}} \]
    5. Applied rewrites31.7%

      \[\leadsto -1 \cdot \color{blue}{\frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.25, \frac{\log x}{{x}^{4}}, \mathsf{fma}\left(-0.25, \frac{{\log x}^{2}}{\left(x \cdot x\right) \cdot x}, \mathsf{fma}\left(-0.08333333333333333, \frac{{\log x}^{3}}{x \cdot x}, \mathsf{fma}\left(-0.041666666666666664, \frac{{\log x}^{3}}{{x}^{4}}, \mathsf{fma}\left(0.041666666666666664, {\left({x}^{4}\right)}^{-1}, \mathsf{fma}\left(0.05555555555555555, {\left(\frac{\log x}{x}\right)}^{3}, 0.16666666666666666 \cdot \frac{\log x}{\left(x \cdot x\right) \cdot x} + \mathsf{fma}\left(0.16666666666666666, \frac{{\log x}^{3}}{x}, \mathsf{fma}\left(0.22916666666666666, \frac{{\log x}^{2}}{{x}^{4}}, 0.25 \cdot \frac{{\log x}^{2}}{x \cdot x}\right)\right)\right)\right)\right)\right)\right)\right)}{n}, \mathsf{fma}\left(-0.5, \frac{\log x}{x \cdot x}, \mathsf{fma}\left(-0.5, \frac{{\log x}^{2}}{x}, -0.4583333333333333 \cdot \frac{\log x}{{x}^{4}} + \left(-0.16666666666666666 \cdot \frac{{\log x}^{2}}{\left(x \cdot x\right) \cdot x} + \left(0.125 \cdot \frac{{\log x}^{2}}{{x}^{4}} + \mathsf{fma}\left(0.25, {\left({x}^{4}\right)}^{-1}, \mathsf{fma}\left(0.25, \frac{{\log x}^{2}}{x \cdot x}, 0.5 \cdot \frac{\log x}{\left(x \cdot x\right) \cdot x}\right)\right)\right)\right)\right)\right)\right) - 0.16666666666666666 \cdot {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}}{n}, \mathsf{fma}\left(-0.5, \frac{\log x}{x \cdot x}, \mathsf{fma}\left(-0.25, \frac{\log x}{{x}^{4}}, \mathsf{fma}\left(0.3333333333333333, \frac{\log x}{\left(x \cdot x\right) \cdot x}, \mathsf{fma}\left(0.4583333333333333, {\left({x}^{4}\right)}^{-1}, \mathsf{fma}\left(0.5, {\left(x \cdot x\right)}^{-1}, \frac{\log x}{x}\right)\right)\right)\right)\right)\right) - 0.5 \cdot {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}}{n}, \frac{-1}{x} + \left(\frac{\mathsf{fma}\left(0.25, {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}, 0.5 \cdot {x}^{-1}\right)}{x} - \frac{0.3333333333333333 \cdot {\left(x \cdot x\right)}^{-1}}{x}\right)\right)}{n}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 66.6% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot {x}^{-1}\\ t_1 := \left(x \cdot x\right) \cdot x\\ t_2 := \frac{\log x}{t\_1}\\ t_3 := {\log x}^{3}\\ t_4 := \frac{\log x}{{x}^{4}}\\ t_5 := {\left({x}^{4}\right)}^{-1}\\ t_6 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\ t_7 := {\left(x \cdot x\right)}^{-1}\\ t_8 := 0.3333333333333333 \cdot t\_7\\ t_9 := {\log x}^{2}\\ t_10 := \frac{t\_9}{{x}^{4}}\\ t_11 := \frac{t\_9}{x \cdot x}\\ t_12 := \frac{\log x}{x \cdot x}\\ t_13 := {t\_1}^{-1}\\ t_14 := \frac{t\_9}{t\_1}\\ t_15 := \frac{\log x}{x}\\ \mathbf{if}\;t\_6 \leq -\infty:\\ \;\;\;\;\frac{\frac{\log x + \mathsf{fma}\left(0.5, \frac{1 + -1 \cdot \log x}{x}, \mathsf{fma}\left(0.5, \frac{0.6666666666666666 \cdot \log x - 1}{x \cdot x}, n \cdot \left(\left(1 + t\_8\right) - t\_0\right)\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1\\ \mathbf{elif}\;t\_6 \leq 0.8227314594154127:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n}, 0.5, \mathsf{log1p}\left(x\right)\right)}{n} - \frac{\mathsf{fma}\left(\frac{t\_9}{n}, 0.5, \log x\right)}{n}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.25, t\_4, \mathsf{fma}\left(-0.25, t\_14, \mathsf{fma}\left(-0.08333333333333333, \frac{t\_3}{x \cdot x}, \mathsf{fma}\left(-0.041666666666666664, \frac{t\_3}{{x}^{4}}, \mathsf{fma}\left(0.041666666666666664, t\_5, \mathsf{fma}\left(0.05555555555555555, {t\_15}^{3}, 0.16666666666666666 \cdot t\_2 + \mathsf{fma}\left(0.16666666666666666, \frac{t\_3}{x}, \mathsf{fma}\left(0.22916666666666666, t\_10, 0.25 \cdot t\_11\right)\right)\right)\right)\right)\right)\right)\right)}{n}, \mathsf{fma}\left(-0.5, t\_12, \mathsf{fma}\left(-0.5, \frac{t\_9}{x}, -0.4583333333333333 \cdot t\_4 + \left(-0.16666666666666666 \cdot t\_14 + \left(0.125 \cdot t\_10 + \mathsf{fma}\left(0.25, t\_5, \mathsf{fma}\left(0.25, t\_11, 0.5 \cdot t\_2\right)\right)\right)\right)\right)\right)\right) - 0.16666666666666666 \cdot t\_13}{n}, \mathsf{fma}\left(-0.5, t\_12, \mathsf{fma}\left(-0.25, t\_4, \mathsf{fma}\left(0.3333333333333333, t\_2, \mathsf{fma}\left(0.4583333333333333, t\_5, \mathsf{fma}\left(0.5, t\_7, t\_15\right)\right)\right)\right)\right)\right) - 0.5 \cdot t\_13}{n}, \frac{-1}{x} + \left(\frac{\mathsf{fma}\left(0.25, t\_13, t\_0\right)}{x} - \frac{t\_8}{x}\right)\right)}{n}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (* 0.5 (pow x -1.0)))
        (t_1 (* (* x x) x))
        (t_2 (/ (log x) t_1))
        (t_3 (pow (log x) 3.0))
        (t_4 (/ (log x) (pow x 4.0)))
        (t_5 (pow (pow x 4.0) -1.0))
        (t_6 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
        (t_7 (pow (* x x) -1.0))
        (t_8 (* 0.3333333333333333 t_7))
        (t_9 (pow (log x) 2.0))
        (t_10 (/ t_9 (pow x 4.0)))
        (t_11 (/ t_9 (* x x)))
        (t_12 (/ (log x) (* x x)))
        (t_13 (pow t_1 -1.0))
        (t_14 (/ t_9 t_1))
        (t_15 (/ (log x) x)))
   (if (<= t_6 (- INFINITY))
     (*
      (/
       (/
        (+
         (log x)
         (fma
          0.5
          (/ (+ 1.0 (* -1.0 (log x))) x)
          (fma
           0.5
           (/ (- (* 0.6666666666666666 (log x)) 1.0) (* x x))
           (* n (- (+ 1.0 t_8) t_0)))))
        x)
       (* n (- n)))
      -1.0)
     (if (<= t_6 0.8227314594154127)
       (-
        (/ (fma (/ (pow (log1p x) 2.0) n) 0.5 (log1p x)) n)
        (/ (fma (/ t_9 n) 0.5 (log x)) n))
       (*
        -1.0
        (/
         (fma
          -1.0
          (/
           (-
            (fma
             -1.0
             (/
              (-
               (fma
                -1.0
                (/
                 (fma
                  -0.25
                  t_4
                  (fma
                   -0.25
                   t_14
                   (fma
                    -0.08333333333333333
                    (/ t_3 (* x x))
                    (fma
                     -0.041666666666666664
                     (/ t_3 (pow x 4.0))
                     (fma
                      0.041666666666666664
                      t_5
                      (fma
                       0.05555555555555555
                       (pow t_15 3.0)
                       (+
                        (* 0.16666666666666666 t_2)
                        (fma
                         0.16666666666666666
                         (/ t_3 x)
                         (fma 0.22916666666666666 t_10 (* 0.25 t_11))))))))))
                 n)
                (fma
                 -0.5
                 t_12
                 (fma
                  -0.5
                  (/ t_9 x)
                  (+
                   (* -0.4583333333333333 t_4)
                   (+
                    (* -0.16666666666666666 t_14)
                    (+
                     (* 0.125 t_10)
                     (fma 0.25 t_5 (fma 0.25 t_11 (* 0.5 t_2)))))))))
               (* 0.16666666666666666 t_13))
              n)
             (fma
              -0.5
              t_12
              (fma
               -0.25
               t_4
               (fma
                0.3333333333333333
                t_2
                (fma 0.4583333333333333 t_5 (fma 0.5 t_7 t_15))))))
            (* 0.5 t_13))
           n)
          (+ (/ -1.0 x) (- (/ (fma 0.25 t_13 t_0) x) (/ t_8 x))))
         n))))))
double code(double x, double n) {
	double t_0 = 0.5 * pow(x, -1.0);
	double t_1 = (x * x) * x;
	double t_2 = log(x) / t_1;
	double t_3 = pow(log(x), 3.0);
	double t_4 = log(x) / pow(x, 4.0);
	double t_5 = pow(pow(x, 4.0), -1.0);
	double t_6 = pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
	double t_7 = pow((x * x), -1.0);
	double t_8 = 0.3333333333333333 * t_7;
	double t_9 = pow(log(x), 2.0);
	double t_10 = t_9 / pow(x, 4.0);
	double t_11 = t_9 / (x * x);
	double t_12 = log(x) / (x * x);
	double t_13 = pow(t_1, -1.0);
	double t_14 = t_9 / t_1;
	double t_15 = log(x) / x;
	double tmp;
	if (t_6 <= -((double) INFINITY)) {
		tmp = (((log(x) + fma(0.5, ((1.0 + (-1.0 * log(x))) / x), fma(0.5, (((0.6666666666666666 * log(x)) - 1.0) / (x * x)), (n * ((1.0 + t_8) - t_0))))) / x) / (n * -n)) * -1.0;
	} else if (t_6 <= 0.8227314594154127) {
		tmp = (fma((pow(log1p(x), 2.0) / n), 0.5, log1p(x)) / n) - (fma((t_9 / n), 0.5, log(x)) / n);
	} else {
		tmp = -1.0 * (fma(-1.0, ((fma(-1.0, ((fma(-1.0, (fma(-0.25, t_4, fma(-0.25, t_14, fma(-0.08333333333333333, (t_3 / (x * x)), fma(-0.041666666666666664, (t_3 / pow(x, 4.0)), fma(0.041666666666666664, t_5, fma(0.05555555555555555, pow(t_15, 3.0), ((0.16666666666666666 * t_2) + fma(0.16666666666666666, (t_3 / x), fma(0.22916666666666666, t_10, (0.25 * t_11)))))))))) / n), fma(-0.5, t_12, fma(-0.5, (t_9 / x), ((-0.4583333333333333 * t_4) + ((-0.16666666666666666 * t_14) + ((0.125 * t_10) + fma(0.25, t_5, fma(0.25, t_11, (0.5 * t_2))))))))) - (0.16666666666666666 * t_13)) / n), fma(-0.5, t_12, fma(-0.25, t_4, fma(0.3333333333333333, t_2, fma(0.4583333333333333, t_5, fma(0.5, t_7, t_15)))))) - (0.5 * t_13)) / n), ((-1.0 / x) + ((fma(0.25, t_13, t_0) / x) - (t_8 / x)))) / n);
	}
	return tmp;
}
function code(x, n)
	t_0 = Float64(0.5 * (x ^ -1.0))
	t_1 = Float64(Float64(x * x) * x)
	t_2 = Float64(log(x) / t_1)
	t_3 = log(x) ^ 3.0
	t_4 = Float64(log(x) / (x ^ 4.0))
	t_5 = (x ^ 4.0) ^ -1.0
	t_6 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n)))
	t_7 = Float64(x * x) ^ -1.0
	t_8 = Float64(0.3333333333333333 * t_7)
	t_9 = log(x) ^ 2.0
	t_10 = Float64(t_9 / (x ^ 4.0))
	t_11 = Float64(t_9 / Float64(x * x))
	t_12 = Float64(log(x) / Float64(x * x))
	t_13 = t_1 ^ -1.0
	t_14 = Float64(t_9 / t_1)
	t_15 = Float64(log(x) / x)
	tmp = 0.0
	if (t_6 <= Float64(-Inf))
		tmp = Float64(Float64(Float64(Float64(log(x) + fma(0.5, Float64(Float64(1.0 + Float64(-1.0 * log(x))) / x), fma(0.5, Float64(Float64(Float64(0.6666666666666666 * log(x)) - 1.0) / Float64(x * x)), Float64(n * Float64(Float64(1.0 + t_8) - t_0))))) / x) / Float64(n * Float64(-n))) * -1.0);
	elseif (t_6 <= 0.8227314594154127)
		tmp = Float64(Float64(fma(Float64((log1p(x) ^ 2.0) / n), 0.5, log1p(x)) / n) - Float64(fma(Float64(t_9 / n), 0.5, log(x)) / n));
	else
		tmp = Float64(-1.0 * Float64(fma(-1.0, Float64(Float64(fma(-1.0, Float64(Float64(fma(-1.0, Float64(fma(-0.25, t_4, fma(-0.25, t_14, fma(-0.08333333333333333, Float64(t_3 / Float64(x * x)), fma(-0.041666666666666664, Float64(t_3 / (x ^ 4.0)), fma(0.041666666666666664, t_5, fma(0.05555555555555555, (t_15 ^ 3.0), Float64(Float64(0.16666666666666666 * t_2) + fma(0.16666666666666666, Float64(t_3 / x), fma(0.22916666666666666, t_10, Float64(0.25 * t_11)))))))))) / n), fma(-0.5, t_12, fma(-0.5, Float64(t_9 / x), Float64(Float64(-0.4583333333333333 * t_4) + Float64(Float64(-0.16666666666666666 * t_14) + Float64(Float64(0.125 * t_10) + fma(0.25, t_5, fma(0.25, t_11, Float64(0.5 * t_2))))))))) - Float64(0.16666666666666666 * t_13)) / n), fma(-0.5, t_12, fma(-0.25, t_4, fma(0.3333333333333333, t_2, fma(0.4583333333333333, t_5, fma(0.5, t_7, t_15)))))) - Float64(0.5 * t_13)) / n), Float64(Float64(-1.0 / x) + Float64(Float64(fma(0.25, t_13, t_0) / x) - Float64(t_8 / x)))) / n));
	end
	return tmp
end
code[x_, n_] := Block[{t$95$0 = N[(0.5 * N[Power[x, -1.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[x], $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]}, Block[{t$95$4 = N[(N[Log[x], $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Power[N[Power[x, 4.0], $MachinePrecision], -1.0], $MachinePrecision]}, Block[{t$95$6 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[Power[N[(x * x), $MachinePrecision], -1.0], $MachinePrecision]}, Block[{t$95$8 = N[(0.3333333333333333 * t$95$7), $MachinePrecision]}, Block[{t$95$9 = N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$10 = N[(t$95$9 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$11 = N[(t$95$9 / N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$12 = N[(N[Log[x], $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$13 = N[Power[t$95$1, -1.0], $MachinePrecision]}, Block[{t$95$14 = N[(t$95$9 / t$95$1), $MachinePrecision]}, Block[{t$95$15 = N[(N[Log[x], $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[t$95$6, (-Infinity)], N[(N[(N[(N[(N[Log[x], $MachinePrecision] + N[(0.5 * N[(N[(1.0 + N[(-1.0 * N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(0.5 * N[(N[(N[(0.6666666666666666 * N[Log[x], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(n * N[(N[(1.0 + t$95$8), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / N[(n * (-n)), $MachinePrecision]), $MachinePrecision] * -1.0), $MachinePrecision], If[LessEqual[t$95$6, 0.8227314594154127], N[(N[(N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / n), $MachinePrecision] * 0.5 + N[Log[1 + x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[(N[(N[(t$95$9 / n), $MachinePrecision] * 0.5 + N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(-1.0 * N[(N[(N[(-1.0 * N[(N[(N[(-1.0 * N[(N[(-0.25 * t$95$4 + N[(-0.25 * t$95$14 + N[(-0.08333333333333333 * N[(t$95$3 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(-0.041666666666666664 * N[(t$95$3 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(0.041666666666666664 * t$95$5 + N[(0.05555555555555555 * N[Power[t$95$15, 3.0], $MachinePrecision] + N[(N[(0.16666666666666666 * t$95$2), $MachinePrecision] + N[(0.16666666666666666 * N[(t$95$3 / x), $MachinePrecision] + N[(0.22916666666666666 * t$95$10 + N[(0.25 * t$95$11), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(-0.5 * t$95$12 + N[(-0.5 * N[(t$95$9 / x), $MachinePrecision] + N[(N[(-0.4583333333333333 * t$95$4), $MachinePrecision] + N[(N[(-0.16666666666666666 * t$95$14), $MachinePrecision] + N[(N[(0.125 * t$95$10), $MachinePrecision] + N[(0.25 * t$95$5 + N[(0.25 * t$95$11 + N[(0.5 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.16666666666666666 * t$95$13), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(-0.5 * t$95$12 + N[(-0.25 * t$95$4 + N[(0.3333333333333333 * t$95$2 + N[(0.4583333333333333 * t$95$5 + N[(0.5 * t$95$7 + t$95$15), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 * t$95$13), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(N[(-1.0 / x), $MachinePrecision] + N[(N[(N[(0.25 * t$95$13 + t$95$0), $MachinePrecision] / x), $MachinePrecision] - N[(t$95$8 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot {x}^{-1}\\
t_1 := \left(x \cdot x\right) \cdot x\\
t_2 := \frac{\log x}{t\_1}\\
t_3 := {\log x}^{3}\\
t_4 := \frac{\log x}{{x}^{4}}\\
t_5 := {\left({x}^{4}\right)}^{-1}\\
t_6 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\
t_7 := {\left(x \cdot x\right)}^{-1}\\
t_8 := 0.3333333333333333 \cdot t\_7\\
t_9 := {\log x}^{2}\\
t_10 := \frac{t\_9}{{x}^{4}}\\
t_11 := \frac{t\_9}{x \cdot x}\\
t_12 := \frac{\log x}{x \cdot x}\\
t_13 := {t\_1}^{-1}\\
t_14 := \frac{t\_9}{t\_1}\\
t_15 := \frac{\log x}{x}\\
\mathbf{if}\;t\_6 \leq -\infty:\\
\;\;\;\;\frac{\frac{\log x + \mathsf{fma}\left(0.5, \frac{1 + -1 \cdot \log x}{x}, \mathsf{fma}\left(0.5, \frac{0.6666666666666666 \cdot \log x - 1}{x \cdot x}, n \cdot \left(\left(1 + t\_8\right) - t\_0\right)\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1\\

\mathbf{elif}\;t\_6 \leq 0.8227314594154127:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n}, 0.5, \mathsf{log1p}\left(x\right)\right)}{n} - \frac{\mathsf{fma}\left(\frac{t\_9}{n}, 0.5, \log x\right)}{n}\\

\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.25, t\_4, \mathsf{fma}\left(-0.25, t\_14, \mathsf{fma}\left(-0.08333333333333333, \frac{t\_3}{x \cdot x}, \mathsf{fma}\left(-0.041666666666666664, \frac{t\_3}{{x}^{4}}, \mathsf{fma}\left(0.041666666666666664, t\_5, \mathsf{fma}\left(0.05555555555555555, {t\_15}^{3}, 0.16666666666666666 \cdot t\_2 + \mathsf{fma}\left(0.16666666666666666, \frac{t\_3}{x}, \mathsf{fma}\left(0.22916666666666666, t\_10, 0.25 \cdot t\_11\right)\right)\right)\right)\right)\right)\right)\right)}{n}, \mathsf{fma}\left(-0.5, t\_12, \mathsf{fma}\left(-0.5, \frac{t\_9}{x}, -0.4583333333333333 \cdot t\_4 + \left(-0.16666666666666666 \cdot t\_14 + \left(0.125 \cdot t\_10 + \mathsf{fma}\left(0.25, t\_5, \mathsf{fma}\left(0.25, t\_11, 0.5 \cdot t\_2\right)\right)\right)\right)\right)\right)\right) - 0.16666666666666666 \cdot t\_13}{n}, \mathsf{fma}\left(-0.5, t\_12, \mathsf{fma}\left(-0.25, t\_4, \mathsf{fma}\left(0.3333333333333333, t\_2, \mathsf{fma}\left(0.4583333333333333, t\_5, \mathsf{fma}\left(0.5, t\_7, t\_15\right)\right)\right)\right)\right)\right) - 0.5 \cdot t\_13}{n}, \frac{-1}{x} + \left(\frac{\mathsf{fma}\left(0.25, t\_13, t\_0\right)}{x} - \frac{t\_8}{x}\right)\right)}{n}\\


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

    1. Initial program 100.0%

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n} \cdot 0.5 - \frac{{\log x}^{2}}{n} \cdot 0.5, -1, \mathsf{log1p}\left(x\right) \cdot -1\right) \cdot \left(-n\right) - n \cdot \log x}{n \cdot \left(-n\right)} \cdot -1} \]
    4. Taylor expanded in x around inf

      \[\leadsto \frac{\frac{-1 \cdot \left(n \cdot \left(\frac{\log \left(\frac{1}{x}\right)}{n} - 1\right)\right) + \left(-1 \cdot \frac{n \cdot \left(\frac{1}{2} + \frac{-1}{2} \cdot \left(\frac{1}{n} + \frac{\log \left(\frac{1}{x}\right)}{n}\right)\right)}{x} + -1 \cdot \frac{n \cdot \left(\frac{-1}{2} \cdot \left(\frac{-2}{3} \cdot \frac{\log \left(\frac{1}{x}\right)}{n} - \frac{1}{n}\right) - \frac{1}{3}\right)}{{x}^{2}}\right)}{x}}{n \cdot \left(-n\right)} \cdot -1 \]
    5. Applied rewrites91.4%

      \[\leadsto \frac{\frac{\mathsf{fma}\left(-1, n \cdot \left(\frac{-1 \cdot \log x}{n} - 1\right), \mathsf{fma}\left(-1, \frac{n \cdot \left(0.5 + -0.5 \cdot \frac{1 + -1 \cdot \log x}{n}\right)}{x}, -1 \cdot \frac{n \cdot \left(-0.5 \cdot \left(-0.6666666666666666 \cdot \frac{-1 \cdot \log x}{n} - {n}^{-1}\right) - 0.3333333333333333\right)}{x \cdot x}\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1 \]
    6. Taylor expanded in n around 0

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

        \[\leadsto \frac{\frac{\log x + \left(\frac{1}{2} \cdot \frac{1 + -1 \cdot \log x}{x} + \left(\frac{1}{2} \cdot \frac{\frac{2}{3} \cdot \log x - 1}{{x}^{2}} + n \cdot \left(\left(1 + \frac{1}{3} \cdot \frac{1}{{x}^{2}}\right) - \frac{1}{2} \cdot \frac{1}{x}\right)\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1 \]
      2. lift-log.f64N/A

        \[\leadsto \frac{\frac{\log x + \left(\frac{1}{2} \cdot \frac{1 + -1 \cdot \log x}{x} + \left(\frac{1}{2} \cdot \frac{\frac{2}{3} \cdot \log x - 1}{{x}^{2}} + n \cdot \left(\left(1 + \frac{1}{3} \cdot \frac{1}{{x}^{2}}\right) - \frac{1}{2} \cdot \frac{1}{x}\right)\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1 \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\frac{\log x + \mathsf{fma}\left(\frac{1}{2}, \frac{1 + -1 \cdot \log x}{x}, \frac{1}{2} \cdot \frac{\frac{2}{3} \cdot \log x - 1}{{x}^{2}} + n \cdot \left(\left(1 + \frac{1}{3} \cdot \frac{1}{{x}^{2}}\right) - \frac{1}{2} \cdot \frac{1}{x}\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1 \]
    8. Applied rewrites91.7%

      \[\leadsto \frac{\frac{\log x + \mathsf{fma}\left(0.5, \frac{1 + -1 \cdot \log x}{x}, \mathsf{fma}\left(0.5, \frac{0.6666666666666666 \cdot \log x - 1}{x \cdot x}, n \cdot \left(\left(1 + 0.3333333333333333 \cdot {\left(x \cdot x\right)}^{-1}\right) - 0.5 \cdot {x}^{-1}\right)\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1 \]

    if -inf.0 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 0.8227314594154127

    1. Initial program 44.0%

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)} \]
    2. 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}} \]
    3. Step-by-step derivation
      1. div-subN/A

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

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

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

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

    1. Initial program 52.2%

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}, x, \left(-n \cdot x\right) \cdot \mathsf{fma}\left({\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}, \frac{{\left(n \cdot n\right)}^{-1} \cdot 0.5}{x} - \frac{0.5 \cdot {n}^{-1}}{x}, \mathsf{fma}\left({\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}, \frac{\mathsf{fma}\left(0.3333333333333333, {n}^{-1}, {\left(\left(n \cdot n\right) \cdot n\right)}^{-1} \cdot 0.16666666666666666\right) - {\left(n \cdot n\right)}^{-1} \cdot 0.5}{x \cdot x}, {\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)} \cdot \frac{\mathsf{fma}\left(0.4583333333333333, {\left(n \cdot n\right)}^{-1}, {\left({\left(n \cdot n\right)}^{2}\right)}^{-1} \cdot 0.041666666666666664\right) - \mathsf{fma}\left(0.25, {\left(\left(n \cdot n\right) \cdot n\right)}^{-1}, 0.25 \cdot {n}^{-1}\right)}{\left(x \cdot x\right) \cdot x}\right)\right)\right)}{\left(-n \cdot x\right) \cdot x}} \]
    4. Taylor expanded in n around -inf

      \[\leadsto -1 \cdot \color{blue}{\frac{-1 \cdot \frac{\left(-1 \cdot \frac{\left(-1 \cdot \frac{\frac{-1}{4} \cdot \frac{\log x}{{x}^{4}} + \left(\frac{-1}{4} \cdot \frac{{\log x}^{2}}{{x}^{3}} + \left(\frac{-1}{12} \cdot \frac{{\log x}^{3}}{{x}^{2}} + \left(\frac{-1}{24} \cdot \frac{{\log x}^{3}}{{x}^{4}} + \left(\frac{1}{24} \cdot \frac{1}{{x}^{4}} + \left(\frac{1}{18} \cdot \frac{{\log x}^{3}}{{x}^{3}} + \left(\frac{1}{6} \cdot \frac{\log x}{{x}^{3}} + \left(\frac{1}{6} \cdot \frac{{\log x}^{3}}{x} + \left(\frac{11}{48} \cdot \frac{{\log x}^{2}}{{x}^{4}} + \frac{1}{4} \cdot \frac{{\log x}^{2}}{{x}^{2}}\right)\right)\right)\right)\right)\right)\right)\right)}{n} + \left(\frac{-1}{2} \cdot \frac{\log x}{{x}^{2}} + \left(\frac{-1}{2} \cdot \frac{{\log x}^{2}}{x} + \left(\frac{-11}{24} \cdot \frac{\log x}{{x}^{4}} + \left(\frac{-1}{6} \cdot \frac{{\log x}^{2}}{{x}^{3}} + \left(\frac{1}{8} \cdot \frac{{\log x}^{2}}{{x}^{4}} + \left(\frac{1}{4} \cdot \frac{1}{{x}^{4}} + \left(\frac{1}{4} \cdot \frac{{\log x}^{2}}{{x}^{2}} + \frac{1}{2} \cdot \frac{\log x}{{x}^{3}}\right)\right)\right)\right)\right)\right)\right)\right) - \frac{1}{6} \cdot \frac{1}{{x}^{3}}}{n} + \left(\frac{-1}{2} \cdot \frac{\log x}{{x}^{2}} + \left(\frac{-1}{4} \cdot \frac{\log x}{{x}^{4}} + \left(\frac{1}{3} \cdot \frac{\log x}{{x}^{3}} + \left(\frac{11}{24} \cdot \frac{1}{{x}^{4}} + \left(\frac{1}{2} \cdot \frac{1}{{x}^{2}} + \frac{\log x}{x}\right)\right)\right)\right)\right)\right) - \frac{1}{2} \cdot \frac{1}{{x}^{3}}}{n} + \left(\frac{-1}{x} + \frac{\left(\frac{1}{4} \cdot \frac{1}{{x}^{3}} + \frac{1}{2} \cdot \frac{1}{x}\right) - \frac{1}{3} \cdot \frac{1}{{x}^{2}}}{x}\right)}{n}} \]
    5. Applied rewrites21.8%

      \[\leadsto -1 \cdot \color{blue}{\frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.25, \frac{\log x}{{x}^{4}}, \mathsf{fma}\left(-0.25, \frac{{\log x}^{2}}{\left(x \cdot x\right) \cdot x}, \mathsf{fma}\left(-0.08333333333333333, \frac{{\log x}^{3}}{x \cdot x}, \mathsf{fma}\left(-0.041666666666666664, \frac{{\log x}^{3}}{{x}^{4}}, \mathsf{fma}\left(0.041666666666666664, {\left({x}^{4}\right)}^{-1}, \mathsf{fma}\left(0.05555555555555555, {\left(\frac{\log x}{x}\right)}^{3}, 0.16666666666666666 \cdot \frac{\log x}{\left(x \cdot x\right) \cdot x} + \mathsf{fma}\left(0.16666666666666666, \frac{{\log x}^{3}}{x}, \mathsf{fma}\left(0.22916666666666666, \frac{{\log x}^{2}}{{x}^{4}}, 0.25 \cdot \frac{{\log x}^{2}}{x \cdot x}\right)\right)\right)\right)\right)\right)\right)\right)}{n}, \mathsf{fma}\left(-0.5, \frac{\log x}{x \cdot x}, \mathsf{fma}\left(-0.5, \frac{{\log x}^{2}}{x}, -0.4583333333333333 \cdot \frac{\log x}{{x}^{4}} + \left(-0.16666666666666666 \cdot \frac{{\log x}^{2}}{\left(x \cdot x\right) \cdot x} + \left(0.125 \cdot \frac{{\log x}^{2}}{{x}^{4}} + \mathsf{fma}\left(0.25, {\left({x}^{4}\right)}^{-1}, \mathsf{fma}\left(0.25, \frac{{\log x}^{2}}{x \cdot x}, 0.5 \cdot \frac{\log x}{\left(x \cdot x\right) \cdot x}\right)\right)\right)\right)\right)\right)\right) - 0.16666666666666666 \cdot {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}}{n}, \mathsf{fma}\left(-0.5, \frac{\log x}{x \cdot x}, \mathsf{fma}\left(-0.25, \frac{\log x}{{x}^{4}}, \mathsf{fma}\left(0.3333333333333333, \frac{\log x}{\left(x \cdot x\right) \cdot x}, \mathsf{fma}\left(0.4583333333333333, {\left({x}^{4}\right)}^{-1}, \mathsf{fma}\left(0.5, {\left(x \cdot x\right)}^{-1}, \frac{\log x}{x}\right)\right)\right)\right)\right)\right) - 0.5 \cdot {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}}{n}, \frac{-1}{x} + \left(\frac{\mathsf{fma}\left(0.25, {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}, 0.5 \cdot {x}^{-1}\right)}{x} - \frac{0.3333333333333333 \cdot {\left(x \cdot x\right)}^{-1}}{x}\right)\right)}{n}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 7: 53.6% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\log x}^{3}\\ t_1 := n \cdot \left(-n\right)\\ t_2 := {\log x}^{2}\\ t_3 := \left(x \cdot x\right) \cdot x\\ t_4 := \frac{\log x}{t\_3}\\ t_5 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\ t_6 := {\left(x \cdot x\right)}^{-1}\\ t_7 := 0.3333333333333333 \cdot t\_6\\ t_8 := 0.5 \cdot {x}^{-1}\\ t_9 := \frac{t\_2}{{x}^{4}}\\ t_10 := \frac{\log x}{{x}^{4}}\\ t_11 := {\left({x}^{4}\right)}^{-1}\\ t_12 := \frac{t\_2}{x \cdot x}\\ t_13 := \frac{\log x}{x \cdot x}\\ t_14 := {t\_3}^{-1}\\ t_15 := \frac{t\_2}{t\_3}\\ t_16 := \frac{\log x}{x}\\ \mathbf{if}\;t\_5 \leq -\infty:\\ \;\;\;\;\frac{\frac{\log x + \mathsf{fma}\left(0.5, \frac{1 + -1 \cdot \log x}{x}, \mathsf{fma}\left(0.5, \frac{0.6666666666666666 \cdot \log x - 1}{x \cdot x}, n \cdot \left(\left(1 + t\_7\right) - t\_8\right)\right)\right)}{x}}{t\_1} \cdot -1\\ \mathbf{elif}\;t\_5 \leq 0.8227314594154127:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n} \cdot 0.5 - \frac{t\_2}{n} \cdot 0.5, -1, \mathsf{log1p}\left(x\right) \cdot -1\right) \cdot \left(-n\right) - n \cdot \log x}{t\_1} \cdot -1\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.25, t\_10, \mathsf{fma}\left(-0.25, t\_15, \mathsf{fma}\left(-0.08333333333333333, \frac{t\_0}{x \cdot x}, \mathsf{fma}\left(-0.041666666666666664, \frac{t\_0}{{x}^{4}}, \mathsf{fma}\left(0.041666666666666664, t\_11, \mathsf{fma}\left(0.05555555555555555, {t\_16}^{3}, 0.16666666666666666 \cdot t\_4 + \mathsf{fma}\left(0.16666666666666666, \frac{t\_0}{x}, \mathsf{fma}\left(0.22916666666666666, t\_9, 0.25 \cdot t\_12\right)\right)\right)\right)\right)\right)\right)\right)}{n}, \mathsf{fma}\left(-0.5, t\_13, \mathsf{fma}\left(-0.5, \frac{t\_2}{x}, -0.4583333333333333 \cdot t\_10 + \left(-0.16666666666666666 \cdot t\_15 + \left(0.125 \cdot t\_9 + \mathsf{fma}\left(0.25, t\_11, \mathsf{fma}\left(0.25, t\_12, 0.5 \cdot t\_4\right)\right)\right)\right)\right)\right)\right) - 0.16666666666666666 \cdot t\_14}{n}, \mathsf{fma}\left(-0.5, t\_13, \mathsf{fma}\left(-0.25, t\_10, \mathsf{fma}\left(0.3333333333333333, t\_4, \mathsf{fma}\left(0.4583333333333333, t\_11, \mathsf{fma}\left(0.5, t\_6, t\_16\right)\right)\right)\right)\right)\right) - 0.5 \cdot t\_14}{n}, \frac{-1}{x} + \left(\frac{\mathsf{fma}\left(0.25, t\_14, t\_8\right)}{x} - \frac{t\_7}{x}\right)\right)}{n}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (pow (log x) 3.0))
        (t_1 (* n (- n)))
        (t_2 (pow (log x) 2.0))
        (t_3 (* (* x x) x))
        (t_4 (/ (log x) t_3))
        (t_5 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
        (t_6 (pow (* x x) -1.0))
        (t_7 (* 0.3333333333333333 t_6))
        (t_8 (* 0.5 (pow x -1.0)))
        (t_9 (/ t_2 (pow x 4.0)))
        (t_10 (/ (log x) (pow x 4.0)))
        (t_11 (pow (pow x 4.0) -1.0))
        (t_12 (/ t_2 (* x x)))
        (t_13 (/ (log x) (* x x)))
        (t_14 (pow t_3 -1.0))
        (t_15 (/ t_2 t_3))
        (t_16 (/ (log x) x)))
   (if (<= t_5 (- INFINITY))
     (*
      (/
       (/
        (+
         (log x)
         (fma
          0.5
          (/ (+ 1.0 (* -1.0 (log x))) x)
          (fma
           0.5
           (/ (- (* 0.6666666666666666 (log x)) 1.0) (* x x))
           (* n (- (+ 1.0 t_7) t_8)))))
        x)
       t_1)
      -1.0)
     (if (<= t_5 0.8227314594154127)
       (*
        (/
         (-
          (*
           (fma
            (- (* (/ (pow (log1p x) 2.0) n) 0.5) (* (/ t_2 n) 0.5))
            -1.0
            (* (log1p x) -1.0))
           (- n))
          (* n (log x)))
         t_1)
        -1.0)
       (*
        -1.0
        (/
         (fma
          -1.0
          (/
           (-
            (fma
             -1.0
             (/
              (-
               (fma
                -1.0
                (/
                 (fma
                  -0.25
                  t_10
                  (fma
                   -0.25
                   t_15
                   (fma
                    -0.08333333333333333
                    (/ t_0 (* x x))
                    (fma
                     -0.041666666666666664
                     (/ t_0 (pow x 4.0))
                     (fma
                      0.041666666666666664
                      t_11
                      (fma
                       0.05555555555555555
                       (pow t_16 3.0)
                       (+
                        (* 0.16666666666666666 t_4)
                        (fma
                         0.16666666666666666
                         (/ t_0 x)
                         (fma 0.22916666666666666 t_9 (* 0.25 t_12))))))))))
                 n)
                (fma
                 -0.5
                 t_13
                 (fma
                  -0.5
                  (/ t_2 x)
                  (+
                   (* -0.4583333333333333 t_10)
                   (+
                    (* -0.16666666666666666 t_15)
                    (+
                     (* 0.125 t_9)
                     (fma 0.25 t_11 (fma 0.25 t_12 (* 0.5 t_4)))))))))
               (* 0.16666666666666666 t_14))
              n)
             (fma
              -0.5
              t_13
              (fma
               -0.25
               t_10
               (fma
                0.3333333333333333
                t_4
                (fma 0.4583333333333333 t_11 (fma 0.5 t_6 t_16))))))
            (* 0.5 t_14))
           n)
          (+ (/ -1.0 x) (- (/ (fma 0.25 t_14 t_8) x) (/ t_7 x))))
         n))))))
double code(double x, double n) {
	double t_0 = pow(log(x), 3.0);
	double t_1 = n * -n;
	double t_2 = pow(log(x), 2.0);
	double t_3 = (x * x) * x;
	double t_4 = log(x) / t_3;
	double t_5 = pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
	double t_6 = pow((x * x), -1.0);
	double t_7 = 0.3333333333333333 * t_6;
	double t_8 = 0.5 * pow(x, -1.0);
	double t_9 = t_2 / pow(x, 4.0);
	double t_10 = log(x) / pow(x, 4.0);
	double t_11 = pow(pow(x, 4.0), -1.0);
	double t_12 = t_2 / (x * x);
	double t_13 = log(x) / (x * x);
	double t_14 = pow(t_3, -1.0);
	double t_15 = t_2 / t_3;
	double t_16 = log(x) / x;
	double tmp;
	if (t_5 <= -((double) INFINITY)) {
		tmp = (((log(x) + fma(0.5, ((1.0 + (-1.0 * log(x))) / x), fma(0.5, (((0.6666666666666666 * log(x)) - 1.0) / (x * x)), (n * ((1.0 + t_7) - t_8))))) / x) / t_1) * -1.0;
	} else if (t_5 <= 0.8227314594154127) {
		tmp = (((fma((((pow(log1p(x), 2.0) / n) * 0.5) - ((t_2 / n) * 0.5)), -1.0, (log1p(x) * -1.0)) * -n) - (n * log(x))) / t_1) * -1.0;
	} else {
		tmp = -1.0 * (fma(-1.0, ((fma(-1.0, ((fma(-1.0, (fma(-0.25, t_10, fma(-0.25, t_15, fma(-0.08333333333333333, (t_0 / (x * x)), fma(-0.041666666666666664, (t_0 / pow(x, 4.0)), fma(0.041666666666666664, t_11, fma(0.05555555555555555, pow(t_16, 3.0), ((0.16666666666666666 * t_4) + fma(0.16666666666666666, (t_0 / x), fma(0.22916666666666666, t_9, (0.25 * t_12)))))))))) / n), fma(-0.5, t_13, fma(-0.5, (t_2 / x), ((-0.4583333333333333 * t_10) + ((-0.16666666666666666 * t_15) + ((0.125 * t_9) + fma(0.25, t_11, fma(0.25, t_12, (0.5 * t_4))))))))) - (0.16666666666666666 * t_14)) / n), fma(-0.5, t_13, fma(-0.25, t_10, fma(0.3333333333333333, t_4, fma(0.4583333333333333, t_11, fma(0.5, t_6, t_16)))))) - (0.5 * t_14)) / n), ((-1.0 / x) + ((fma(0.25, t_14, t_8) / x) - (t_7 / x)))) / n);
	}
	return tmp;
}
function code(x, n)
	t_0 = log(x) ^ 3.0
	t_1 = Float64(n * Float64(-n))
	t_2 = log(x) ^ 2.0
	t_3 = Float64(Float64(x * x) * x)
	t_4 = Float64(log(x) / t_3)
	t_5 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n)))
	t_6 = Float64(x * x) ^ -1.0
	t_7 = Float64(0.3333333333333333 * t_6)
	t_8 = Float64(0.5 * (x ^ -1.0))
	t_9 = Float64(t_2 / (x ^ 4.0))
	t_10 = Float64(log(x) / (x ^ 4.0))
	t_11 = (x ^ 4.0) ^ -1.0
	t_12 = Float64(t_2 / Float64(x * x))
	t_13 = Float64(log(x) / Float64(x * x))
	t_14 = t_3 ^ -1.0
	t_15 = Float64(t_2 / t_3)
	t_16 = Float64(log(x) / x)
	tmp = 0.0
	if (t_5 <= Float64(-Inf))
		tmp = Float64(Float64(Float64(Float64(log(x) + fma(0.5, Float64(Float64(1.0 + Float64(-1.0 * log(x))) / x), fma(0.5, Float64(Float64(Float64(0.6666666666666666 * log(x)) - 1.0) / Float64(x * x)), Float64(n * Float64(Float64(1.0 + t_7) - t_8))))) / x) / t_1) * -1.0);
	elseif (t_5 <= 0.8227314594154127)
		tmp = Float64(Float64(Float64(Float64(fma(Float64(Float64(Float64((log1p(x) ^ 2.0) / n) * 0.5) - Float64(Float64(t_2 / n) * 0.5)), -1.0, Float64(log1p(x) * -1.0)) * Float64(-n)) - Float64(n * log(x))) / t_1) * -1.0);
	else
		tmp = Float64(-1.0 * Float64(fma(-1.0, Float64(Float64(fma(-1.0, Float64(Float64(fma(-1.0, Float64(fma(-0.25, t_10, fma(-0.25, t_15, fma(-0.08333333333333333, Float64(t_0 / Float64(x * x)), fma(-0.041666666666666664, Float64(t_0 / (x ^ 4.0)), fma(0.041666666666666664, t_11, fma(0.05555555555555555, (t_16 ^ 3.0), Float64(Float64(0.16666666666666666 * t_4) + fma(0.16666666666666666, Float64(t_0 / x), fma(0.22916666666666666, t_9, Float64(0.25 * t_12)))))))))) / n), fma(-0.5, t_13, fma(-0.5, Float64(t_2 / x), Float64(Float64(-0.4583333333333333 * t_10) + Float64(Float64(-0.16666666666666666 * t_15) + Float64(Float64(0.125 * t_9) + fma(0.25, t_11, fma(0.25, t_12, Float64(0.5 * t_4))))))))) - Float64(0.16666666666666666 * t_14)) / n), fma(-0.5, t_13, fma(-0.25, t_10, fma(0.3333333333333333, t_4, fma(0.4583333333333333, t_11, fma(0.5, t_6, t_16)))))) - Float64(0.5 * t_14)) / n), Float64(Float64(-1.0 / x) + Float64(Float64(fma(0.25, t_14, t_8) / x) - Float64(t_7 / x)))) / n));
	end
	return tmp
end
code[x_, n_] := Block[{t$95$0 = N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]}, Block[{t$95$1 = N[(n * (-n)), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$4 = N[(N[Log[x], $MachinePrecision] / t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[Power[N[(x * x), $MachinePrecision], -1.0], $MachinePrecision]}, Block[{t$95$7 = N[(0.3333333333333333 * t$95$6), $MachinePrecision]}, Block[{t$95$8 = N[(0.5 * N[Power[x, -1.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$9 = N[(t$95$2 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$10 = N[(N[Log[x], $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$11 = N[Power[N[Power[x, 4.0], $MachinePrecision], -1.0], $MachinePrecision]}, Block[{t$95$12 = N[(t$95$2 / N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$13 = N[(N[Log[x], $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$14 = N[Power[t$95$3, -1.0], $MachinePrecision]}, Block[{t$95$15 = N[(t$95$2 / t$95$3), $MachinePrecision]}, Block[{t$95$16 = N[(N[Log[x], $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[t$95$5, (-Infinity)], N[(N[(N[(N[(N[Log[x], $MachinePrecision] + N[(0.5 * N[(N[(1.0 + N[(-1.0 * N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(0.5 * N[(N[(N[(0.6666666666666666 * N[Log[x], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(n * N[(N[(1.0 + t$95$7), $MachinePrecision] - t$95$8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / t$95$1), $MachinePrecision] * -1.0), $MachinePrecision], If[LessEqual[t$95$5, 0.8227314594154127], N[(N[(N[(N[(N[(N[(N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / n), $MachinePrecision] * 0.5), $MachinePrecision] - N[(N[(t$95$2 / n), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * -1.0 + N[(N[Log[1 + x], $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision] * (-n)), $MachinePrecision] - N[(n * N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] * -1.0), $MachinePrecision], N[(-1.0 * N[(N[(-1.0 * N[(N[(N[(-1.0 * N[(N[(N[(-1.0 * N[(N[(-0.25 * t$95$10 + N[(-0.25 * t$95$15 + N[(-0.08333333333333333 * N[(t$95$0 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(-0.041666666666666664 * N[(t$95$0 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(0.041666666666666664 * t$95$11 + N[(0.05555555555555555 * N[Power[t$95$16, 3.0], $MachinePrecision] + N[(N[(0.16666666666666666 * t$95$4), $MachinePrecision] + N[(0.16666666666666666 * N[(t$95$0 / x), $MachinePrecision] + N[(0.22916666666666666 * t$95$9 + N[(0.25 * t$95$12), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(-0.5 * t$95$13 + N[(-0.5 * N[(t$95$2 / x), $MachinePrecision] + N[(N[(-0.4583333333333333 * t$95$10), $MachinePrecision] + N[(N[(-0.16666666666666666 * t$95$15), $MachinePrecision] + N[(N[(0.125 * t$95$9), $MachinePrecision] + N[(0.25 * t$95$11 + N[(0.25 * t$95$12 + N[(0.5 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.16666666666666666 * t$95$14), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(-0.5 * t$95$13 + N[(-0.25 * t$95$10 + N[(0.3333333333333333 * t$95$4 + N[(0.4583333333333333 * t$95$11 + N[(0.5 * t$95$6 + t$95$16), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 * t$95$14), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(N[(-1.0 / x), $MachinePrecision] + N[(N[(N[(0.25 * t$95$14 + t$95$8), $MachinePrecision] / x), $MachinePrecision] - N[(t$95$7 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\log x}^{3}\\
t_1 := n \cdot \left(-n\right)\\
t_2 := {\log x}^{2}\\
t_3 := \left(x \cdot x\right) \cdot x\\
t_4 := \frac{\log x}{t\_3}\\
t_5 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\
t_6 := {\left(x \cdot x\right)}^{-1}\\
t_7 := 0.3333333333333333 \cdot t\_6\\
t_8 := 0.5 \cdot {x}^{-1}\\
t_9 := \frac{t\_2}{{x}^{4}}\\
t_10 := \frac{\log x}{{x}^{4}}\\
t_11 := {\left({x}^{4}\right)}^{-1}\\
t_12 := \frac{t\_2}{x \cdot x}\\
t_13 := \frac{\log x}{x \cdot x}\\
t_14 := {t\_3}^{-1}\\
t_15 := \frac{t\_2}{t\_3}\\
t_16 := \frac{\log x}{x}\\
\mathbf{if}\;t\_5 \leq -\infty:\\
\;\;\;\;\frac{\frac{\log x + \mathsf{fma}\left(0.5, \frac{1 + -1 \cdot \log x}{x}, \mathsf{fma}\left(0.5, \frac{0.6666666666666666 \cdot \log x - 1}{x \cdot x}, n \cdot \left(\left(1 + t\_7\right) - t\_8\right)\right)\right)}{x}}{t\_1} \cdot -1\\

\mathbf{elif}\;t\_5 \leq 0.8227314594154127:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n} \cdot 0.5 - \frac{t\_2}{n} \cdot 0.5, -1, \mathsf{log1p}\left(x\right) \cdot -1\right) \cdot \left(-n\right) - n \cdot \log x}{t\_1} \cdot -1\\

\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.25, t\_10, \mathsf{fma}\left(-0.25, t\_15, \mathsf{fma}\left(-0.08333333333333333, \frac{t\_0}{x \cdot x}, \mathsf{fma}\left(-0.041666666666666664, \frac{t\_0}{{x}^{4}}, \mathsf{fma}\left(0.041666666666666664, t\_11, \mathsf{fma}\left(0.05555555555555555, {t\_16}^{3}, 0.16666666666666666 \cdot t\_4 + \mathsf{fma}\left(0.16666666666666666, \frac{t\_0}{x}, \mathsf{fma}\left(0.22916666666666666, t\_9, 0.25 \cdot t\_12\right)\right)\right)\right)\right)\right)\right)\right)}{n}, \mathsf{fma}\left(-0.5, t\_13, \mathsf{fma}\left(-0.5, \frac{t\_2}{x}, -0.4583333333333333 \cdot t\_10 + \left(-0.16666666666666666 \cdot t\_15 + \left(0.125 \cdot t\_9 + \mathsf{fma}\left(0.25, t\_11, \mathsf{fma}\left(0.25, t\_12, 0.5 \cdot t\_4\right)\right)\right)\right)\right)\right)\right) - 0.16666666666666666 \cdot t\_14}{n}, \mathsf{fma}\left(-0.5, t\_13, \mathsf{fma}\left(-0.25, t\_10, \mathsf{fma}\left(0.3333333333333333, t\_4, \mathsf{fma}\left(0.4583333333333333, t\_11, \mathsf{fma}\left(0.5, t\_6, t\_16\right)\right)\right)\right)\right)\right) - 0.5 \cdot t\_14}{n}, \frac{-1}{x} + \left(\frac{\mathsf{fma}\left(0.25, t\_14, t\_8\right)}{x} - \frac{t\_7}{x}\right)\right)}{n}\\


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

    1. Initial program 100.0%

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n} \cdot 0.5 - \frac{{\log x}^{2}}{n} \cdot 0.5, -1, \mathsf{log1p}\left(x\right) \cdot -1\right) \cdot \left(-n\right) - n \cdot \log x}{n \cdot \left(-n\right)} \cdot -1} \]
    4. Taylor expanded in x around inf

      \[\leadsto \frac{\frac{-1 \cdot \left(n \cdot \left(\frac{\log \left(\frac{1}{x}\right)}{n} - 1\right)\right) + \left(-1 \cdot \frac{n \cdot \left(\frac{1}{2} + \frac{-1}{2} \cdot \left(\frac{1}{n} + \frac{\log \left(\frac{1}{x}\right)}{n}\right)\right)}{x} + -1 \cdot \frac{n \cdot \left(\frac{-1}{2} \cdot \left(\frac{-2}{3} \cdot \frac{\log \left(\frac{1}{x}\right)}{n} - \frac{1}{n}\right) - \frac{1}{3}\right)}{{x}^{2}}\right)}{x}}{n \cdot \left(-n\right)} \cdot -1 \]
    5. Applied rewrites91.4%

      \[\leadsto \frac{\frac{\mathsf{fma}\left(-1, n \cdot \left(\frac{-1 \cdot \log x}{n} - 1\right), \mathsf{fma}\left(-1, \frac{n \cdot \left(0.5 + -0.5 \cdot \frac{1 + -1 \cdot \log x}{n}\right)}{x}, -1 \cdot \frac{n \cdot \left(-0.5 \cdot \left(-0.6666666666666666 \cdot \frac{-1 \cdot \log x}{n} - {n}^{-1}\right) - 0.3333333333333333\right)}{x \cdot x}\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1 \]
    6. Taylor expanded in n around 0

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

        \[\leadsto \frac{\frac{\log x + \left(\frac{1}{2} \cdot \frac{1 + -1 \cdot \log x}{x} + \left(\frac{1}{2} \cdot \frac{\frac{2}{3} \cdot \log x - 1}{{x}^{2}} + n \cdot \left(\left(1 + \frac{1}{3} \cdot \frac{1}{{x}^{2}}\right) - \frac{1}{2} \cdot \frac{1}{x}\right)\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1 \]
      2. lift-log.f64N/A

        \[\leadsto \frac{\frac{\log x + \left(\frac{1}{2} \cdot \frac{1 + -1 \cdot \log x}{x} + \left(\frac{1}{2} \cdot \frac{\frac{2}{3} \cdot \log x - 1}{{x}^{2}} + n \cdot \left(\left(1 + \frac{1}{3} \cdot \frac{1}{{x}^{2}}\right) - \frac{1}{2} \cdot \frac{1}{x}\right)\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1 \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\frac{\log x + \mathsf{fma}\left(\frac{1}{2}, \frac{1 + -1 \cdot \log x}{x}, \frac{1}{2} \cdot \frac{\frac{2}{3} \cdot \log x - 1}{{x}^{2}} + n \cdot \left(\left(1 + \frac{1}{3} \cdot \frac{1}{{x}^{2}}\right) - \frac{1}{2} \cdot \frac{1}{x}\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1 \]
    8. Applied rewrites91.7%

      \[\leadsto \frac{\frac{\log x + \mathsf{fma}\left(0.5, \frac{1 + -1 \cdot \log x}{x}, \mathsf{fma}\left(0.5, \frac{0.6666666666666666 \cdot \log x - 1}{x \cdot x}, n \cdot \left(\left(1 + 0.3333333333333333 \cdot {\left(x \cdot x\right)}^{-1}\right) - 0.5 \cdot {x}^{-1}\right)\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1 \]

    if -inf.0 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 0.8227314594154127

    1. Initial program 44.0%

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

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

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

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

    1. Initial program 52.2%

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}, x, \left(-n \cdot x\right) \cdot \mathsf{fma}\left({\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}, \frac{{\left(n \cdot n\right)}^{-1} \cdot 0.5}{x} - \frac{0.5 \cdot {n}^{-1}}{x}, \mathsf{fma}\left({\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}, \frac{\mathsf{fma}\left(0.3333333333333333, {n}^{-1}, {\left(\left(n \cdot n\right) \cdot n\right)}^{-1} \cdot 0.16666666666666666\right) - {\left(n \cdot n\right)}^{-1} \cdot 0.5}{x \cdot x}, {\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)} \cdot \frac{\mathsf{fma}\left(0.4583333333333333, {\left(n \cdot n\right)}^{-1}, {\left({\left(n \cdot n\right)}^{2}\right)}^{-1} \cdot 0.041666666666666664\right) - \mathsf{fma}\left(0.25, {\left(\left(n \cdot n\right) \cdot n\right)}^{-1}, 0.25 \cdot {n}^{-1}\right)}{\left(x \cdot x\right) \cdot x}\right)\right)\right)}{\left(-n \cdot x\right) \cdot x}} \]
    4. Taylor expanded in n around -inf

      \[\leadsto -1 \cdot \color{blue}{\frac{-1 \cdot \frac{\left(-1 \cdot \frac{\left(-1 \cdot \frac{\frac{-1}{4} \cdot \frac{\log x}{{x}^{4}} + \left(\frac{-1}{4} \cdot \frac{{\log x}^{2}}{{x}^{3}} + \left(\frac{-1}{12} \cdot \frac{{\log x}^{3}}{{x}^{2}} + \left(\frac{-1}{24} \cdot \frac{{\log x}^{3}}{{x}^{4}} + \left(\frac{1}{24} \cdot \frac{1}{{x}^{4}} + \left(\frac{1}{18} \cdot \frac{{\log x}^{3}}{{x}^{3}} + \left(\frac{1}{6} \cdot \frac{\log x}{{x}^{3}} + \left(\frac{1}{6} \cdot \frac{{\log x}^{3}}{x} + \left(\frac{11}{48} \cdot \frac{{\log x}^{2}}{{x}^{4}} + \frac{1}{4} \cdot \frac{{\log x}^{2}}{{x}^{2}}\right)\right)\right)\right)\right)\right)\right)\right)}{n} + \left(\frac{-1}{2} \cdot \frac{\log x}{{x}^{2}} + \left(\frac{-1}{2} \cdot \frac{{\log x}^{2}}{x} + \left(\frac{-11}{24} \cdot \frac{\log x}{{x}^{4}} + \left(\frac{-1}{6} \cdot \frac{{\log x}^{2}}{{x}^{3}} + \left(\frac{1}{8} \cdot \frac{{\log x}^{2}}{{x}^{4}} + \left(\frac{1}{4} \cdot \frac{1}{{x}^{4}} + \left(\frac{1}{4} \cdot \frac{{\log x}^{2}}{{x}^{2}} + \frac{1}{2} \cdot \frac{\log x}{{x}^{3}}\right)\right)\right)\right)\right)\right)\right)\right) - \frac{1}{6} \cdot \frac{1}{{x}^{3}}}{n} + \left(\frac{-1}{2} \cdot \frac{\log x}{{x}^{2}} + \left(\frac{-1}{4} \cdot \frac{\log x}{{x}^{4}} + \left(\frac{1}{3} \cdot \frac{\log x}{{x}^{3}} + \left(\frac{11}{24} \cdot \frac{1}{{x}^{4}} + \left(\frac{1}{2} \cdot \frac{1}{{x}^{2}} + \frac{\log x}{x}\right)\right)\right)\right)\right)\right) - \frac{1}{2} \cdot \frac{1}{{x}^{3}}}{n} + \left(\frac{-1}{x} + \frac{\left(\frac{1}{4} \cdot \frac{1}{{x}^{3}} + \frac{1}{2} \cdot \frac{1}{x}\right) - \frac{1}{3} \cdot \frac{1}{{x}^{2}}}{x}\right)}{n}} \]
    5. Applied rewrites21.8%

      \[\leadsto -1 \cdot \color{blue}{\frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.25, \frac{\log x}{{x}^{4}}, \mathsf{fma}\left(-0.25, \frac{{\log x}^{2}}{\left(x \cdot x\right) \cdot x}, \mathsf{fma}\left(-0.08333333333333333, \frac{{\log x}^{3}}{x \cdot x}, \mathsf{fma}\left(-0.041666666666666664, \frac{{\log x}^{3}}{{x}^{4}}, \mathsf{fma}\left(0.041666666666666664, {\left({x}^{4}\right)}^{-1}, \mathsf{fma}\left(0.05555555555555555, {\left(\frac{\log x}{x}\right)}^{3}, 0.16666666666666666 \cdot \frac{\log x}{\left(x \cdot x\right) \cdot x} + \mathsf{fma}\left(0.16666666666666666, \frac{{\log x}^{3}}{x}, \mathsf{fma}\left(0.22916666666666666, \frac{{\log x}^{2}}{{x}^{4}}, 0.25 \cdot \frac{{\log x}^{2}}{x \cdot x}\right)\right)\right)\right)\right)\right)\right)\right)}{n}, \mathsf{fma}\left(-0.5, \frac{\log x}{x \cdot x}, \mathsf{fma}\left(-0.5, \frac{{\log x}^{2}}{x}, -0.4583333333333333 \cdot \frac{\log x}{{x}^{4}} + \left(-0.16666666666666666 \cdot \frac{{\log x}^{2}}{\left(x \cdot x\right) \cdot x} + \left(0.125 \cdot \frac{{\log x}^{2}}{{x}^{4}} + \mathsf{fma}\left(0.25, {\left({x}^{4}\right)}^{-1}, \mathsf{fma}\left(0.25, \frac{{\log x}^{2}}{x \cdot x}, 0.5 \cdot \frac{\log x}{\left(x \cdot x\right) \cdot x}\right)\right)\right)\right)\right)\right)\right) - 0.16666666666666666 \cdot {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}}{n}, \mathsf{fma}\left(-0.5, \frac{\log x}{x \cdot x}, \mathsf{fma}\left(-0.25, \frac{\log x}{{x}^{4}}, \mathsf{fma}\left(0.3333333333333333, \frac{\log x}{\left(x \cdot x\right) \cdot x}, \mathsf{fma}\left(0.4583333333333333, {\left({x}^{4}\right)}^{-1}, \mathsf{fma}\left(0.5, {\left(x \cdot x\right)}^{-1}, \frac{\log x}{x}\right)\right)\right)\right)\right)\right) - 0.5 \cdot {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}}{n}, \frac{-1}{x} + \left(\frac{\mathsf{fma}\left(0.25, {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}, 0.5 \cdot {x}^{-1}\right)}{x} - \frac{0.3333333333333333 \cdot {\left(x \cdot x\right)}^{-1}}{x}\right)\right)}{n}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 8: 44.7% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\log x}{x}\\ t_1 := \left(x \cdot x\right) \cdot x\\ t_2 := \frac{\log x}{t\_1}\\ t_3 := {\log x}^{3}\\ t_4 := 0.5 \cdot {x}^{-1}\\ t_5 := \frac{\log x}{{x}^{4}}\\ t_6 := {\left({x}^{4}\right)}^{-1}\\ t_7 := {\log x}^{2}\\ t_8 := \frac{t\_7}{t\_1}\\ t_9 := \frac{t\_7}{x \cdot x}\\ t_10 := \frac{\log x}{x \cdot x}\\ t_11 := {t\_1}^{-1}\\ t_12 := {\left(x \cdot x\right)}^{-1}\\ t_13 := 0.3333333333333333 \cdot t\_12\\ t_14 := \frac{t\_7}{{x}^{4}}\\ \mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-143}:\\ \;\;\;\;\frac{\frac{\log x + \mathsf{fma}\left(0.5, \frac{1 + -1 \cdot \log x}{x}, \mathsf{fma}\left(0.5, \frac{0.6666666666666666 \cdot \log x - 1}{x \cdot x}, n \cdot \left(\left(1 + t\_13\right) - t\_4\right)\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.25, t\_5, \mathsf{fma}\left(-0.25, t\_8, \mathsf{fma}\left(-0.08333333333333333, \frac{t\_3}{x \cdot x}, \mathsf{fma}\left(-0.041666666666666664, \frac{t\_3}{{x}^{4}}, \mathsf{fma}\left(0.041666666666666664, t\_6, \mathsf{fma}\left(0.05555555555555555, {t\_0}^{3}, 0.16666666666666666 \cdot t\_2 + \mathsf{fma}\left(0.16666666666666666, \frac{t\_3}{x}, \mathsf{fma}\left(0.22916666666666666, t\_14, 0.25 \cdot t\_9\right)\right)\right)\right)\right)\right)\right)\right)}{n}, \mathsf{fma}\left(-0.5, t\_10, \mathsf{fma}\left(-0.5, \frac{t\_7}{x}, -0.4583333333333333 \cdot t\_5 + \left(-0.16666666666666666 \cdot t\_8 + \left(0.125 \cdot t\_14 + \mathsf{fma}\left(0.25, t\_6, \mathsf{fma}\left(0.25, t\_9, 0.5 \cdot t\_2\right)\right)\right)\right)\right)\right)\right) - 0.16666666666666666 \cdot t\_11}{n}, \mathsf{fma}\left(-0.5, t\_10, \mathsf{fma}\left(-0.25, t\_5, \mathsf{fma}\left(0.3333333333333333, t\_2, \mathsf{fma}\left(0.4583333333333333, t\_6, \mathsf{fma}\left(0.5, t\_12, t\_0\right)\right)\right)\right)\right)\right) - 0.5 \cdot t\_11}{n}, \frac{-1}{x} + \left(\frac{\mathsf{fma}\left(0.25, t\_11, t\_4\right)}{x} - \frac{t\_13}{x}\right)\right)}{n}\\ \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (/ (log x) x))
        (t_1 (* (* x x) x))
        (t_2 (/ (log x) t_1))
        (t_3 (pow (log x) 3.0))
        (t_4 (* 0.5 (pow x -1.0)))
        (t_5 (/ (log x) (pow x 4.0)))
        (t_6 (pow (pow x 4.0) -1.0))
        (t_7 (pow (log x) 2.0))
        (t_8 (/ t_7 t_1))
        (t_9 (/ t_7 (* x x)))
        (t_10 (/ (log x) (* x x)))
        (t_11 (pow t_1 -1.0))
        (t_12 (pow (* x x) -1.0))
        (t_13 (* 0.3333333333333333 t_12))
        (t_14 (/ t_7 (pow x 4.0))))
   (if (<= (/ 1.0 n) -2e-143)
     (*
      (/
       (/
        (+
         (log x)
         (fma
          0.5
          (/ (+ 1.0 (* -1.0 (log x))) x)
          (fma
           0.5
           (/ (- (* 0.6666666666666666 (log x)) 1.0) (* x x))
           (* n (- (+ 1.0 t_13) t_4)))))
        x)
       (* n (- n)))
      -1.0)
     (*
      -1.0
      (/
       (fma
        -1.0
        (/
         (-
          (fma
           -1.0
           (/
            (-
             (fma
              -1.0
              (/
               (fma
                -0.25
                t_5
                (fma
                 -0.25
                 t_8
                 (fma
                  -0.08333333333333333
                  (/ t_3 (* x x))
                  (fma
                   -0.041666666666666664
                   (/ t_3 (pow x 4.0))
                   (fma
                    0.041666666666666664
                    t_6
                    (fma
                     0.05555555555555555
                     (pow t_0 3.0)
                     (+
                      (* 0.16666666666666666 t_2)
                      (fma
                       0.16666666666666666
                       (/ t_3 x)
                       (fma 0.22916666666666666 t_14 (* 0.25 t_9))))))))))
               n)
              (fma
               -0.5
               t_10
               (fma
                -0.5
                (/ t_7 x)
                (+
                 (* -0.4583333333333333 t_5)
                 (+
                  (* -0.16666666666666666 t_8)
                  (+
                   (* 0.125 t_14)
                   (fma 0.25 t_6 (fma 0.25 t_9 (* 0.5 t_2)))))))))
             (* 0.16666666666666666 t_11))
            n)
           (fma
            -0.5
            t_10
            (fma
             -0.25
             t_5
             (fma
              0.3333333333333333
              t_2
              (fma 0.4583333333333333 t_6 (fma 0.5 t_12 t_0))))))
          (* 0.5 t_11))
         n)
        (+ (/ -1.0 x) (- (/ (fma 0.25 t_11 t_4) x) (/ t_13 x))))
       n)))))
double code(double x, double n) {
	double t_0 = log(x) / x;
	double t_1 = (x * x) * x;
	double t_2 = log(x) / t_1;
	double t_3 = pow(log(x), 3.0);
	double t_4 = 0.5 * pow(x, -1.0);
	double t_5 = log(x) / pow(x, 4.0);
	double t_6 = pow(pow(x, 4.0), -1.0);
	double t_7 = pow(log(x), 2.0);
	double t_8 = t_7 / t_1;
	double t_9 = t_7 / (x * x);
	double t_10 = log(x) / (x * x);
	double t_11 = pow(t_1, -1.0);
	double t_12 = pow((x * x), -1.0);
	double t_13 = 0.3333333333333333 * t_12;
	double t_14 = t_7 / pow(x, 4.0);
	double tmp;
	if ((1.0 / n) <= -2e-143) {
		tmp = (((log(x) + fma(0.5, ((1.0 + (-1.0 * log(x))) / x), fma(0.5, (((0.6666666666666666 * log(x)) - 1.0) / (x * x)), (n * ((1.0 + t_13) - t_4))))) / x) / (n * -n)) * -1.0;
	} else {
		tmp = -1.0 * (fma(-1.0, ((fma(-1.0, ((fma(-1.0, (fma(-0.25, t_5, fma(-0.25, t_8, fma(-0.08333333333333333, (t_3 / (x * x)), fma(-0.041666666666666664, (t_3 / pow(x, 4.0)), fma(0.041666666666666664, t_6, fma(0.05555555555555555, pow(t_0, 3.0), ((0.16666666666666666 * t_2) + fma(0.16666666666666666, (t_3 / x), fma(0.22916666666666666, t_14, (0.25 * t_9)))))))))) / n), fma(-0.5, t_10, fma(-0.5, (t_7 / x), ((-0.4583333333333333 * t_5) + ((-0.16666666666666666 * t_8) + ((0.125 * t_14) + fma(0.25, t_6, fma(0.25, t_9, (0.5 * t_2))))))))) - (0.16666666666666666 * t_11)) / n), fma(-0.5, t_10, fma(-0.25, t_5, fma(0.3333333333333333, t_2, fma(0.4583333333333333, t_6, fma(0.5, t_12, t_0)))))) - (0.5 * t_11)) / n), ((-1.0 / x) + ((fma(0.25, t_11, t_4) / x) - (t_13 / x)))) / n);
	}
	return tmp;
}
function code(x, n)
	t_0 = Float64(log(x) / x)
	t_1 = Float64(Float64(x * x) * x)
	t_2 = Float64(log(x) / t_1)
	t_3 = log(x) ^ 3.0
	t_4 = Float64(0.5 * (x ^ -1.0))
	t_5 = Float64(log(x) / (x ^ 4.0))
	t_6 = (x ^ 4.0) ^ -1.0
	t_7 = log(x) ^ 2.0
	t_8 = Float64(t_7 / t_1)
	t_9 = Float64(t_7 / Float64(x * x))
	t_10 = Float64(log(x) / Float64(x * x))
	t_11 = t_1 ^ -1.0
	t_12 = Float64(x * x) ^ -1.0
	t_13 = Float64(0.3333333333333333 * t_12)
	t_14 = Float64(t_7 / (x ^ 4.0))
	tmp = 0.0
	if (Float64(1.0 / n) <= -2e-143)
		tmp = Float64(Float64(Float64(Float64(log(x) + fma(0.5, Float64(Float64(1.0 + Float64(-1.0 * log(x))) / x), fma(0.5, Float64(Float64(Float64(0.6666666666666666 * log(x)) - 1.0) / Float64(x * x)), Float64(n * Float64(Float64(1.0 + t_13) - t_4))))) / x) / Float64(n * Float64(-n))) * -1.0);
	else
		tmp = Float64(-1.0 * Float64(fma(-1.0, Float64(Float64(fma(-1.0, Float64(Float64(fma(-1.0, Float64(fma(-0.25, t_5, fma(-0.25, t_8, fma(-0.08333333333333333, Float64(t_3 / Float64(x * x)), fma(-0.041666666666666664, Float64(t_3 / (x ^ 4.0)), fma(0.041666666666666664, t_6, fma(0.05555555555555555, (t_0 ^ 3.0), Float64(Float64(0.16666666666666666 * t_2) + fma(0.16666666666666666, Float64(t_3 / x), fma(0.22916666666666666, t_14, Float64(0.25 * t_9)))))))))) / n), fma(-0.5, t_10, fma(-0.5, Float64(t_7 / x), Float64(Float64(-0.4583333333333333 * t_5) + Float64(Float64(-0.16666666666666666 * t_8) + Float64(Float64(0.125 * t_14) + fma(0.25, t_6, fma(0.25, t_9, Float64(0.5 * t_2))))))))) - Float64(0.16666666666666666 * t_11)) / n), fma(-0.5, t_10, fma(-0.25, t_5, fma(0.3333333333333333, t_2, fma(0.4583333333333333, t_6, fma(0.5, t_12, t_0)))))) - Float64(0.5 * t_11)) / n), Float64(Float64(-1.0 / x) + Float64(Float64(fma(0.25, t_11, t_4) / x) - Float64(t_13 / x)))) / n));
	end
	return tmp
end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / x), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[x], $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]}, Block[{t$95$4 = N[(0.5 * N[Power[x, -1.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[Log[x], $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[Power[N[Power[x, 4.0], $MachinePrecision], -1.0], $MachinePrecision]}, Block[{t$95$7 = N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$8 = N[(t$95$7 / t$95$1), $MachinePrecision]}, Block[{t$95$9 = N[(t$95$7 / N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$10 = N[(N[Log[x], $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$11 = N[Power[t$95$1, -1.0], $MachinePrecision]}, Block[{t$95$12 = N[Power[N[(x * x), $MachinePrecision], -1.0], $MachinePrecision]}, Block[{t$95$13 = N[(0.3333333333333333 * t$95$12), $MachinePrecision]}, Block[{t$95$14 = N[(t$95$7 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-143], N[(N[(N[(N[(N[Log[x], $MachinePrecision] + N[(0.5 * N[(N[(1.0 + N[(-1.0 * N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(0.5 * N[(N[(N[(0.6666666666666666 * N[Log[x], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(n * N[(N[(1.0 + t$95$13), $MachinePrecision] - t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / N[(n * (-n)), $MachinePrecision]), $MachinePrecision] * -1.0), $MachinePrecision], N[(-1.0 * N[(N[(-1.0 * N[(N[(N[(-1.0 * N[(N[(N[(-1.0 * N[(N[(-0.25 * t$95$5 + N[(-0.25 * t$95$8 + N[(-0.08333333333333333 * N[(t$95$3 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(-0.041666666666666664 * N[(t$95$3 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(0.041666666666666664 * t$95$6 + N[(0.05555555555555555 * N[Power[t$95$0, 3.0], $MachinePrecision] + N[(N[(0.16666666666666666 * t$95$2), $MachinePrecision] + N[(0.16666666666666666 * N[(t$95$3 / x), $MachinePrecision] + N[(0.22916666666666666 * t$95$14 + N[(0.25 * t$95$9), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(-0.5 * t$95$10 + N[(-0.5 * N[(t$95$7 / x), $MachinePrecision] + N[(N[(-0.4583333333333333 * t$95$5), $MachinePrecision] + N[(N[(-0.16666666666666666 * t$95$8), $MachinePrecision] + N[(N[(0.125 * t$95$14), $MachinePrecision] + N[(0.25 * t$95$6 + N[(0.25 * t$95$9 + N[(0.5 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.16666666666666666 * t$95$11), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(-0.5 * t$95$10 + N[(-0.25 * t$95$5 + N[(0.3333333333333333 * t$95$2 + N[(0.4583333333333333 * t$95$6 + N[(0.5 * t$95$12 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 * t$95$11), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(N[(-1.0 / x), $MachinePrecision] + N[(N[(N[(0.25 * t$95$11 + t$95$4), $MachinePrecision] / x), $MachinePrecision] - N[(t$95$13 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\log x}{x}\\
t_1 := \left(x \cdot x\right) \cdot x\\
t_2 := \frac{\log x}{t\_1}\\
t_3 := {\log x}^{3}\\
t_4 := 0.5 \cdot {x}^{-1}\\
t_5 := \frac{\log x}{{x}^{4}}\\
t_6 := {\left({x}^{4}\right)}^{-1}\\
t_7 := {\log x}^{2}\\
t_8 := \frac{t\_7}{t\_1}\\
t_9 := \frac{t\_7}{x \cdot x}\\
t_10 := \frac{\log x}{x \cdot x}\\
t_11 := {t\_1}^{-1}\\
t_12 := {\left(x \cdot x\right)}^{-1}\\
t_13 := 0.3333333333333333 \cdot t\_12\\
t_14 := \frac{t\_7}{{x}^{4}}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-143}:\\
\;\;\;\;\frac{\frac{\log x + \mathsf{fma}\left(0.5, \frac{1 + -1 \cdot \log x}{x}, \mathsf{fma}\left(0.5, \frac{0.6666666666666666 \cdot \log x - 1}{x \cdot x}, n \cdot \left(\left(1 + t\_13\right) - t\_4\right)\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1\\

\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.25, t\_5, \mathsf{fma}\left(-0.25, t\_8, \mathsf{fma}\left(-0.08333333333333333, \frac{t\_3}{x \cdot x}, \mathsf{fma}\left(-0.041666666666666664, \frac{t\_3}{{x}^{4}}, \mathsf{fma}\left(0.041666666666666664, t\_6, \mathsf{fma}\left(0.05555555555555555, {t\_0}^{3}, 0.16666666666666666 \cdot t\_2 + \mathsf{fma}\left(0.16666666666666666, \frac{t\_3}{x}, \mathsf{fma}\left(0.22916666666666666, t\_14, 0.25 \cdot t\_9\right)\right)\right)\right)\right)\right)\right)\right)}{n}, \mathsf{fma}\left(-0.5, t\_10, \mathsf{fma}\left(-0.5, \frac{t\_7}{x}, -0.4583333333333333 \cdot t\_5 + \left(-0.16666666666666666 \cdot t\_8 + \left(0.125 \cdot t\_14 + \mathsf{fma}\left(0.25, t\_6, \mathsf{fma}\left(0.25, t\_9, 0.5 \cdot t\_2\right)\right)\right)\right)\right)\right)\right) - 0.16666666666666666 \cdot t\_11}{n}, \mathsf{fma}\left(-0.5, t\_10, \mathsf{fma}\left(-0.25, t\_5, \mathsf{fma}\left(0.3333333333333333, t\_2, \mathsf{fma}\left(0.4583333333333333, t\_6, \mathsf{fma}\left(0.5, t\_12, t\_0\right)\right)\right)\right)\right)\right) - 0.5 \cdot t\_11}{n}, \frac{-1}{x} + \left(\frac{\mathsf{fma}\left(0.25, t\_11, t\_4\right)}{x} - \frac{t\_13}{x}\right)\right)}{n}\\


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

    1. Initial program 74.0%

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n} \cdot 0.5 - \frac{{\log x}^{2}}{n} \cdot 0.5, -1, \mathsf{log1p}\left(x\right) \cdot -1\right) \cdot \left(-n\right) - n \cdot \log x}{n \cdot \left(-n\right)} \cdot -1} \]
    4. Taylor expanded in x around inf

      \[\leadsto \frac{\frac{-1 \cdot \left(n \cdot \left(\frac{\log \left(\frac{1}{x}\right)}{n} - 1\right)\right) + \left(-1 \cdot \frac{n \cdot \left(\frac{1}{2} + \frac{-1}{2} \cdot \left(\frac{1}{n} + \frac{\log \left(\frac{1}{x}\right)}{n}\right)\right)}{x} + -1 \cdot \frac{n \cdot \left(\frac{-1}{2} \cdot \left(\frac{-2}{3} \cdot \frac{\log \left(\frac{1}{x}\right)}{n} - \frac{1}{n}\right) - \frac{1}{3}\right)}{{x}^{2}}\right)}{x}}{n \cdot \left(-n\right)} \cdot -1 \]
    5. Applied rewrites47.1%

      \[\leadsto \frac{\frac{\mathsf{fma}\left(-1, n \cdot \left(\frac{-1 \cdot \log x}{n} - 1\right), \mathsf{fma}\left(-1, \frac{n \cdot \left(0.5 + -0.5 \cdot \frac{1 + -1 \cdot \log x}{n}\right)}{x}, -1 \cdot \frac{n \cdot \left(-0.5 \cdot \left(-0.6666666666666666 \cdot \frac{-1 \cdot \log x}{n} - {n}^{-1}\right) - 0.3333333333333333\right)}{x \cdot x}\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1 \]
    6. Taylor expanded in n around 0

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

        \[\leadsto \frac{\frac{\log x + \left(\frac{1}{2} \cdot \frac{1 + -1 \cdot \log x}{x} + \left(\frac{1}{2} \cdot \frac{\frac{2}{3} \cdot \log x - 1}{{x}^{2}} + n \cdot \left(\left(1 + \frac{1}{3} \cdot \frac{1}{{x}^{2}}\right) - \frac{1}{2} \cdot \frac{1}{x}\right)\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1 \]
      2. lift-log.f64N/A

        \[\leadsto \frac{\frac{\log x + \left(\frac{1}{2} \cdot \frac{1 + -1 \cdot \log x}{x} + \left(\frac{1}{2} \cdot \frac{\frac{2}{3} \cdot \log x - 1}{{x}^{2}} + n \cdot \left(\left(1 + \frac{1}{3} \cdot \frac{1}{{x}^{2}}\right) - \frac{1}{2} \cdot \frac{1}{x}\right)\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1 \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\frac{\log x + \mathsf{fma}\left(\frac{1}{2}, \frac{1 + -1 \cdot \log x}{x}, \frac{1}{2} \cdot \frac{\frac{2}{3} \cdot \log x - 1}{{x}^{2}} + n \cdot \left(\left(1 + \frac{1}{3} \cdot \frac{1}{{x}^{2}}\right) - \frac{1}{2} \cdot \frac{1}{x}\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1 \]
    8. Applied rewrites47.3%

      \[\leadsto \frac{\frac{\log x + \mathsf{fma}\left(0.5, \frac{1 + -1 \cdot \log x}{x}, \mathsf{fma}\left(0.5, \frac{0.6666666666666666 \cdot \log x - 1}{x \cdot x}, n \cdot \left(\left(1 + 0.3333333333333333 \cdot {\left(x \cdot x\right)}^{-1}\right) - 0.5 \cdot {x}^{-1}\right)\right)\right)}{x}}{n \cdot \left(-n\right)} \cdot -1 \]

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

    1. Initial program 38.3%

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}, x, \left(-n \cdot x\right) \cdot \mathsf{fma}\left({\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}, \frac{{\left(n \cdot n\right)}^{-1} \cdot 0.5}{x} - \frac{0.5 \cdot {n}^{-1}}{x}, \mathsf{fma}\left({\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}, \frac{\mathsf{fma}\left(0.3333333333333333, {n}^{-1}, {\left(\left(n \cdot n\right) \cdot n\right)}^{-1} \cdot 0.16666666666666666\right) - {\left(n \cdot n\right)}^{-1} \cdot 0.5}{x \cdot x}, {\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)} \cdot \frac{\mathsf{fma}\left(0.4583333333333333, {\left(n \cdot n\right)}^{-1}, {\left({\left(n \cdot n\right)}^{2}\right)}^{-1} \cdot 0.041666666666666664\right) - \mathsf{fma}\left(0.25, {\left(\left(n \cdot n\right) \cdot n\right)}^{-1}, 0.25 \cdot {n}^{-1}\right)}{\left(x \cdot x\right) \cdot x}\right)\right)\right)}{\left(-n \cdot x\right) \cdot x}} \]
    4. Taylor expanded in n around -inf

      \[\leadsto -1 \cdot \color{blue}{\frac{-1 \cdot \frac{\left(-1 \cdot \frac{\left(-1 \cdot \frac{\frac{-1}{4} \cdot \frac{\log x}{{x}^{4}} + \left(\frac{-1}{4} \cdot \frac{{\log x}^{2}}{{x}^{3}} + \left(\frac{-1}{12} \cdot \frac{{\log x}^{3}}{{x}^{2}} + \left(\frac{-1}{24} \cdot \frac{{\log x}^{3}}{{x}^{4}} + \left(\frac{1}{24} \cdot \frac{1}{{x}^{4}} + \left(\frac{1}{18} \cdot \frac{{\log x}^{3}}{{x}^{3}} + \left(\frac{1}{6} \cdot \frac{\log x}{{x}^{3}} + \left(\frac{1}{6} \cdot \frac{{\log x}^{3}}{x} + \left(\frac{11}{48} \cdot \frac{{\log x}^{2}}{{x}^{4}} + \frac{1}{4} \cdot \frac{{\log x}^{2}}{{x}^{2}}\right)\right)\right)\right)\right)\right)\right)\right)}{n} + \left(\frac{-1}{2} \cdot \frac{\log x}{{x}^{2}} + \left(\frac{-1}{2} \cdot \frac{{\log x}^{2}}{x} + \left(\frac{-11}{24} \cdot \frac{\log x}{{x}^{4}} + \left(\frac{-1}{6} \cdot \frac{{\log x}^{2}}{{x}^{3}} + \left(\frac{1}{8} \cdot \frac{{\log x}^{2}}{{x}^{4}} + \left(\frac{1}{4} \cdot \frac{1}{{x}^{4}} + \left(\frac{1}{4} \cdot \frac{{\log x}^{2}}{{x}^{2}} + \frac{1}{2} \cdot \frac{\log x}{{x}^{3}}\right)\right)\right)\right)\right)\right)\right)\right) - \frac{1}{6} \cdot \frac{1}{{x}^{3}}}{n} + \left(\frac{-1}{2} \cdot \frac{\log x}{{x}^{2}} + \left(\frac{-1}{4} \cdot \frac{\log x}{{x}^{4}} + \left(\frac{1}{3} \cdot \frac{\log x}{{x}^{3}} + \left(\frac{11}{24} \cdot \frac{1}{{x}^{4}} + \left(\frac{1}{2} \cdot \frac{1}{{x}^{2}} + \frac{\log x}{x}\right)\right)\right)\right)\right)\right) - \frac{1}{2} \cdot \frac{1}{{x}^{3}}}{n} + \left(\frac{-1}{x} + \frac{\left(\frac{1}{4} \cdot \frac{1}{{x}^{3}} + \frac{1}{2} \cdot \frac{1}{x}\right) - \frac{1}{3} \cdot \frac{1}{{x}^{2}}}{x}\right)}{n}} \]
    5. Applied rewrites42.8%

      \[\leadsto -1 \cdot \color{blue}{\frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.25, \frac{\log x}{{x}^{4}}, \mathsf{fma}\left(-0.25, \frac{{\log x}^{2}}{\left(x \cdot x\right) \cdot x}, \mathsf{fma}\left(-0.08333333333333333, \frac{{\log x}^{3}}{x \cdot x}, \mathsf{fma}\left(-0.041666666666666664, \frac{{\log x}^{3}}{{x}^{4}}, \mathsf{fma}\left(0.041666666666666664, {\left({x}^{4}\right)}^{-1}, \mathsf{fma}\left(0.05555555555555555, {\left(\frac{\log x}{x}\right)}^{3}, 0.16666666666666666 \cdot \frac{\log x}{\left(x \cdot x\right) \cdot x} + \mathsf{fma}\left(0.16666666666666666, \frac{{\log x}^{3}}{x}, \mathsf{fma}\left(0.22916666666666666, \frac{{\log x}^{2}}{{x}^{4}}, 0.25 \cdot \frac{{\log x}^{2}}{x \cdot x}\right)\right)\right)\right)\right)\right)\right)\right)}{n}, \mathsf{fma}\left(-0.5, \frac{\log x}{x \cdot x}, \mathsf{fma}\left(-0.5, \frac{{\log x}^{2}}{x}, -0.4583333333333333 \cdot \frac{\log x}{{x}^{4}} + \left(-0.16666666666666666 \cdot \frac{{\log x}^{2}}{\left(x \cdot x\right) \cdot x} + \left(0.125 \cdot \frac{{\log x}^{2}}{{x}^{4}} + \mathsf{fma}\left(0.25, {\left({x}^{4}\right)}^{-1}, \mathsf{fma}\left(0.25, \frac{{\log x}^{2}}{x \cdot x}, 0.5 \cdot \frac{\log x}{\left(x \cdot x\right) \cdot x}\right)\right)\right)\right)\right)\right)\right) - 0.16666666666666666 \cdot {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}}{n}, \mathsf{fma}\left(-0.5, \frac{\log x}{x \cdot x}, \mathsf{fma}\left(-0.25, \frac{\log x}{{x}^{4}}, \mathsf{fma}\left(0.3333333333333333, \frac{\log x}{\left(x \cdot x\right) \cdot x}, \mathsf{fma}\left(0.4583333333333333, {\left({x}^{4}\right)}^{-1}, \mathsf{fma}\left(0.5, {\left(x \cdot x\right)}^{-1}, \frac{\log x}{x}\right)\right)\right)\right)\right)\right) - 0.5 \cdot {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}}{n}, \frac{-1}{x} + \left(\frac{\mathsf{fma}\left(0.25, {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}, 0.5 \cdot {x}^{-1}\right)}{x} - \frac{0.3333333333333333 \cdot {\left(x \cdot x\right)}^{-1}}{x}\right)\right)}{n}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 30.8% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\log x}^{2}\\ t_1 := {\log x}^{3}\\ t_2 := \frac{\log x}{{x}^{4}}\\ t_3 := \frac{t\_0}{{x}^{4}}\\ t_4 := {\left(x \cdot x\right)}^{-1}\\ t_5 := {\left({x}^{4}\right)}^{-1}\\ t_6 := \frac{t\_0}{x \cdot x}\\ t_7 := \left(x \cdot x\right) \cdot x\\ t_8 := \frac{t\_0}{t\_7}\\ t_9 := {t\_7}^{-1}\\ t_10 := \frac{\log x}{t\_7}\\ t_11 := \frac{\log x}{x}\\ t_12 := \frac{\log x}{x \cdot x}\\ -1 \cdot \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.25, t\_2, \mathsf{fma}\left(-0.25, t\_8, \mathsf{fma}\left(-0.08333333333333333, \frac{t\_1}{x \cdot x}, \mathsf{fma}\left(-0.041666666666666664, \frac{t\_1}{{x}^{4}}, \mathsf{fma}\left(0.041666666666666664, t\_5, \mathsf{fma}\left(0.05555555555555555, {t\_11}^{3}, 0.16666666666666666 \cdot t\_10 + \mathsf{fma}\left(0.16666666666666666, \frac{t\_1}{x}, \mathsf{fma}\left(0.22916666666666666, t\_3, 0.25 \cdot t\_6\right)\right)\right)\right)\right)\right)\right)\right)}{n}, \mathsf{fma}\left(-0.5, t\_12, \mathsf{fma}\left(-0.5, \frac{t\_0}{x}, -0.4583333333333333 \cdot t\_2 + \left(-0.16666666666666666 \cdot t\_8 + \left(0.125 \cdot t\_3 + \mathsf{fma}\left(0.25, t\_5, \mathsf{fma}\left(0.25, t\_6, 0.5 \cdot t\_10\right)\right)\right)\right)\right)\right)\right) - 0.16666666666666666 \cdot t\_9}{n}, \mathsf{fma}\left(-0.5, t\_12, \mathsf{fma}\left(-0.25, t\_2, \mathsf{fma}\left(0.3333333333333333, t\_10, \mathsf{fma}\left(0.4583333333333333, t\_5, \mathsf{fma}\left(0.5, t\_4, t\_11\right)\right)\right)\right)\right)\right) - 0.5 \cdot t\_9}{n}, \frac{-1}{x} + \left(\frac{\mathsf{fma}\left(0.25, t\_9, 0.5 \cdot {x}^{-1}\right)}{x} - \frac{0.3333333333333333 \cdot t\_4}{x}\right)\right)}{n} \end{array} \end{array} \]
(FPCore (x n)
 :precision binary64
 (let* ((t_0 (pow (log x) 2.0))
        (t_1 (pow (log x) 3.0))
        (t_2 (/ (log x) (pow x 4.0)))
        (t_3 (/ t_0 (pow x 4.0)))
        (t_4 (pow (* x x) -1.0))
        (t_5 (pow (pow x 4.0) -1.0))
        (t_6 (/ t_0 (* x x)))
        (t_7 (* (* x x) x))
        (t_8 (/ t_0 t_7))
        (t_9 (pow t_7 -1.0))
        (t_10 (/ (log x) t_7))
        (t_11 (/ (log x) x))
        (t_12 (/ (log x) (* x x))))
   (*
    -1.0
    (/
     (fma
      -1.0
      (/
       (-
        (fma
         -1.0
         (/
          (-
           (fma
            -1.0
            (/
             (fma
              -0.25
              t_2
              (fma
               -0.25
               t_8
               (fma
                -0.08333333333333333
                (/ t_1 (* x x))
                (fma
                 -0.041666666666666664
                 (/ t_1 (pow x 4.0))
                 (fma
                  0.041666666666666664
                  t_5
                  (fma
                   0.05555555555555555
                   (pow t_11 3.0)
                   (+
                    (* 0.16666666666666666 t_10)
                    (fma
                     0.16666666666666666
                     (/ t_1 x)
                     (fma 0.22916666666666666 t_3 (* 0.25 t_6))))))))))
             n)
            (fma
             -0.5
             t_12
             (fma
              -0.5
              (/ t_0 x)
              (+
               (* -0.4583333333333333 t_2)
               (+
                (* -0.16666666666666666 t_8)
                (+
                 (* 0.125 t_3)
                 (fma 0.25 t_5 (fma 0.25 t_6 (* 0.5 t_10)))))))))
           (* 0.16666666666666666 t_9))
          n)
         (fma
          -0.5
          t_12
          (fma
           -0.25
           t_2
           (fma
            0.3333333333333333
            t_10
            (fma 0.4583333333333333 t_5 (fma 0.5 t_4 t_11))))))
        (* 0.5 t_9))
       n)
      (+
       (/ -1.0 x)
       (-
        (/ (fma 0.25 t_9 (* 0.5 (pow x -1.0))) x)
        (/ (* 0.3333333333333333 t_4) x))))
     n))))
double code(double x, double n) {
	double t_0 = pow(log(x), 2.0);
	double t_1 = pow(log(x), 3.0);
	double t_2 = log(x) / pow(x, 4.0);
	double t_3 = t_0 / pow(x, 4.0);
	double t_4 = pow((x * x), -1.0);
	double t_5 = pow(pow(x, 4.0), -1.0);
	double t_6 = t_0 / (x * x);
	double t_7 = (x * x) * x;
	double t_8 = t_0 / t_7;
	double t_9 = pow(t_7, -1.0);
	double t_10 = log(x) / t_7;
	double t_11 = log(x) / x;
	double t_12 = log(x) / (x * x);
	return -1.0 * (fma(-1.0, ((fma(-1.0, ((fma(-1.0, (fma(-0.25, t_2, fma(-0.25, t_8, fma(-0.08333333333333333, (t_1 / (x * x)), fma(-0.041666666666666664, (t_1 / pow(x, 4.0)), fma(0.041666666666666664, t_5, fma(0.05555555555555555, pow(t_11, 3.0), ((0.16666666666666666 * t_10) + fma(0.16666666666666666, (t_1 / x), fma(0.22916666666666666, t_3, (0.25 * t_6)))))))))) / n), fma(-0.5, t_12, fma(-0.5, (t_0 / x), ((-0.4583333333333333 * t_2) + ((-0.16666666666666666 * t_8) + ((0.125 * t_3) + fma(0.25, t_5, fma(0.25, t_6, (0.5 * t_10))))))))) - (0.16666666666666666 * t_9)) / n), fma(-0.5, t_12, fma(-0.25, t_2, fma(0.3333333333333333, t_10, fma(0.4583333333333333, t_5, fma(0.5, t_4, t_11)))))) - (0.5 * t_9)) / n), ((-1.0 / x) + ((fma(0.25, t_9, (0.5 * pow(x, -1.0))) / x) - ((0.3333333333333333 * t_4) / x)))) / n);
}
function code(x, n)
	t_0 = log(x) ^ 2.0
	t_1 = log(x) ^ 3.0
	t_2 = Float64(log(x) / (x ^ 4.0))
	t_3 = Float64(t_0 / (x ^ 4.0))
	t_4 = Float64(x * x) ^ -1.0
	t_5 = (x ^ 4.0) ^ -1.0
	t_6 = Float64(t_0 / Float64(x * x))
	t_7 = Float64(Float64(x * x) * x)
	t_8 = Float64(t_0 / t_7)
	t_9 = t_7 ^ -1.0
	t_10 = Float64(log(x) / t_7)
	t_11 = Float64(log(x) / x)
	t_12 = Float64(log(x) / Float64(x * x))
	return Float64(-1.0 * Float64(fma(-1.0, Float64(Float64(fma(-1.0, Float64(Float64(fma(-1.0, Float64(fma(-0.25, t_2, fma(-0.25, t_8, fma(-0.08333333333333333, Float64(t_1 / Float64(x * x)), fma(-0.041666666666666664, Float64(t_1 / (x ^ 4.0)), fma(0.041666666666666664, t_5, fma(0.05555555555555555, (t_11 ^ 3.0), Float64(Float64(0.16666666666666666 * t_10) + fma(0.16666666666666666, Float64(t_1 / x), fma(0.22916666666666666, t_3, Float64(0.25 * t_6)))))))))) / n), fma(-0.5, t_12, fma(-0.5, Float64(t_0 / x), Float64(Float64(-0.4583333333333333 * t_2) + Float64(Float64(-0.16666666666666666 * t_8) + Float64(Float64(0.125 * t_3) + fma(0.25, t_5, fma(0.25, t_6, Float64(0.5 * t_10))))))))) - Float64(0.16666666666666666 * t_9)) / n), fma(-0.5, t_12, fma(-0.25, t_2, fma(0.3333333333333333, t_10, fma(0.4583333333333333, t_5, fma(0.5, t_4, t_11)))))) - Float64(0.5 * t_9)) / n), Float64(Float64(-1.0 / x) + Float64(Float64(fma(0.25, t_9, Float64(0.5 * (x ^ -1.0))) / x) - Float64(Float64(0.3333333333333333 * t_4) / x)))) / n))
end
code[x_, n_] := Block[{t$95$0 = N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[x], $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Power[N[(x * x), $MachinePrecision], -1.0], $MachinePrecision]}, Block[{t$95$5 = N[Power[N[Power[x, 4.0], $MachinePrecision], -1.0], $MachinePrecision]}, Block[{t$95$6 = N[(t$95$0 / N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$8 = N[(t$95$0 / t$95$7), $MachinePrecision]}, Block[{t$95$9 = N[Power[t$95$7, -1.0], $MachinePrecision]}, Block[{t$95$10 = N[(N[Log[x], $MachinePrecision] / t$95$7), $MachinePrecision]}, Block[{t$95$11 = N[(N[Log[x], $MachinePrecision] / x), $MachinePrecision]}, Block[{t$95$12 = N[(N[Log[x], $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]}, N[(-1.0 * N[(N[(-1.0 * N[(N[(N[(-1.0 * N[(N[(N[(-1.0 * N[(N[(-0.25 * t$95$2 + N[(-0.25 * t$95$8 + N[(-0.08333333333333333 * N[(t$95$1 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(-0.041666666666666664 * N[(t$95$1 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(0.041666666666666664 * t$95$5 + N[(0.05555555555555555 * N[Power[t$95$11, 3.0], $MachinePrecision] + N[(N[(0.16666666666666666 * t$95$10), $MachinePrecision] + N[(0.16666666666666666 * N[(t$95$1 / x), $MachinePrecision] + N[(0.22916666666666666 * t$95$3 + N[(0.25 * t$95$6), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(-0.5 * t$95$12 + N[(-0.5 * N[(t$95$0 / x), $MachinePrecision] + N[(N[(-0.4583333333333333 * t$95$2), $MachinePrecision] + N[(N[(-0.16666666666666666 * t$95$8), $MachinePrecision] + N[(N[(0.125 * t$95$3), $MachinePrecision] + N[(0.25 * t$95$5 + N[(0.25 * t$95$6 + N[(0.5 * t$95$10), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.16666666666666666 * t$95$9), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(-0.5 * t$95$12 + N[(-0.25 * t$95$2 + N[(0.3333333333333333 * t$95$10 + N[(0.4583333333333333 * t$95$5 + N[(0.5 * t$95$4 + t$95$11), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 * t$95$9), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(N[(-1.0 / x), $MachinePrecision] + N[(N[(N[(0.25 * t$95$9 + N[(0.5 * N[Power[x, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - N[(N[(0.3333333333333333 * t$95$4), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\log x}^{2}\\
t_1 := {\log x}^{3}\\
t_2 := \frac{\log x}{{x}^{4}}\\
t_3 := \frac{t\_0}{{x}^{4}}\\
t_4 := {\left(x \cdot x\right)}^{-1}\\
t_5 := {\left({x}^{4}\right)}^{-1}\\
t_6 := \frac{t\_0}{x \cdot x}\\
t_7 := \left(x \cdot x\right) \cdot x\\
t_8 := \frac{t\_0}{t\_7}\\
t_9 := {t\_7}^{-1}\\
t_10 := \frac{\log x}{t\_7}\\
t_11 := \frac{\log x}{x}\\
t_12 := \frac{\log x}{x \cdot x}\\
-1 \cdot \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.25, t\_2, \mathsf{fma}\left(-0.25, t\_8, \mathsf{fma}\left(-0.08333333333333333, \frac{t\_1}{x \cdot x}, \mathsf{fma}\left(-0.041666666666666664, \frac{t\_1}{{x}^{4}}, \mathsf{fma}\left(0.041666666666666664, t\_5, \mathsf{fma}\left(0.05555555555555555, {t\_11}^{3}, 0.16666666666666666 \cdot t\_10 + \mathsf{fma}\left(0.16666666666666666, \frac{t\_1}{x}, \mathsf{fma}\left(0.22916666666666666, t\_3, 0.25 \cdot t\_6\right)\right)\right)\right)\right)\right)\right)\right)}{n}, \mathsf{fma}\left(-0.5, t\_12, \mathsf{fma}\left(-0.5, \frac{t\_0}{x}, -0.4583333333333333 \cdot t\_2 + \left(-0.16666666666666666 \cdot t\_8 + \left(0.125 \cdot t\_3 + \mathsf{fma}\left(0.25, t\_5, \mathsf{fma}\left(0.25, t\_6, 0.5 \cdot t\_10\right)\right)\right)\right)\right)\right)\right) - 0.16666666666666666 \cdot t\_9}{n}, \mathsf{fma}\left(-0.5, t\_12, \mathsf{fma}\left(-0.25, t\_2, \mathsf{fma}\left(0.3333333333333333, t\_10, \mathsf{fma}\left(0.4583333333333333, t\_5, \mathsf{fma}\left(0.5, t\_4, t\_11\right)\right)\right)\right)\right)\right) - 0.5 \cdot t\_9}{n}, \frac{-1}{x} + \left(\frac{\mathsf{fma}\left(0.25, t\_9, 0.5 \cdot {x}^{-1}\right)}{x} - \frac{0.3333333333333333 \cdot t\_4}{x}\right)\right)}{n}
\end{array}
\end{array}
Derivation
  1. Initial program 53.6%

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

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

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-{\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}, x, \left(-n \cdot x\right) \cdot \mathsf{fma}\left({\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}, \frac{{\left(n \cdot n\right)}^{-1} \cdot 0.5}{x} - \frac{0.5 \cdot {n}^{-1}}{x}, \mathsf{fma}\left({\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)}, \frac{\mathsf{fma}\left(0.3333333333333333, {n}^{-1}, {\left(\left(n \cdot n\right) \cdot n\right)}^{-1} \cdot 0.16666666666666666\right) - {\left(n \cdot n\right)}^{-1} \cdot 0.5}{x \cdot x}, {\left(e^{-1}\right)}^{\left(\frac{-1 \cdot \log x}{n}\right)} \cdot \frac{\mathsf{fma}\left(0.4583333333333333, {\left(n \cdot n\right)}^{-1}, {\left({\left(n \cdot n\right)}^{2}\right)}^{-1} \cdot 0.041666666666666664\right) - \mathsf{fma}\left(0.25, {\left(\left(n \cdot n\right) \cdot n\right)}^{-1}, 0.25 \cdot {n}^{-1}\right)}{\left(x \cdot x\right) \cdot x}\right)\right)\right)}{\left(-n \cdot x\right) \cdot x}} \]
  4. Taylor expanded in n around -inf

    \[\leadsto -1 \cdot \color{blue}{\frac{-1 \cdot \frac{\left(-1 \cdot \frac{\left(-1 \cdot \frac{\frac{-1}{4} \cdot \frac{\log x}{{x}^{4}} + \left(\frac{-1}{4} \cdot \frac{{\log x}^{2}}{{x}^{3}} + \left(\frac{-1}{12} \cdot \frac{{\log x}^{3}}{{x}^{2}} + \left(\frac{-1}{24} \cdot \frac{{\log x}^{3}}{{x}^{4}} + \left(\frac{1}{24} \cdot \frac{1}{{x}^{4}} + \left(\frac{1}{18} \cdot \frac{{\log x}^{3}}{{x}^{3}} + \left(\frac{1}{6} \cdot \frac{\log x}{{x}^{3}} + \left(\frac{1}{6} \cdot \frac{{\log x}^{3}}{x} + \left(\frac{11}{48} \cdot \frac{{\log x}^{2}}{{x}^{4}} + \frac{1}{4} \cdot \frac{{\log x}^{2}}{{x}^{2}}\right)\right)\right)\right)\right)\right)\right)\right)}{n} + \left(\frac{-1}{2} \cdot \frac{\log x}{{x}^{2}} + \left(\frac{-1}{2} \cdot \frac{{\log x}^{2}}{x} + \left(\frac{-11}{24} \cdot \frac{\log x}{{x}^{4}} + \left(\frac{-1}{6} \cdot \frac{{\log x}^{2}}{{x}^{3}} + \left(\frac{1}{8} \cdot \frac{{\log x}^{2}}{{x}^{4}} + \left(\frac{1}{4} \cdot \frac{1}{{x}^{4}} + \left(\frac{1}{4} \cdot \frac{{\log x}^{2}}{{x}^{2}} + \frac{1}{2} \cdot \frac{\log x}{{x}^{3}}\right)\right)\right)\right)\right)\right)\right)\right) - \frac{1}{6} \cdot \frac{1}{{x}^{3}}}{n} + \left(\frac{-1}{2} \cdot \frac{\log x}{{x}^{2}} + \left(\frac{-1}{4} \cdot \frac{\log x}{{x}^{4}} + \left(\frac{1}{3} \cdot \frac{\log x}{{x}^{3}} + \left(\frac{11}{24} \cdot \frac{1}{{x}^{4}} + \left(\frac{1}{2} \cdot \frac{1}{{x}^{2}} + \frac{\log x}{x}\right)\right)\right)\right)\right)\right) - \frac{1}{2} \cdot \frac{1}{{x}^{3}}}{n} + \left(\frac{-1}{x} + \frac{\left(\frac{1}{4} \cdot \frac{1}{{x}^{3}} + \frac{1}{2} \cdot \frac{1}{x}\right) - \frac{1}{3} \cdot \frac{1}{{x}^{2}}}{x}\right)}{n}} \]
  5. Applied rewrites30.8%

    \[\leadsto -1 \cdot \color{blue}{\frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.25, \frac{\log x}{{x}^{4}}, \mathsf{fma}\left(-0.25, \frac{{\log x}^{2}}{\left(x \cdot x\right) \cdot x}, \mathsf{fma}\left(-0.08333333333333333, \frac{{\log x}^{3}}{x \cdot x}, \mathsf{fma}\left(-0.041666666666666664, \frac{{\log x}^{3}}{{x}^{4}}, \mathsf{fma}\left(0.041666666666666664, {\left({x}^{4}\right)}^{-1}, \mathsf{fma}\left(0.05555555555555555, {\left(\frac{\log x}{x}\right)}^{3}, 0.16666666666666666 \cdot \frac{\log x}{\left(x \cdot x\right) \cdot x} + \mathsf{fma}\left(0.16666666666666666, \frac{{\log x}^{3}}{x}, \mathsf{fma}\left(0.22916666666666666, \frac{{\log x}^{2}}{{x}^{4}}, 0.25 \cdot \frac{{\log x}^{2}}{x \cdot x}\right)\right)\right)\right)\right)\right)\right)\right)}{n}, \mathsf{fma}\left(-0.5, \frac{\log x}{x \cdot x}, \mathsf{fma}\left(-0.5, \frac{{\log x}^{2}}{x}, -0.4583333333333333 \cdot \frac{\log x}{{x}^{4}} + \left(-0.16666666666666666 \cdot \frac{{\log x}^{2}}{\left(x \cdot x\right) \cdot x} + \left(0.125 \cdot \frac{{\log x}^{2}}{{x}^{4}} + \mathsf{fma}\left(0.25, {\left({x}^{4}\right)}^{-1}, \mathsf{fma}\left(0.25, \frac{{\log x}^{2}}{x \cdot x}, 0.5 \cdot \frac{\log x}{\left(x \cdot x\right) \cdot x}\right)\right)\right)\right)\right)\right)\right) - 0.16666666666666666 \cdot {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}}{n}, \mathsf{fma}\left(-0.5, \frac{\log x}{x \cdot x}, \mathsf{fma}\left(-0.25, \frac{\log x}{{x}^{4}}, \mathsf{fma}\left(0.3333333333333333, \frac{\log x}{\left(x \cdot x\right) \cdot x}, \mathsf{fma}\left(0.4583333333333333, {\left({x}^{4}\right)}^{-1}, \mathsf{fma}\left(0.5, {\left(x \cdot x\right)}^{-1}, \frac{\log x}{x}\right)\right)\right)\right)\right)\right) - 0.5 \cdot {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}}{n}, \frac{-1}{x} + \left(\frac{\mathsf{fma}\left(0.25, {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}, 0.5 \cdot {x}^{-1}\right)}{x} - \frac{0.3333333333333333 \cdot {\left(x \cdot x\right)}^{-1}}{x}\right)\right)}{n}} \]
  6. Add Preprocessing

Reproduce

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