Average Error: 14.6 → 0.4
Time: 51.8s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -14602191067748986.0:\\ \;\;\;\;\frac{-2}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)} - \left(\frac{2}{\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)} + \frac{2}{x \cdot x}\right)\\ \mathbf{elif}\;x \le 1045.373713430934:\\ \;\;\;\;\sqrt[3]{\frac{1}{\sqrt[3]{x \cdot x - 1} \cdot \sqrt[3]{x \cdot x - 1}} \cdot \frac{\frac{1}{\sqrt[3]{x \cdot x - 1}}}{\left(x \cdot x - 1\right) \cdot \left(x \cdot x - 1\right)}} \cdot -2\\ \mathbf{else}:\\ \;\;\;\;\frac{-2}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)} - \left(\frac{2}{\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)} + \frac{2}{x \cdot x}\right)\\ \end{array}\]
\frac{1}{x + 1} - \frac{1}{x - 1}
\begin{array}{l}
\mathbf{if}\;x \le -14602191067748986.0:\\
\;\;\;\;\frac{-2}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)} - \left(\frac{2}{\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)} + \frac{2}{x \cdot x}\right)\\

\mathbf{elif}\;x \le 1045.373713430934:\\
\;\;\;\;\sqrt[3]{\frac{1}{\sqrt[3]{x \cdot x - 1} \cdot \sqrt[3]{x \cdot x - 1}} \cdot \frac{\frac{1}{\sqrt[3]{x \cdot x - 1}}}{\left(x \cdot x - 1\right) \cdot \left(x \cdot x - 1\right)}} \cdot -2\\

\mathbf{else}:\\
\;\;\;\;\frac{-2}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)} - \left(\frac{2}{\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)} + \frac{2}{x \cdot x}\right)\\

\end{array}
double f(double x) {
        double r3417064 = 1.0;
        double r3417065 = x;
        double r3417066 = r3417065 + r3417064;
        double r3417067 = r3417064 / r3417066;
        double r3417068 = r3417065 - r3417064;
        double r3417069 = r3417064 / r3417068;
        double r3417070 = r3417067 - r3417069;
        return r3417070;
}

