Average Error: 14.4 → 0.0
Time: 6.2s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -6402103580936862 \lor \neg \left(x \le 1784.716919626997\right):\\ \;\;\;\;\frac{-2}{{x}^{6}} - \mathsf{fma}\left(2, {x}^{\left(-2\right)}, 2 \cdot \frac{1}{{x}^{4}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right)}{x \cdot x - 1 \cdot 1}\\ \end{array}\]
\frac{1}{x + 1} - \frac{1}{x - 1}
\begin{array}{l}
\mathbf{if}\;x \le -6402103580936862 \lor \neg \left(x \le 1784.716919626997\right):\\
\;\;\;\;\frac{-2}{{x}^{6}} - \mathsf{fma}\left(2, {x}^{\left(-2\right)}, 2 \cdot \frac{1}{{x}^{4}}\right)\\

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

\end{array}
double f(double x) {
        double r125112 = 1.0;
        double r125113 = x;
        double r125114 = r125113 + r125112;
        double r125115 = r125112 / r125114;
        double r125116 = r125113 - r125112;
        double r125117 = r125112 / r125116;
        double r125118 = r125115 - r125117;
        return r125118;
}

double f(double x) {
        double r125119 = x;
        double r125120 = -6402103580936862.0;
        bool r125121 = r125119 <= r125120;
        double r125122 = 1784.716919626997;
        bool r125123 = r125119 <= r125122;
        double r125124 = !r125123;
        bool r125125 = r125121 || r125124;
        double r125126 = 2.0;
        double r125127 = -r125126;
        double r125128 = 6.0;
        double r125129 = pow(r125119, r125128);
        double r125130 = r125127 / r125129;
        double r125131 = 2.0;
        double r125132 = -r125131;
        double r125133 = pow(r125119, r125132);
        double r125134 = 1.0;
        double r125135 = 4.0;
        double r125136 = pow(r125119, r125135);
        double r125137 = r125134 / r125136;
        double r125138 = r125126 * r125137;
        double r125139 = fma(r125126, r125133, r125138);
        double r125140 = r125130 - r125139;
        double r125141 = 1.0;
        double r125142 = r125119 - r125141;
        double r125143 = r125119 + r125141;
        double r125144 = r125142 - r125143;
        double r125145 = r125141 * r125144;
        double r125146 = r125119 * r125119;
        double r125147 = r125141 * r125141;
        double r125148 = r125146 - r125147;
        double r125149 = r125145 / r125148;
        double r125150 = r125125 ? r125140 : r125149;
        return r125150;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -6402103580936862.0 or 1784.716919626997 < x

    1. Initial program 29.5

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

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

      \[\leadsto \color{blue}{\frac{-2}{{x}^{6}} - \mathsf{fma}\left(2, \frac{1}{{x}^{2}}, 2 \cdot \frac{1}{{x}^{4}}\right)}\]
    4. Using strategy rm
    5. Applied pow-flip0.0

      \[\leadsto \frac{-2}{{x}^{6}} - \mathsf{fma}\left(2, \color{blue}{{x}^{\left(-2\right)}}, 2 \cdot \frac{1}{{x}^{4}}\right)\]

    if -6402103580936862.0 < x < 1784.716919626997

    1. Initial program 0.6

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -6402103580936862 \lor \neg \left(x \le 1784.716919626997\right):\\ \;\;\;\;\frac{-2}{{x}^{6}} - \mathsf{fma}\left(2, {x}^{\left(-2\right)}, 2 \cdot \frac{1}{{x}^{4}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right)}{x \cdot x - 1 \cdot 1}\\ \end{array}\]

Reproduce

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