Average Error: 0.0 → 0.8
Time: 2.3s
Precision: 64
\[\frac{x + 1}{1 - x}\]
\[\log \left(e^{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x + 1}{1 - x}\right)\right)}\right)\]
\frac{x + 1}{1 - x}
\log \left(e^{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x + 1}{1 - x}\right)\right)}\right)
double f(double x) {
        double r43263 = x;
        double r43264 = 1.0;
        double r43265 = r43263 + r43264;
        double r43266 = r43264 - r43263;
        double r43267 = r43265 / r43266;
        return r43267;
}

double f(double x) {
        double r43268 = x;
        double r43269 = 1.0;
        double r43270 = r43268 + r43269;
        double r43271 = r43269 - r43268;
        double r43272 = r43270 / r43271;
        double r43273 = log1p(r43272);
        double r43274 = expm1(r43273);
        double r43275 = exp(r43274);
        double r43276 = log(r43275);
        return r43276;
}

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{x + 1}{1 - x}\]
  2. Using strategy rm
  3. Applied add-log-exp0.0

    \[\leadsto \color{blue}{\log \left(e^{\frac{x + 1}{1 - x}}\right)}\]
  4. Using strategy rm
  5. Applied expm1-log1p-u0.8

    \[\leadsto \log \left(e^{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x + 1}{1 - x}\right)\right)}}\right)\]
  6. Final simplification0.8

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

Reproduce

herbie shell --seed 2020039 +o rules:numerics
(FPCore (x)
  :name "Prelude:atanh from fay-base-0.20.0.1"
  :precision binary64
  (/ (+ x 1) (- 1 x)))