double f(double x) {
        double r3417071 = x;
        double r3417072 = -14602191067748986.0;
        bool r3417073 = r3417071 <= r3417072;
        double r3417074 = -2.0;
        double r3417075 = r3417071 * r3417071;
        double r3417076 = r3417075 * r3417075;
        double r3417077 = r3417074 / r3417076;
        double r3417078 = 2.0;
        double r3417079 = r3417075 * r3417076;
        double r3417080 = r3417078 / r3417079;
        double r3417081 = r3417078 / r3417075;
        double r3417082 = r3417080 + r3417081;
        double r3417083 = r3417077 - r3417082;
        double r3417084 = 1045.373713430934;
        bool r3417085 = r3417071 <= r3417084;
        double r3417086 = 1.0;
        double r3417087 = r3417075 - r3417086;
        double r3417088 = cbrt(r3417087);
        double r3417089 = r3417088 * r3417088;
        double r3417090 = r3417086 / r3417089;
        double r3417091 = r3417086 / r3417088;
        double r3417092 = r3417087 * r3417087;
        double r3417093 = r3417091 / r3417092;
        double r3417094 = r3417090 * r3417093;
        double r3417095 = cbrt(r3417094);
        double r3417096 = r3417095 * r3417074;
        double r3417097 = r3417085 ? r3417096 : r3417083;
        double r3417098 = r3417073 ? r3417083 : r3417097;
        return r3417098;
}

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 < -14602191067748986.0 or 1045.373713430934 < x

    1. Initial program 29.6

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

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

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

    if -14602191067748986.0 < x < 1045.373713430934

    1. Initial program 0.6

      \[\frac{1}{x + 1} - \frac{1}{x - 1}\]
    2. Using strategy rm
    3. Applied flip--0.6

      \[\leadsto \frac{1}{x + 1} - \frac{1}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x + 1}}}\]
    4. Applied associate-/r/0.6

      \[\leadsto \frac{1}{x + 1} - \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)}\]
    5. Applied flip-+0.6

      \[\leadsto \frac{1}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x - 1}}} - \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)\]
    6. Applied associate-/r/0.6

      \[\leadsto \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x - 1\right)} - \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)\]
    7. Applied distribute-lft-out--0.0

      \[\leadsto \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right)}\]
    8. Using strategy rm
    9. Applied add-cbrt-cube0.0

      \[\leadsto \frac{1}{\color{blue}{\sqrt[3]{\left(\left(x \cdot x - 1 \cdot 1\right) \cdot \left(x \cdot x - 1 \cdot 1\right)\right) \cdot \left(x \cdot x - 1 \cdot 1\right)}}} \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right)\]
    10. Applied add-cbrt-cube0.0

      \[\leadsto \frac{\color{blue}{\sqrt[3]{\left(1 \cdot 1\right) \cdot 1}}}{\sqrt[3]{\left(\left(x \cdot x - 1 \cdot 1\right) \cdot \left(x \cdot x - 1 \cdot 1\right)\right) \cdot \left(x \cdot x - 1 \cdot 1\right)}} \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right)\]
    11. Applied cbrt-undiv0.1

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

      \[\leadsto \sqrt[3]{\color{blue}{\frac{\frac{\frac{1}{x \cdot x - 1}}{x \cdot x - 1}}{x \cdot x - 1}}} \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right)\]
    13. Taylor expanded around inf 0.0

      \[\leadsto \sqrt[3]{\frac{\frac{\frac{1}{x \cdot x - 1}}{x \cdot x - 1}}{x \cdot x - 1}} \cdot \color{blue}{-2}\]
    14. Using strategy rm
    15. Applied *-un-lft-identity0.0

      \[\leadsto \sqrt[3]{\frac{\frac{\frac{1}{x \cdot x - 1}}{x \cdot x - 1}}{\color{blue}{1 \cdot \left(x \cdot x - 1\right)}}} \cdot -2\]
    16. Applied *-un-lft-identity0.0

      \[\leadsto \sqrt[3]{\frac{\frac{\frac{1}{x \cdot x - 1}}{\color{blue}{1 \cdot \left(x \cdot x - 1\right)}}}{1 \cdot \left(x \cdot x - 1\right)}} \cdot -2\]
    17. Applied add-cube-cbrt0.0

      \[\leadsto \sqrt[3]{\frac{\frac{\frac{1}{\color{blue}{\left(\sqrt[3]{x \cdot x - 1} \cdot \sqrt[3]{x \cdot x - 1}\right) \cdot \sqrt[3]{x \cdot x - 1}}}}{1 \cdot \left(x \cdot x - 1\right)}}{1 \cdot \left(x \cdot x - 1\right)}} \cdot -2\]
    18. Applied add-cube-cbrt0.0

      \[\leadsto \sqrt[3]{\frac{\frac{\frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\left(\sqrt[3]{x \cdot x - 1} \cdot \sqrt[3]{x \cdot x - 1}\right) \cdot \sqrt[3]{x \cdot x - 1}}}{1 \cdot \left(x \cdot x - 1\right)}}{1 \cdot \left(x \cdot x - 1\right)}} \cdot -2\]
    19. Applied times-frac0.0

      \[\leadsto \sqrt[3]{\frac{\frac{\color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt[3]{x \cdot x - 1} \cdot \sqrt[3]{x \cdot x - 1}} \cdot \frac{\sqrt[3]{1}}{\sqrt[3]{x \cdot x - 1}}}}{1 \cdot \left(x \cdot x - 1\right)}}{1 \cdot \left(x \cdot x - 1\right)}} \cdot -2\]
    20. Applied times-frac0.0

      \[\leadsto \sqrt[3]{\frac{\color{blue}{\frac{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt[3]{x \cdot x - 1} \cdot \sqrt[3]{x \cdot x - 1}}}{1} \cdot \frac{\frac{\sqrt[3]{1}}{\sqrt[3]{x \cdot x - 1}}}{x \cdot x - 1}}}{1 \cdot \left(x \cdot x - 1\right)}} \cdot -2\]
    21. Applied times-frac0.0

      \[\leadsto \sqrt[3]{\color{blue}{\frac{\frac{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt[3]{x \cdot x - 1} \cdot \sqrt[3]{x \cdot x - 1}}}{1}}{1} \cdot \frac{\frac{\frac{\sqrt[3]{1}}{\sqrt[3]{x \cdot x - 1}}}{x \cdot x - 1}}{x \cdot x - 1}}} \cdot -2\]
    22. Simplified0.0

      \[\leadsto \sqrt[3]{\color{blue}{\frac{1}{\sqrt[3]{x \cdot x - 1} \cdot \sqrt[3]{x \cdot x - 1}}} \cdot \frac{\frac{\frac{\sqrt[3]{1}}{\sqrt[3]{x \cdot x - 1}}}{x \cdot x - 1}}{x \cdot x - 1}} \cdot -2\]
    23. Simplified0.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -14602191067748986.0:\\ \;\;\;\;\frac{-2}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)} - \left(\frac{2}{\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)} + \frac{2}{x \cdot x}\right)\\ \mathbf{elif}\;x \le 1045.373713430934:\\ \;\;\;\;\sqrt[3]{\frac{1}{\sqrt[3]{x \cdot x - 1} \cdot \sqrt[3]{x \cdot x - 1}} \cdot \frac{\frac{1}{\sqrt[3]{x \cdot x - 1}}}{\left(x \cdot x - 1\right) \cdot \left(x \cdot x - 1\right)}} \cdot -2\\ \mathbf{else}:\\ \;\;\;\;\frac{-2}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)} - \left(\frac{2}{\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)} + \frac{2}{x \cdot x}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019128 
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1 (+ x 1)) (/ 1 (- x 1))))