Average Error: 0.0 → 0.0
Time: 3.0s
Precision: 64
\[\frac{1}{x - 1} + \frac{x}{x + 1}\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{x - 1} + \frac{x}{x + 1}\right)\right)\]
\frac{1}{x - 1} + \frac{x}{x + 1}
\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{x - 1} + \frac{x}{x + 1}\right)\right)
double f(double x) {
        double r107544 = 1.0;
        double r107545 = x;
        double r107546 = r107545 - r107544;
        double r107547 = r107544 / r107546;
        double r107548 = r107545 + r107544;
        double r107549 = r107545 / r107548;
        double r107550 = r107547 + r107549;
        return r107550;
}

double f(double x) {
        double r107551 = 1.0;
        double r107552 = x;
        double r107553 = r107552 - r107551;
        double r107554 = r107551 / r107553;
        double r107555 = r107552 + r107551;
        double r107556 = r107552 / r107555;
        double r107557 = r107554 + r107556;
        double r107558 = expm1(r107557);
        double r107559 = log1p(r107558);
        return r107559;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

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

    \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{x - 1} + \frac{x}{x + 1}\right)\right)}\]
  4. Final simplification0.0

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{x - 1} + \frac{x}{x + 1}\right)\right)\]

Reproduce

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