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

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

\end{array}
double code(double x) {
	return ((1.0 / (x + 1.0)) - (1.0 / (x - 1.0)));
}
double code(double x) {
	double temp;
	if (((x <= -235.01839027929324) || !(x <= 210.68103720548342))) {
		temp = (((-2.0 / pow(x, 6.0)) - fma(2.0, pow(x, -2.0), (2.0 * (1.0 / pow(x, 4.0))))) + ((pow(cbrt(1.0), 3.0) / (1.0 * (x - 1.0))) + (-pow(cbrt(1.0), 3.0) / (x - 1.0))));
	} else {
		temp = (fma(fma(1.0, (1.0 - x), pow(x, 2.0)), (1.0 / (pow(x, 3.0) + pow(1.0, 3.0))), (-pow(cbrt(1.0), 3.0) / (x - 1.0))) + ((pow(cbrt(1.0), 3.0) / (1.0 * (x - 1.0))) + (-pow(cbrt(1.0), 3.0) / (x - 1.0))));
	}
	return temp;
}

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 < -235.01839027929324 or 210.68103720548342 < x

    1. Initial program 29.5

      \[\frac{1}{x + 1} - \frac{1}{x - 1}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity29.5

      \[\leadsto \frac{1}{x + 1} - \frac{1}{\color{blue}{1 \cdot \left(x - 1\right)}}\]
    4. Applied add-cube-cbrt29.5

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

      \[\leadsto \frac{1}{x + 1} - \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{x - 1}}\]
    6. Applied flip3-+61.0

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

      \[\leadsto \color{blue}{\frac{1}{{x}^{3} + {1}^{3}} \cdot \left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)} - \frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{x - 1}\]
    8. Applied prod-diff60.8

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

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

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(1, 1 - x, {x}^{2}\right), \frac{1}{{x}^{3} + {1}^{3}}, \frac{-{\left(\sqrt[3]{1}\right)}^{3}}{x - 1}\right) + \color{blue}{\left(\frac{{\left(\sqrt[3]{1}\right)}^{3}}{1 \cdot \left(x - 1\right)} + \frac{-{\left(\sqrt[3]{1}\right)}^{3}}{x - 1}\right)}\]
    11. Taylor expanded around inf 0.8

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

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

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

    if -235.01839027929324 < x < 210.68103720548342

    1. Initial program 0.0

      \[\frac{1}{x + 1} - \frac{1}{x - 1}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity0.0

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

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

      \[\leadsto \frac{1}{x + 1} - \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{x - 1}}\]
    6. Applied flip3-+0.0

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

      \[\leadsto \color{blue}{\frac{1}{{x}^{3} + {1}^{3}} \cdot \left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right)} - \frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{x - 1}\]
    8. Applied prod-diff0.0

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

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

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

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

Reproduce

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