2nthrt (problem 3.4.6)

Percentage Accurate: 52.5% → 84.7%
Time: 25.7s
Alternatives: 17
Speedup: 5.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 17 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: 52.5% accurate, 1.0× speedup?

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

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

Alternative 1: 84.7% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 76.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{e^{\frac{\color{blue}{1} \cdot \log x}{n}}}{n \cdot x} \]
      7. *-commutativeN/A

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

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

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

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

        \[\leadsto \frac{{x}^{\color{blue}{\left(\frac{1}{n}\right)}}}{n \cdot x} \]
      12. *-commutativeN/A

        \[\leadsto \frac{{x}^{\left(\frac{1}{n}\right)}}{\color{blue}{x \cdot n}} \]
      13. lower-*.f6488.2

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

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

    if -9.99999999999999927e-105 < (/.f64 #s(literal 1 binary64) n) < 4

    1. Initial program 32.5%

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}{n} \]
      4. lower-log.f6486.6

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

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

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

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

      1. Initial program 56.2%

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 2: 77.0% accurate, 0.4× speedup?

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

      1. Initial program 99.6%

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

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

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

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

        1. Initial program 42.5%

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

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

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

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

            \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}{n} \]
          4. lower-log.f6479.9

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

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

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

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

          1. Initial program 54.5%

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

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

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

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

              \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(x\right)} - \log x}{n} \]
            4. lower-log.f649.7

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

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

            \[\leadsto -1 \cdot \color{blue}{\frac{-1 \cdot \frac{\frac{1}{3} \cdot \frac{1}{n \cdot x} - \frac{1}{2} \cdot \frac{1}{n}}{x} - \frac{1}{n}}{x}} \]
          7. Step-by-step derivation
            1. Applied rewrites37.4%

              \[\leadsto \frac{\frac{\frac{0.3333333333333333}{x \cdot n} + \frac{-0.5}{n}}{-x} + \frac{-1}{n}}{\color{blue}{-x}} \]
            2. Step-by-step derivation
              1. Applied rewrites41.7%

                \[\leadsto \frac{\frac{\mathsf{fma}\left(x, n \cdot -0.5, n \cdot 0.3333333333333333\right)}{\left(-x\right) \cdot \left(x \cdot \left(n \cdot n\right)\right)} + \frac{-1}{n}}{-x} \]
            3. Recombined 3 regimes into one program.
            4. Final simplification77.0%

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

            Reproduce

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