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

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

\end{array}
double f(double x) {
        double r184583 = x;
        double r184584 = 1.0;
        double r184585 = r184583 + r184584;
        double r184586 = r184583 / r184585;
        double r184587 = r184583 - r184584;
        double r184588 = r184585 / r184587;
        double r184589 = r184586 - r184588;
        return r184589;
}

double f(double x) {
        double r184590 = x;
        double r184591 = -9750.60840574548;
        bool r184592 = r184590 <= r184591;
        double r184593 = 9041.27052044922;
        bool r184594 = r184590 <= r184593;
        double r184595 = !r184594;
        bool r184596 = r184592 || r184595;
        double r184597 = 3.0;
        double r184598 = r184597 / r184590;
        double r184599 = 3.0;
        double r184600 = pow(r184590, r184599);
        double r184601 = r184597 / r184600;
        double r184602 = 1.0;
        double r184603 = r184590 * r184590;
        double r184604 = r184602 / r184603;
        double r184605 = r184601 + r184604;
        double r184606 = r184598 + r184605;
        double r184607 = -r184606;
        double r184608 = r184590 + r184602;
        double r184609 = r184602 * r184602;
        double r184610 = r184603 - r184609;
        double r184611 = r184608 / r184610;
        double r184612 = -r184608;
        double r184613 = r184612 + r184608;
        double r184614 = r184611 * r184613;
        double r184615 = r184607 + r184614;
        double r184616 = cbrt(r184608);
        double r184617 = pow(r184616, r184599);
        double r184618 = r184590 / r184617;
        double r184619 = r184590 - r184602;
        double r184620 = r184608 / r184619;
        double r184621 = r184618 - r184620;
        double r184622 = pow(r184621, r184599);
        double r184623 = cbrt(r184622);
        double r184624 = 1.0;
        double r184625 = cbrt(r184619);
        double r184626 = r184625 * r184625;
        double r184627 = r184624 / r184626;
        double r184628 = r184608 / r184625;
        double r184629 = -r184628;
        double r184630 = r184629 + r184628;
        double r184631 = r184627 * r184630;
        double r184632 = r184623 + r184631;
        double r184633 = r184596 ? r184615 : r184632;
        return r184633;
}

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 < -9750.60840574548 or 9041.27052044922 < x

    1. Initial program 59.2

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{x \cdot x - 1 \cdot 1} \cdot \left(x - 1\right)} - \frac{x + 1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)\]
    7. Applied prod-diff59.2

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{x \cdot x - 1 \cdot 1}, x - 1, -\left(x + 1\right) \cdot \frac{x + 1}{x \cdot x - 1 \cdot 1}\right) + \mathsf{fma}\left(-\left(x + 1\right), \frac{x + 1}{x \cdot x - 1 \cdot 1}, \left(x + 1\right) \cdot \frac{x + 1}{x \cdot x - 1 \cdot 1}\right)}\]
    8. Simplified59.0

      \[\leadsto \mathsf{fma}\left(\frac{x}{x \cdot x - 1 \cdot 1}, x - 1, -\left(x + 1\right) \cdot \frac{x + 1}{x \cdot x - 1 \cdot 1}\right) + \color{blue}{\frac{x + 1}{x \cdot x - 1 \cdot 1} \cdot \left(\left(-\left(x + 1\right)\right) + \left(x + 1\right)\right)}\]
    9. Taylor expanded around inf 0.3

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

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

    if -9750.60840574548 < x < 9041.27052044922

    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 \frac{x}{x + 1} - \frac{x + 1}{\color{blue}{\left(\sqrt[3]{x - 1} \cdot \sqrt[3]{x - 1}\right) \cdot \sqrt[3]{x - 1}}}\]
    4. Applied add-sqr-sqrt0.6

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

      \[\leadsto \frac{x}{x + 1} - \color{blue}{\frac{\sqrt{x + 1}}{\sqrt[3]{x - 1} \cdot \sqrt[3]{x - 1}} \cdot \frac{\sqrt{x + 1}}{\sqrt[3]{x - 1}}}\]
    6. Applied add-cube-cbrt0.6

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

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}} \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{x + 1}}} - \frac{\sqrt{x + 1}}{\sqrt[3]{x - 1} \cdot \sqrt[3]{x - 1}} \cdot \frac{\sqrt{x + 1}}{\sqrt[3]{x - 1}}\]
    9. Applied prod-diff0.6

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}}, \frac{\sqrt[3]{x}}{\sqrt[3]{x + 1}}, -\frac{\frac{x + 1}{\sqrt[3]{x - 1} \cdot \sqrt[3]{x - 1}}}{\sqrt[3]{x - 1}}\right)} + \mathsf{fma}\left(-\frac{\sqrt{x + 1}}{\sqrt[3]{x - 1}}, \frac{\sqrt{x + 1}}{\sqrt[3]{x - 1} \cdot \sqrt[3]{x - 1}}, \frac{\sqrt{x + 1}}{\sqrt[3]{x - 1}} \cdot \frac{\sqrt{x + 1}}{\sqrt[3]{x - 1} \cdot \sqrt[3]{x - 1}}\right)\]
    11. Simplified0.2

      \[\leadsto \mathsf{fma}\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}}, \frac{\sqrt[3]{x}}{\sqrt[3]{x + 1}}, -\frac{\frac{x + 1}{\sqrt[3]{x - 1} \cdot \sqrt[3]{x - 1}}}{\sqrt[3]{x - 1}}\right) + \color{blue}{\frac{1}{\sqrt[3]{x - 1} \cdot \sqrt[3]{x - 1}} \cdot \left(\left(-\frac{x + 1}{\sqrt[3]{x - 1}}\right) + \frac{x + 1}{\sqrt[3]{x - 1}}\right)}\]
    12. Using strategy rm
    13. Applied add-cbrt-cube0.2

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

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

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

Reproduce

herbie shell --seed 2020045 +o rules:numerics
(FPCore (x)
  :name "Asymptote C"
  :precision binary64
  (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))