Average Error: 32.4 → 23.2
Time: 10.6s
Precision: binary64
\[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
\[\begin{array}{l} \mathbf{if}\;n \leq -116924.1052241744:\\ \;\;\;\;\frac{\frac{1}{x}}{n} \cdot \left(1 + \frac{\log x}{n}\right) - \frac{0.5}{\log \left(e^{x \cdot \left(n \cdot x\right)}\right)}\\ \mathbf{elif}\;n \leq 35146050.636312656:\\ \;\;\;\;{\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)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x} \cdot \left(\frac{1}{n} + \frac{\log x}{n \cdot n}\right) - \frac{0.5}{\log \left(e^{x \cdot \left(n \cdot x\right)}\right)}\\ \end{array}\]
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\begin{array}{l}
\mathbf{if}\;n \leq -116924.1052241744:\\
\;\;\;\;\frac{\frac{1}{x}}{n} \cdot \left(1 + \frac{\log x}{n}\right) - \frac{0.5}{\log \left(e^{x \cdot \left(n \cdot x\right)}\right)}\\

\mathbf{elif}\;n \leq 35146050.636312656:\\
\;\;\;\;{\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)}\\

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

\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 -116924.1052241744)
   (-
    (* (/ (/ 1.0 x) n) (+ 1.0 (/ (log x) n)))
    (/ 0.5 (log (exp (* x (* n x))))))
   (if (<= n 35146050.636312656)
     (-
      (pow (+ 1.0 x) (/ 1.0 n))
      (pow (pow x (/ 1.0 (* (cbrt n) (cbrt n)))) (/ 1.0 (cbrt n))))
     (-
      (* (/ 1.0 x) (+ (/ 1.0 n) (/ (log x) (* n n))))
      (/ 0.5 (log (exp (* x (* n 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 <= -116924.1052241744)) {
		tmp = ((double) (((double) (((1.0 / x) / n) * ((double) (1.0 + (((double) log(x)) / n))))) - (0.5 / ((double) log(((double) exp(((double) (x * ((double) (n * x)))))))))));
	} else {
		double tmp_1;
		if ((n <= 35146050.636312656)) {
			tmp_1 = ((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)))))));
		} else {
			tmp_1 = ((double) (((double) ((1.0 / x) * ((double) ((1.0 / n) + (((double) log(x)) / ((double) (n * n))))))) - (0.5 / ((double) log(((double) exp(((double) (x * ((double) (n * 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 < -116924.105224174404

    1. Initial program 44.6

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

      \[\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-identity_binary6444.6

      \[\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-frac_binary6444.6

      \[\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-unpow_binary6444.6

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

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

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

      \[\leadsto \color{blue}{\left(1 \cdot \frac{1}{x \cdot n} + 1 \cdot \frac{\log x}{x \cdot {n}^{2}}\right)} - \frac{0.5}{x \cdot \left(x \cdot n\right)}\]
    10. Simplified30.9

      \[\leadsto \color{blue}{\frac{\frac{1}{x}}{n} \cdot \left(1 + \frac{\log x}{n}\right)} - \frac{0.5}{x \cdot \left(x \cdot n\right)}\]
    11. Using strategy rm
    12. Applied add-log-exp_binary6431.1

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

    if -116924.105224174404 < n < 35146050.6363126561

    1. Initial program 2.5

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

      \[\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-identity_binary642.6

      \[\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-frac_binary642.6

      \[\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-unpow_binary642.6

      \[\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)}}\]

    if 35146050.6363126561 < n

    1. Initial program 44.6

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

      \[\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-identity_binary6444.6

      \[\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-frac_binary6444.6

      \[\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-unpow_binary6444.6

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

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

      \[\leadsto \color{blue}{\frac{1}{x} \cdot \left(\frac{1}{n} + \frac{\log x}{n \cdot n}\right) - \frac{0.5}{x \cdot \left(x \cdot n\right)}}\]
    9. Using strategy rm
    10. Applied add-log-exp_binary6432.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -116924.1052241744:\\ \;\;\;\;\frac{\frac{1}{x}}{n} \cdot \left(1 + \frac{\log x}{n}\right) - \frac{0.5}{\log \left(e^{x \cdot \left(n \cdot x\right)}\right)}\\ \mathbf{elif}\;n \leq 35146050.636312656:\\ \;\;\;\;{\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)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x} \cdot \left(\frac{1}{n} + \frac{\log x}{n \cdot n}\right) - \frac{0.5}{\log \left(e^{x \cdot \left(n \cdot x\right)}\right)}\\ \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))))