Average Error: 60.7 → 0.0
Time: 22.1s
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 r2773507 = 1.0;
        double r2773508 = x;
        double r2773509 = r2773507 - r2773508;
        double r2773510 = log(r2773509);
        double r2773511 = r2773507 + r2773508;
        double r2773512 = log(r2773511);
        double r2773513 = r2773510 / r2773512;
        return r2773513;
}

double f(double x) {
        double r2773514 = x;
        double r2773515 = -r2773514;
        double r2773516 = log1p(r2773515);
        double r2773517 = log1p(r2773514);
        double r2773518 = r2773516 / r2773517;
        return r2773518;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original60.7
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.7

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

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

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

    \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(-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 2019135 +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))))