Average Error: 0.0 → 0.0
Time: 9.2s
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 r68901 = 1.0;
        double r68902 = x;
        double r68903 = r68902 - r68901;
        double r68904 = r68901 / r68903;
        double r68905 = r68902 + r68901;
        double r68906 = r68902 / r68905;
        double r68907 = r68904 + r68906;
        return r68907;
}

double f(double x) {
        double r68908 = 1.0;
        double r68909 = x;
        double r68910 = r68909 - r68908;
        double r68911 = r68908 / r68910;
        double r68912 = r68909 + r68908;
        double r68913 = r68909 / r68912;
        double r68914 = r68911 + r68913;
        double r68915 = expm1(r68914);
        double r68916 = log1p(r68915);
        return r68916;
}

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 2019195 +o rules:numerics
(FPCore (x)
  :name "Asymptote B"
  (+ (/ 1.0 (- x 1.0)) (/ x (+ x 1.0))))