Average Error: 29.1 → 22.3
Time: 9.8s
Precision: 64
\[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
\[\begin{array}{l} \mathbf{if}\;n \le -235.54342409600352:\\ \;\;\;\;\frac{\frac{1}{n}}{x} - \left(\log \left(e^{\frac{0.5}{{x}^{2} \cdot n}}\right) - \frac{\log x \cdot 1}{e^{\log \left(x \cdot {n}^{2}\right)}}\right)\\ \mathbf{elif}\;n \le 0.2317853494525819:\\ \;\;\;\;{\left(x + 1\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}:\\ \;\;\;\;\frac{\frac{1}{n}}{x} - \left(\frac{\frac{0.5}{n}}{{x}^{2}} - \frac{\log x \cdot 1}{e^{\left(\sqrt[3]{\log \left(x \cdot {n}^{2}\right)} \cdot \sqrt[3]{\log \left(x \cdot {n}^{2}\right)}\right) \cdot \sqrt[3]{\log \left(x \cdot {n}^{2}\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 \le -235.54342409600352:\\
\;\;\;\;\frac{\frac{1}{n}}{x} - \left(\log \left(e^{\frac{0.5}{{x}^{2} \cdot n}}\right) - \frac{\log x \cdot 1}{e^{\log \left(x \cdot {n}^{2}\right)}}\right)\\

\mathbf{elif}\;n \le 0.2317853494525819:\\
\;\;\;\;{\left(x + 1\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}:\\
\;\;\;\;\frac{\frac{1}{n}}{x} - \left(\frac{\frac{0.5}{n}}{{x}^{2}} - \frac{\log x \cdot 1}{e^{\left(\sqrt[3]{\log \left(x \cdot {n}^{2}\right)} \cdot \sqrt[3]{\log \left(x \cdot {n}^{2}\right)}\right) \cdot \sqrt[3]{\log \left(x \cdot {n}^{2}\right)}}}\right)\\

\end{array}
double f(double x, double n) {
        double r39784 = x;
        double r39785 = 1.0;
        double r39786 = r39784 + r39785;
        double r39787 = n;
        double r39788 = r39785 / r39787;
        double r39789 = pow(r39786, r39788);
        double r39790 = pow(r39784, r39788);
        double r39791 = r39789 - r39790;
        return r39791;
}

double f(double x, double n) {
        double r39792 = n;
        double r39793 = -235.54342409600352;
        bool r39794 = r39792 <= r39793;
        double r39795 = 1.0;
        double r39796 = r39795 / r39792;
        double r39797 = x;
        double r39798 = r39796 / r39797;
        double r39799 = 0.5;
        double r39800 = 2.0;
        double r39801 = pow(r39797, r39800);
        double r39802 = r39801 * r39792;
        double r39803 = r39799 / r39802;
        double r39804 = exp(r39803);
        double r39805 = log(r39804);
        double r39806 = log(r39797);
        double r39807 = r39806 * r39795;
        double r39808 = pow(r39792, r39800);
        double r39809 = r39797 * r39808;
        double r39810 = log(r39809);
        double r39811 = exp(r39810);
        double r39812 = r39807 / r39811;
        double r39813 = r39805 - r39812;
        double r39814 = r39798 - r39813;
        double r39815 = 0.2317853494525819;
        bool r39816 = r39792 <= r39815;
        double r39817 = r39797 + r39795;
        double r39818 = pow(r39817, r39796);
        double r39819 = r39796 / r39800;
        double r39820 = pow(r39797, r39819);
        double r39821 = r39820 * r39820;
        double r39822 = r39818 - r39821;
        double r39823 = r39799 / r39792;
        double r39824 = r39823 / r39801;
        double r39825 = cbrt(r39810);
        double r39826 = r39825 * r39825;
        double r39827 = r39826 * r39825;
        double r39828 = exp(r39827);
        double r39829 = r39807 / r39828;
        double r39830 = r39824 - r39829;
        double r39831 = r39798 - r39830;
        double r39832 = r39816 ? r39822 : r39831;
        double r39833 = r39794 ? r39814 : r39832;
        return r39833;
}

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

    1. Initial program 44.7

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

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

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

      \[\leadsto \frac{\frac{1}{n}}{x} - \left(\frac{\frac{0.5}{n}}{{x}^{2}} - \frac{\log x \cdot 1}{x \cdot {\color{blue}{\left(e^{\log n}\right)}}^{2}}\right)\]
    6. Applied pow-exp64.0

      \[\leadsto \frac{\frac{1}{n}}{x} - \left(\frac{\frac{0.5}{n}}{{x}^{2}} - \frac{\log x \cdot 1}{x \cdot \color{blue}{e^{\log n \cdot 2}}}\right)\]
    7. Applied add-exp-log64.0

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

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

      \[\leadsto \frac{\frac{1}{n}}{x} - \left(\frac{\frac{0.5}{n}}{{x}^{2}} - \frac{\log x \cdot 1}{e^{\color{blue}{\log \left(x \cdot {n}^{2}\right)}}}\right)\]
    10. Using strategy rm
    11. Applied add-log-exp32.8

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

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

    if -235.54342409600352 < n < 0.2317853494525819

    1. Initial program 7.6

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

      \[\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 0.2317853494525819 < n

    1. Initial program 44.2

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

      \[\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)}\]
    3. Simplified32.8

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

      \[\leadsto \frac{\frac{1}{n}}{x} - \left(\frac{\frac{0.5}{n}}{{x}^{2}} - \frac{\log x \cdot 1}{x \cdot {\color{blue}{\left(e^{\log n}\right)}}^{2}}\right)\]
    6. Applied pow-exp32.8

      \[\leadsto \frac{\frac{1}{n}}{x} - \left(\frac{\frac{0.5}{n}}{{x}^{2}} - \frac{\log x \cdot 1}{x \cdot \color{blue}{e^{\log n \cdot 2}}}\right)\]
    7. Applied add-exp-log32.8

      \[\leadsto \frac{\frac{1}{n}}{x} - \left(\frac{\frac{0.5}{n}}{{x}^{2}} - \frac{\log x \cdot 1}{\color{blue}{e^{\log x}} \cdot e^{\log n \cdot 2}}\right)\]
    8. Applied prod-exp32.8

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

      \[\leadsto \frac{\frac{1}{n}}{x} - \left(\frac{\frac{0.5}{n}}{{x}^{2}} - \frac{\log x \cdot 1}{e^{\color{blue}{\log \left(x \cdot {n}^{2}\right)}}}\right)\]
    10. Using strategy rm
    11. Applied add-cube-cbrt32.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \le -235.54342409600352:\\ \;\;\;\;\frac{\frac{1}{n}}{x} - \left(\log \left(e^{\frac{0.5}{{x}^{2} \cdot n}}\right) - \frac{\log x \cdot 1}{e^{\log \left(x \cdot {n}^{2}\right)}}\right)\\ \mathbf{elif}\;n \le 0.2317853494525819:\\ \;\;\;\;{\left(x + 1\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}:\\ \;\;\;\;\frac{\frac{1}{n}}{x} - \left(\frac{\frac{0.5}{n}}{{x}^{2}} - \frac{\log x \cdot 1}{e^{\left(\sqrt[3]{\log \left(x \cdot {n}^{2}\right)} \cdot \sqrt[3]{\log \left(x \cdot {n}^{2}\right)}\right) \cdot \sqrt[3]{\log \left(x \cdot {n}^{2}\right)}}}\right)\\ \end{array}\]

Reproduce

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