Average Error: 28.8 → 0.1
Time: 11.4s
Precision: 64
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -11521.05432182598451618105173110961914062 \lor \neg \left(x \le 16225.26993082542139745783060789108276367\right):\\ \;\;\;\;-\left(\left(\frac{1}{x \cdot x} + \frac{3}{{x}^{3}}\right) + \frac{3}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + 1} - \left(\frac{x + 1}{{x}^{3} - {1}^{3}} \cdot \left(x \cdot x\right) + \left(1 \cdot \left(x + 1\right)\right) \cdot \frac{x + 1}{{x}^{3} - {1}^{3}}\right)\\ \end{array}\]
\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\begin{array}{l}
\mathbf{if}\;x \le -11521.05432182598451618105173110961914062 \lor \neg \left(x \le 16225.26993082542139745783060789108276367\right):\\
\;\;\;\;-\left(\left(\frac{1}{x \cdot x} + \frac{3}{{x}^{3}}\right) + \frac{3}{x}\right)\\

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

\end{array}
double f(double x) {
        double r161274 = x;
        double r161275 = 1.0;
        double r161276 = r161274 + r161275;
        double r161277 = r161274 / r161276;
        double r161278 = r161274 - r161275;
        double r161279 = r161276 / r161278;
        double r161280 = r161277 - r161279;
        return r161280;
}

double f(double x) {
        double r161281 = x;
        double r161282 = -11521.054321825985;
        bool r161283 = r161281 <= r161282;
        double r161284 = 16225.269930825421;
        bool r161285 = r161281 <= r161284;
        double r161286 = !r161285;
        bool r161287 = r161283 || r161286;
        double r161288 = 1.0;
        double r161289 = r161281 * r161281;
        double r161290 = r161288 / r161289;
        double r161291 = 3.0;
        double r161292 = 3.0;
        double r161293 = pow(r161281, r161292);
        double r161294 = r161291 / r161293;
        double r161295 = r161290 + r161294;
        double r161296 = r161291 / r161281;
        double r161297 = r161295 + r161296;
        double r161298 = -r161297;
        double r161299 = r161281 + r161288;
        double r161300 = r161281 / r161299;
        double r161301 = pow(r161288, r161292);
        double r161302 = r161293 - r161301;
        double r161303 = r161299 / r161302;
        double r161304 = r161303 * r161289;
        double r161305 = r161288 * r161299;
        double r161306 = r161305 * r161303;
        double r161307 = r161304 + r161306;
        double r161308 = r161300 - r161307;
        double r161309 = r161287 ? r161298 : r161308;
        return r161309;
}

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 < -11521.054321825985 or 16225.269930825421 < x

    1. Initial program 59.4

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

      \[\leadsto \frac{x}{x + 1} - \frac{x + 1}{\color{blue}{\frac{{x}^{3} - {1}^{3}}{x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)}}}\]
    4. Applied associate-/r/61.5

      \[\leadsto \frac{x}{x + 1} - \color{blue}{\frac{x + 1}{{x}^{3} - {1}^{3}} \cdot \left(x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)\right)}\]
    5. Using strategy rm
    6. Applied distribute-lft-in61.5

      \[\leadsto \frac{x}{x + 1} - \color{blue}{\left(\frac{x + 1}{{x}^{3} - {1}^{3}} \cdot \left(x \cdot x\right) + \frac{x + 1}{{x}^{3} - {1}^{3}} \cdot \left(1 \cdot 1 + x \cdot 1\right)\right)}\]
    7. Simplified61.5

      \[\leadsto \frac{x}{x + 1} - \left(\frac{x + 1}{{x}^{3} - {1}^{3}} \cdot \left(x \cdot x\right) + \color{blue}{\left(1 \cdot \left(x + 1\right)\right) \cdot \frac{x + 1}{{x}^{3} - {1}^{3}}}\right)\]
    8. Using strategy rm
    9. Applied difference-cubes61.5

      \[\leadsto \frac{x}{x + 1} - \left(\frac{x + 1}{{x}^{3} - {1}^{3}} \cdot \left(x \cdot x\right) + \left(1 \cdot \left(x + 1\right)\right) \cdot \frac{x + 1}{\color{blue}{\left(x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)\right) \cdot \left(x - 1\right)}}\right)\]
    10. Applied add-sqr-sqrt62.9

      \[\leadsto \frac{x}{x + 1} - \left(\frac{x + 1}{{x}^{3} - {1}^{3}} \cdot \left(x \cdot x\right) + \left(1 \cdot \left(x + 1\right)\right) \cdot \frac{\color{blue}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}{\left(x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)\right) \cdot \left(x - 1\right)}\right)\]
    11. Applied times-frac62.9

      \[\leadsto \frac{x}{x + 1} - \left(\frac{x + 1}{{x}^{3} - {1}^{3}} \cdot \left(x \cdot x\right) + \left(1 \cdot \left(x + 1\right)\right) \cdot \color{blue}{\left(\frac{\sqrt{x + 1}}{x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)} \cdot \frac{\sqrt{x + 1}}{x - 1}\right)}\right)\]
    12. Applied associate-*r*62.9

      \[\leadsto \frac{x}{x + 1} - \left(\frac{x + 1}{{x}^{3} - {1}^{3}} \cdot \left(x \cdot x\right) + \color{blue}{\left(\left(1 \cdot \left(x + 1\right)\right) \cdot \frac{\sqrt{x + 1}}{x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)}\right) \cdot \frac{\sqrt{x + 1}}{x - 1}}\right)\]
    13. Simplified62.9

      \[\leadsto \frac{x}{x + 1} - \left(\frac{x + 1}{{x}^{3} - {1}^{3}} \cdot \left(x \cdot x\right) + \color{blue}{\left(1 \cdot \left(\left(x + 1\right) \cdot \frac{\sqrt{x + 1}}{x \cdot x + 1 \cdot \left(x + 1\right)}\right)\right)} \cdot \frac{\sqrt{x + 1}}{x - 1}\right)\]
    14. 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)}\]
    15. Simplified0.0

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

    if -11521.054321825985 < x < 16225.269930825421

    1. Initial program 0.1

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

      \[\leadsto \frac{x}{x + 1} - \frac{x + 1}{\color{blue}{\frac{{x}^{3} - {1}^{3}}{x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)}}}\]
    4. Applied associate-/r/0.1

      \[\leadsto \frac{x}{x + 1} - \color{blue}{\frac{x + 1}{{x}^{3} - {1}^{3}} \cdot \left(x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)\right)}\]
    5. Using strategy rm
    6. Applied distribute-lft-in0.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -11521.05432182598451618105173110961914062 \lor \neg \left(x \le 16225.26993082542139745783060789108276367\right):\\ \;\;\;\;-\left(\left(\frac{1}{x \cdot x} + \frac{3}{{x}^{3}}\right) + \frac{3}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + 1} - \left(\frac{x + 1}{{x}^{3} - {1}^{3}} \cdot \left(x \cdot x\right) + \left(1 \cdot \left(x + 1\right)\right) \cdot \frac{x + 1}{{x}^{3} - {1}^{3}}\right)\\ \end{array}\]

Reproduce

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