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 r129928 = 1.0;
        double r129929 = x;
        double r129930 = r129929 - r129928;
        double r129931 = r129928 / r129930;
        double r129932 = r129929 + r129928;
        double r129933 = r129929 / r129932;
        double r129934 = r129931 + r129933;
        return r129934;
}

double f(double x) {
        double r129935 = 1.0;
        double r129936 = x;
        double r129937 = r129936 - r129935;
        double r129938 = r129935 / r129937;
        double r129939 = r129936 + r129935;
        double r129940 = r129936 / r129939;
        double r129941 = r129938 + r129940;
        double r129942 = expm1(r129941);
        double r129943 = log1p(r129942);
        return r129943;
}

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))))