Average Error: 29.3 → 22.1
Time: 24.2s
Precision: 64
\[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
\[\begin{array}{l} \mathbf{if}\;n \le -9979728547.756907:\\ \;\;\;\;\left(\frac{1}{x \cdot n} + \frac{1}{x \cdot n} \cdot \frac{\log x}{n}\right) - \frac{\frac{1}{2}}{\log \left(e^{\left(x \cdot x\right) \cdot n}\right)}\\ \mathbf{elif}\;n \le 1688833050023.4038:\\ \;\;\;\;{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{\frac{1}{n}}{2}\right)} \cdot {x}^{\left(\frac{\frac{1}{n}}{2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{1}{x \cdot n} \cdot \frac{\log x}{n} + \frac{1}{x} \cdot \frac{1}{n}} \cdot \left(\sqrt[3]{\frac{1}{x \cdot n} \cdot \frac{\log x}{n} + \frac{1}{x} \cdot \frac{1}{n}} \cdot \sqrt[3]{\frac{1}{x \cdot n} \cdot \frac{\log x}{n} + \frac{1}{x} \cdot \frac{1}{n}}\right) - \frac{\frac{1}{2}}{\left(x \cdot x\right) \cdot n}\\ \end{array}\]
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\begin{array}{l}
\mathbf{if}\;n \le -9979728547.756907:\\
\;\;\;\;\left(\frac{1}{x \cdot n} + \frac{1}{x \cdot n} \cdot \frac{\log x}{n}\right) - \frac{\frac{1}{2}}{\log \left(e^{\left(x \cdot x\right) \cdot n}\right)}\\

\mathbf{elif}\;n \le 1688833050023.4038:\\
\;\;\;\;{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{\frac{1}{n}}{2}\right)} \cdot {x}^{\left(\frac{\frac{1}{n}}{2}\right)}\\

\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\frac{1}{x \cdot n} \cdot \frac{\log x}{n} + \frac{1}{x} \cdot \frac{1}{n}} \cdot \left(\sqrt[3]{\frac{1}{x \cdot n} \cdot \frac{\log x}{n} + \frac{1}{x} \cdot \frac{1}{n}} \cdot \sqrt[3]{\frac{1}{x \cdot n} \cdot \frac{\log x}{n} + \frac{1}{x} \cdot \frac{1}{n}}\right) - \frac{\frac{1}{2}}{\left(x \cdot x\right) \cdot n}\\

\end{array}
double f(double x, double n) {
        double r508839 = x;
        double r508840 = 1.0;
        double r508841 = r508839 + r508840;
        double r508842 = n;
        double r508843 = r508840 / r508842;
        double r508844 = pow(r508841, r508843);
        double r508845 = pow(r508839, r508843);
        double r508846 = r508844 - r508845;
        return r508846;
}

double f(double x, double n) {
        double r508847 = n;
        double r508848 = -9979728547.756907;
        bool r508849 = r508847 <= r508848;
        double r508850 = 1.0;
        double r508851 = x;
        double r508852 = r508851 * r508847;
        double r508853 = r508850 / r508852;
        double r508854 = log(r508851);
        double r508855 = r508854 / r508847;
        double r508856 = r508853 * r508855;
        double r508857 = r508853 + r508856;
        double r508858 = 0.5;
        double r508859 = r508851 * r508851;
        double r508860 = r508859 * r508847;
        double r508861 = exp(r508860);
        double r508862 = log(r508861);
        double r508863 = r508858 / r508862;
        double r508864 = r508857 - r508863;
        double r508865 = 1688833050023.4038;
        bool r508866 = r508847 <= r508865;
        double r508867 = r508850 + r508851;
        double r508868 = r508850 / r508847;
        double r508869 = pow(r508867, r508868);
        double r508870 = 2.0;
        double r508871 = r508868 / r508870;
        double r508872 = pow(r508851, r508871);
        double r508873 = r508872 * r508872;
        double r508874 = r508869 - r508873;
        double r508875 = r508850 / r508851;
        double r508876 = r508875 * r508868;
        double r508877 = r508856 + r508876;
        double r508878 = cbrt(r508877);
        double r508879 = r508878 * r508878;
        double r508880 = r508878 * r508879;
        double r508881 = r508858 / r508860;
        double r508882 = r508880 - r508881;
        double r508883 = r508866 ? r508874 : r508882;
        double r508884 = r508849 ? r508864 : r508883;
        return r508884;
}

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 < -9979728547.756907

    1. Initial program 45.5

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{n \cdot x} + \frac{\log x}{n} \cdot \frac{1}{n \cdot x}\right) - \frac{\frac{1}{2}}{\left(x \cdot x\right) \cdot n}}\]
    4. Using strategy rm
    5. Applied add-log-exp33.4

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

    if -9979728547.756907 < n < 1688833050023.4038

    1. Initial program 8.8

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
    2. Using strategy rm
    3. Applied sqr-pow8.9

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

    if 1688833050023.4038 < n

    1. Initial program 45.3

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{n \cdot x} + \frac{\log x}{n} \cdot \frac{1}{n \cdot x}\right) - \frac{\frac{1}{2}}{\left(x \cdot x\right) \cdot n}}\]
    4. Using strategy rm
    5. Applied add-cube-cbrt31.9

      \[\leadsto \left(\frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{n \cdot x} + \frac{\log x}{n} \cdot \frac{1}{n \cdot x}\right) - \frac{\frac{1}{2}}{\left(x \cdot x\right) \cdot n}\]
    6. Applied times-frac31.3

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \le -9979728547.756907:\\ \;\;\;\;\left(\frac{1}{x \cdot n} + \frac{1}{x \cdot n} \cdot \frac{\log x}{n}\right) - \frac{\frac{1}{2}}{\log \left(e^{\left(x \cdot x\right) \cdot n}\right)}\\ \mathbf{elif}\;n \le 1688833050023.4038:\\ \;\;\;\;{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{\frac{1}{n}}{2}\right)} \cdot {x}^{\left(\frac{\frac{1}{n}}{2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{1}{x \cdot n} \cdot \frac{\log x}{n} + \frac{1}{x} \cdot \frac{1}{n}} \cdot \left(\sqrt[3]{\frac{1}{x \cdot n} \cdot \frac{\log x}{n} + \frac{1}{x} \cdot \frac{1}{n}} \cdot \sqrt[3]{\frac{1}{x \cdot n} \cdot \frac{\log x}{n} + \frac{1}{x} \cdot \frac{1}{n}}\right) - \frac{\frac{1}{2}}{\left(x \cdot x\right) \cdot n}\\ \end{array}\]

Reproduce

herbie shell --seed 2019154 
(FPCore (x n)
  :name "2nthrt (problem 3.4.6)"
  (- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n))))