Average Error: 29.1 → 0.1
Time: 5.2s
Precision: 64
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -11437.80933531395021418575197458267211914 \lor \neg \left(x \le 7255.026949556487124937120825052261352539\right):\\ \;\;\;\;\left(\frac{-1}{{x}^{2}} - \frac{3}{x}\right) - \frac{3}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log \left(e^{\left(0 - \frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}\right) + {\left(\sqrt[3]{\frac{x}{x + 1}}\right)}^{6}}\right)}{\left(\sqrt[3]{\frac{x}{x + 1}} \cdot \sqrt[3]{\frac{x}{x + 1}}\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{\frac{1}{x + 1}}\right) + \frac{x + 1}{x - 1}}\\ \end{array}\]
\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\begin{array}{l}
\mathbf{if}\;x \le -11437.80933531395021418575197458267211914 \lor \neg \left(x \le 7255.026949556487124937120825052261352539\right):\\
\;\;\;\;\left(\frac{-1}{{x}^{2}} - \frac{3}{x}\right) - \frac{3}{{x}^{3}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\log \left(e^{\left(0 - \frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}\right) + {\left(\sqrt[3]{\frac{x}{x + 1}}\right)}^{6}}\right)}{\left(\sqrt[3]{\frac{x}{x + 1}} \cdot \sqrt[3]{\frac{x}{x + 1}}\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{\frac{1}{x + 1}}\right) + \frac{x + 1}{x - 1}}\\

\end{array}
double f(double x) {
        double r154796 = x;
        double r154797 = 1.0;
        double r154798 = r154796 + r154797;
        double r154799 = r154796 / r154798;
        double r154800 = r154796 - r154797;
        double r154801 = r154798 / r154800;
        double r154802 = r154799 - r154801;
        return r154802;
}

