Average Error: 32.4 → 22.8
Time: 11.3s
Precision: binary64
\[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
\[\begin{array}{l} \mathbf{if}\;n \leq -32.48759670317301:\\ \;\;\;\;\frac{\frac{1}{x}}{n}\\ \mathbf{elif}\;n \leq 7243570702.27218:\\ \;\;\;\;\sqrt[3]{{\left({\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {\left({x}^{\left(\frac{1}{\sqrt[3]{n} \cdot \sqrt[3]{n}}\right)}\right)}^{\left(\frac{1}{\sqrt[3]{n}}\right)}\right)}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{n} \cdot \frac{1}{x}\\ \end{array}\]
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\begin{array}{l}
\mathbf{if}\;n \leq -32.48759670317301:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\

\mathbf{elif}\;n \leq 7243570702.27218:\\
\;\;\;\;\sqrt[3]{{\left({\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {\left({x}^{\left(\frac{1}{\sqrt[3]{n} \cdot \sqrt[3]{n}}\right)}\right)}^{\left(\frac{1}{\sqrt[3]{n}}\right)}\right)}^{3}}\\

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

\end{array}
(FPCore (x n)
 :precision binary64
 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
(FPCore (x n)
 :precision binary64
 (if (<= n -32.48759670317301)
   (/ (/ 1.0 x) n)
   (if (<= n 7243570702.27218)
     (cbrt
      (pow
       (-
        (pow (+ 1.0 x) (/ 1.0 n))
        (pow (pow x (/ 1.0 (* (cbrt n) (cbrt n)))) (/ 1.0 (cbrt n))))
       3.0))
     (* (/ 1.0 n) (/ 1.0 x)))))
double code(double x, double n) {
	return ((double) (((double) pow(((double) (x + 1.0)), (1.0 / n))) - ((double) pow(x, (1.0 / n)))));
}
double code(double x, double n) {
	double tmp;
	if ((n <= -32.48759670317301)) {
		tmp = ((1.0 / x) / n);
	} else {
		double tmp_1;
		if ((n <= 7243570702.27218)) {
			tmp_1 = ((double) cbrt(((double) pow(((double) (((double) pow(((double) (1.0 + x)), (1.0 / n))) - ((double) pow(((double) pow(x, (1.0 / ((double) (((double) cbrt(n)) * ((double) cbrt(n))))))), (1.0 / ((double) cbrt(n))))))), 3.0))));
		} else {
			tmp_1 = ((double) ((1.0 / n) * (1.0 / x)));
		}
		tmp = tmp_1;
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus n

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if n < -32.487596703173011

    1. Initial program Error: 44.4 bits

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
    2. Using strategy rm
    3. Applied add-cube-cbrtError: 44.4 bits

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{\color{blue}{\left(\sqrt[3]{n} \cdot \sqrt[3]{n}\right) \cdot \sqrt[3]{n}}}\right)}\]
    4. Applied *-un-lft-identityError: 44.4 bits

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{\color{blue}{1 \cdot 1}}{\left(\sqrt[3]{n} \cdot \sqrt[3]{n}\right) \cdot \sqrt[3]{n}}\right)}\]
    5. Applied times-fracError: 44.4 bits

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\color{blue}{\left(\frac{1}{\sqrt[3]{n} \cdot \sqrt[3]{n}} \cdot \frac{1}{\sqrt[3]{n}}\right)}}\]
    6. Applied pow-unpowError: 44.4 bits

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \color{blue}{{\left({x}^{\left(\frac{1}{\sqrt[3]{n} \cdot \sqrt[3]{n}}\right)}\right)}^{\left(\frac{1}{\sqrt[3]{n}}\right)}}\]
    7. Taylor expanded around -inf Error: 64.0 bits

      \[\leadsto \color{blue}{\left(1 \cdot \frac{\log -1 \cdot \log \left(\frac{-1}{x}\right)}{{n}^{2}} + \left(1 \cdot \frac{\log \left(-1\right)}{n} + \left(1 \cdot \frac{1}{x \cdot n} + 0.5 \cdot \frac{{\left(\log \left(-1\right)\right)}^{2}}{{n}^{2}}\right)\right)\right) - \left(1 \cdot \frac{\log -1}{n} + \left(0.5 \cdot \frac{{\left(\log -1\right)}^{2}}{{n}^{2}} + 1 \cdot \frac{\log \left(-1\right) \cdot \log \left(\frac{-1}{x}\right)}{{n}^{2}}\right)\right)}\]
    8. SimplifiedError: 31.3 bits

      \[\leadsto \color{blue}{\frac{1}{x \cdot n}}\]
    9. Using strategy rm
    10. Applied associate-/r*Error: 30.7 bits

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

    if -32.487596703173011 < n < 7243570702.2721796

    1. Initial program Error: 2.6 bits

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
    2. Using strategy rm
    3. Applied add-cube-cbrtError: 2.6 bits

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{\color{blue}{\left(\sqrt[3]{n} \cdot \sqrt[3]{n}\right) \cdot \sqrt[3]{n}}}\right)}\]
    4. Applied *-un-lft-identityError: 2.6 bits

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{\color{blue}{1 \cdot 1}}{\left(\sqrt[3]{n} \cdot \sqrt[3]{n}\right) \cdot \sqrt[3]{n}}\right)}\]
    5. Applied times-fracError: 2.6 bits

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\color{blue}{\left(\frac{1}{\sqrt[3]{n} \cdot \sqrt[3]{n}} \cdot \frac{1}{\sqrt[3]{n}}\right)}}\]
    6. Applied pow-unpowError: 2.6 bits

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \color{blue}{{\left({x}^{\left(\frac{1}{\sqrt[3]{n} \cdot \sqrt[3]{n}}\right)}\right)}^{\left(\frac{1}{\sqrt[3]{n}}\right)}}\]
    7. Using strategy rm
    8. Applied add-cbrt-cubeError: 2.7 bits

      \[\leadsto \color{blue}{\sqrt[3]{\left(\left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {\left({x}^{\left(\frac{1}{\sqrt[3]{n} \cdot \sqrt[3]{n}}\right)}\right)}^{\left(\frac{1}{\sqrt[3]{n}}\right)}\right) \cdot \left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {\left({x}^{\left(\frac{1}{\sqrt[3]{n} \cdot \sqrt[3]{n}}\right)}\right)}^{\left(\frac{1}{\sqrt[3]{n}}\right)}\right)\right) \cdot \left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {\left({x}^{\left(\frac{1}{\sqrt[3]{n} \cdot \sqrt[3]{n}}\right)}\right)}^{\left(\frac{1}{\sqrt[3]{n}}\right)}\right)}}\]
    9. SimplifiedError: 2.7 bits

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

    if 7243570702.2721796 < n

    1. Initial program Error: 44.6 bits

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
    2. Using strategy rm
    3. Applied add-cube-cbrtError: 44.6 bits

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{\color{blue}{\left(\sqrt[3]{n} \cdot \sqrt[3]{n}\right) \cdot \sqrt[3]{n}}}\right)}\]
    4. Applied *-un-lft-identityError: 44.6 bits

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{\color{blue}{1 \cdot 1}}{\left(\sqrt[3]{n} \cdot \sqrt[3]{n}\right) \cdot \sqrt[3]{n}}\right)}\]
    5. Applied times-fracError: 44.6 bits

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\color{blue}{\left(\frac{1}{\sqrt[3]{n} \cdot \sqrt[3]{n}} \cdot \frac{1}{\sqrt[3]{n}}\right)}}\]
    6. Applied pow-unpowError: 44.6 bits

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \color{blue}{{\left({x}^{\left(\frac{1}{\sqrt[3]{n} \cdot \sqrt[3]{n}}\right)}\right)}^{\left(\frac{1}{\sqrt[3]{n}}\right)}}\]
    7. Taylor expanded around -inf Error: 64.0 bits

      \[\leadsto \color{blue}{\left(1 \cdot \frac{\log -1 \cdot \log \left(\frac{-1}{x}\right)}{{n}^{2}} + \left(1 \cdot \frac{\log \left(-1\right)}{n} + \left(1 \cdot \frac{1}{x \cdot n} + 0.5 \cdot \frac{{\left(\log \left(-1\right)\right)}^{2}}{{n}^{2}}\right)\right)\right) - \left(1 \cdot \frac{\log -1}{n} + \left(0.5 \cdot \frac{{\left(\log -1\right)}^{2}}{{n}^{2}} + 1 \cdot \frac{\log \left(-1\right) \cdot \log \left(\frac{-1}{x}\right)}{{n}^{2}}\right)\right)}\]
    8. SimplifiedError: 31.8 bits

      \[\leadsto \color{blue}{\frac{1}{x \cdot n}}\]
    9. Using strategy rm
    10. Applied *-un-lft-identityError: 31.8 bits

      \[\leadsto \frac{\color{blue}{1 \cdot 1}}{x \cdot n}\]
    11. Applied times-fracError: 31.2 bits

      \[\leadsto \color{blue}{\frac{1}{x} \cdot \frac{1}{n}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplificationError: 22.8 bits

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -32.48759670317301:\\ \;\;\;\;\frac{\frac{1}{x}}{n}\\ \mathbf{elif}\;n \leq 7243570702.27218:\\ \;\;\;\;\sqrt[3]{{\left({\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {\left({x}^{\left(\frac{1}{\sqrt[3]{n} \cdot \sqrt[3]{n}}\right)}\right)}^{\left(\frac{1}{\sqrt[3]{n}}\right)}\right)}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{n} \cdot \frac{1}{x}\\ \end{array}\]

Reproduce

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