Average Error: 60.8 → 0.0
Time: 20.3s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\frac{\mathsf{log1p}\left(-x\right)}{\mathsf{log1p}\left(x\right)}\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\frac{\mathsf{log1p}\left(-x\right)}{\mathsf{log1p}\left(x\right)}
double f(double x) {
        double r2086974 = 1.0;
        double r2086975 = x;
        double r2086976 = r2086974 - r2086975;
        double r2086977 = log(r2086976);
        double r2086978 = r2086974 + r2086975;
        double r2086979 = log(r2086978);
        double r2086980 = r2086977 / r2086979;
        return r2086980;
}

double f(double x) {
        double r2086981 = x;
        double r2086982 = -r2086981;
        double r2086983 = log1p(r2086982);
        double r2086984 = log1p(r2086981);
        double r2086985 = r2086983 / r2086984;
        return r2086985;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original60.8
Target0.3
Herbie0.0
\[-\left(\left(\left(1 + x\right) + \frac{x \cdot x}{2}\right) + \frac{5}{12} \cdot {x}^{3}\right)\]

Derivation

  1. Initial program 60.8

    \[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
  2. Simplified60.0

    \[\leadsto \color{blue}{\frac{\log \left(1 - x\right)}{\mathsf{log1p}\left(x\right)}}\]
  3. Using strategy rm
  4. Applied log1p-expm1-u60.0

    \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\log \left(1 - x\right)\right)\right)}}{\mathsf{log1p}\left(x\right)}\]
  5. Simplified0.0

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

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

Reproduce

herbie shell --seed 2019152 +o rules:numerics
(FPCore (x)
  :name "qlog (example 3.10)"
  :pre (and (< -1 x) (< x 1))

  :herbie-target
  (- (+ (+ (+ 1 x) (/ (* x x) 2)) (* 5/12 (pow x 3))))

  (/ (log (- 1 x)) (log (+ 1 x))))