double f(double x) {
        double r154803 = x;
        double r154804 = -11437.80933531395;
        bool r154805 = r154803 <= r154804;
        double r154806 = 7255.026949556487;
        bool r154807 = r154803 <= r154806;
        double r154808 = !r154807;
        bool r154809 = r154805 || r154808;
        double r154810 = 1.0;
        double r154811 = -r154810;
        double r154812 = 2.0;
        double r154813 = pow(r154803, r154812);
        double r154814 = r154811 / r154813;
        double r154815 = 3.0;
        double r154816 = r154815 / r154803;
        double r154817 = r154814 - r154816;
        double r154818 = 3.0;
        double r154819 = pow(r154803, r154818);
        double r154820 = r154815 / r154819;
        double r154821 = r154817 - r154820;
        double r154822 = 0.0;
        double r154823 = r154803 + r154810;
        double r154824 = r154803 - r154810;
        double r154825 = r154823 / r154824;
        double r154826 = r154825 * r154825;
        double r154827 = r154822 - r154826;
        double r154828 = r154803 / r154823;
        double r154829 = cbrt(r154828);
        double r154830 = 6.0;
        double r154831 = pow(r154829, r154830);
        double r154832 = r154827 + r154831;
        double r154833 = exp(r154832);
        double r154834 = log(r154833);
        double r154835 = r154829 * r154829;
        double r154836 = cbrt(r154803);
        double r154837 = 1.0;
        double r154838 = r154837 / r154823;
        double r154839 = cbrt(r154838);
        double r154840 = r154836 * r154839;
        double r154841 = r154835 * r154840;
        double r154842 = r154841 + r154825;
        double r154843 = r154834 / r154842;
        double r154844 = r154809 ? r154821 : r154843;
        return r154844;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < -11437.80933531395 or 7255.026949556487 < x

    1. Initial program 59.1

      \[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
    2. Taylor expanded around inf 0.3

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

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

    if -11437.80933531395 < x < 7255.026949556487

    1. Initial program 0.1

      \[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt0.1

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{x}{x + 1}} \cdot \sqrt[3]{\frac{x}{x + 1}}\right) \cdot \sqrt[3]{\frac{x}{x + 1}}} - \frac{x + 1}{x - 1}\]
    4. Using strategy rm
    5. Applied flip--0.1

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

      \[\leadsto \frac{\color{blue}{\left(-\frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}\right) + {\left(\sqrt[3]{\frac{x}{x + 1}} \cdot \sqrt[3]{\frac{x}{x + 1}}\right)}^{3}}}{\left(\sqrt[3]{\frac{x}{x + 1}} \cdot \sqrt[3]{\frac{x}{x + 1}}\right) \cdot \sqrt[3]{\frac{x}{x + 1}} + \frac{x + 1}{x - 1}}\]
    7. Using strategy rm
    8. Applied add-log-exp0.1

      \[\leadsto \frac{\left(-\frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}\right) + \color{blue}{\log \left(e^{{\left(\sqrt[3]{\frac{x}{x + 1}} \cdot \sqrt[3]{\frac{x}{x + 1}}\right)}^{3}}\right)}}{\left(\sqrt[3]{\frac{x}{x + 1}} \cdot \sqrt[3]{\frac{x}{x + 1}}\right) \cdot \sqrt[3]{\frac{x}{x + 1}} + \frac{x + 1}{x - 1}}\]
    9. Applied add-log-exp0.1

      \[\leadsto \frac{\left(-\color{blue}{\log \left(e^{\frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}}\right)}\right) + \log \left(e^{{\left(\sqrt[3]{\frac{x}{x + 1}} \cdot \sqrt[3]{\frac{x}{x + 1}}\right)}^{3}}\right)}{\left(\sqrt[3]{\frac{x}{x + 1}} \cdot \sqrt[3]{\frac{x}{x + 1}}\right) \cdot \sqrt[3]{\frac{x}{x + 1}} + \frac{x + 1}{x - 1}}\]
    10. Applied neg-log0.1

      \[\leadsto \frac{\color{blue}{\log \left(\frac{1}{e^{\frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}}}\right)} + \log \left(e^{{\left(\sqrt[3]{\frac{x}{x + 1}} \cdot \sqrt[3]{\frac{x}{x + 1}}\right)}^{3}}\right)}{\left(\sqrt[3]{\frac{x}{x + 1}} \cdot \sqrt[3]{\frac{x}{x + 1}}\right) \cdot \sqrt[3]{\frac{x}{x + 1}} + \frac{x + 1}{x - 1}}\]
    11. Applied sum-log0.1

      \[\leadsto \frac{\color{blue}{\log \left(\frac{1}{e^{\frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}}} \cdot e^{{\left(\sqrt[3]{\frac{x}{x + 1}} \cdot \sqrt[3]{\frac{x}{x + 1}}\right)}^{3}}\right)}}{\left(\sqrt[3]{\frac{x}{x + 1}} \cdot \sqrt[3]{\frac{x}{x + 1}}\right) \cdot \sqrt[3]{\frac{x}{x + 1}} + \frac{x + 1}{x - 1}}\]
    12. Simplified0.1

      \[\leadsto \frac{\log \color{blue}{\left(e^{\left(0 - \frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}\right) + {\left(\sqrt[3]{\frac{x}{x + 1}}\right)}^{6}}\right)}}{\left(\sqrt[3]{\frac{x}{x + 1}} \cdot \sqrt[3]{\frac{x}{x + 1}}\right) \cdot \sqrt[3]{\frac{x}{x + 1}} + \frac{x + 1}{x - 1}}\]
    13. Using strategy rm
    14. Applied div-inv0.1

      \[\leadsto \frac{\log \left(e^{\left(0 - \frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}\right) + {\left(\sqrt[3]{\frac{x}{x + 1}}\right)}^{6}}\right)}{\left(\sqrt[3]{\frac{x}{x + 1}} \cdot \sqrt[3]{\frac{x}{x + 1}}\right) \cdot \sqrt[3]{\color{blue}{x \cdot \frac{1}{x + 1}}} + \frac{x + 1}{x - 1}}\]
    15. Applied cbrt-prod0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -11437.80933531395021418575197458267211914 \lor \neg \left(x \le 7255.026949556487124937120825052261352539\right):\\ \;\;\;\;\left(\frac{-1}{{x}^{2}} - \frac{3}{x}\right) - \frac{3}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log \left(e^{\left(0 - \frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}\right) + {\left(\sqrt[3]{\frac{x}{x + 1}}\right)}^{6}}\right)}{\left(\sqrt[3]{\frac{x}{x + 1}} \cdot \sqrt[3]{\frac{x}{x + 1}}\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{\frac{1}{x + 1}}\right) + \frac{x + 1}{x - 1}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019362 
(FPCore (x)
  :name "Asymptote C"
  :precision binary64
  (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))