Average Error: 14.9 → 0.1
Time: 28.8s
Precision: 64
\[\frac{1.0}{x + 1.0} - \frac{1.0}{x - 1.0}\]
\[\left(2.0 \cdot \frac{1.0}{x - 1.0}\right) \cdot \frac{-1}{x + 1.0}\]
\frac{1.0}{x + 1.0} - \frac{1.0}{x - 1.0}
\left(2.0 \cdot \frac{1.0}{x - 1.0}\right) \cdot \frac{-1}{x + 1.0}
double f(double x) {
        double r7027257 = 1.0;
        double r7027258 = x;
        double r7027259 = r7027258 + r7027257;
        double r7027260 = r7027257 / r7027259;
        double r7027261 = r7027258 - r7027257;
        double r7027262 = r7027257 / r7027261;
        double r7027263 = r7027260 - r7027262;
        return r7027263;
}

double f(double x) {
        double r7027264 = 2.0;
        double r7027265 = 1.0;
        double r7027266 = x;
        double r7027267 = r7027266 - r7027265;
        double r7027268 = r7027265 / r7027267;
        double r7027269 = r7027264 * r7027268;
        double r7027270 = -1.0;
        double r7027271 = r7027266 + r7027265;
        double r7027272 = r7027270 / r7027271;
        double r7027273 = r7027269 * r7027272;
        return r7027273;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.9

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1.0}{x \cdot x - 1.0 \cdot 1.0} \cdot \left(\left(x - 1.0\right) - \left(x + 1.0\right)\right)}\]
  8. Taylor expanded around 0 0.4

    \[\leadsto \frac{1.0}{x \cdot x - 1.0 \cdot 1.0} \cdot \color{blue}{\left(-2.0\right)}\]
  9. Using strategy rm
  10. Applied difference-of-squares0.4

    \[\leadsto \frac{1.0}{\color{blue}{\left(x + 1.0\right) \cdot \left(x - 1.0\right)}} \cdot \left(-2.0\right)\]
  11. Applied *-un-lft-identity0.4

    \[\leadsto \frac{\color{blue}{1 \cdot 1.0}}{\left(x + 1.0\right) \cdot \left(x - 1.0\right)} \cdot \left(-2.0\right)\]
  12. Applied times-frac0.1

    \[\leadsto \color{blue}{\left(\frac{1}{x + 1.0} \cdot \frac{1.0}{x - 1.0}\right)} \cdot \left(-2.0\right)\]
  13. Applied associate-*l*0.1

    \[\leadsto \color{blue}{\frac{1}{x + 1.0} \cdot \left(\frac{1.0}{x - 1.0} \cdot \left(-2.0\right)\right)}\]
  14. Final simplification0.1

    \[\leadsto \left(2.0 \cdot \frac{1.0}{x - 1.0}\right) \cdot \frac{-1}{x + 1.0}\]

Reproduce

herbie shell --seed 2019165 
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))