Average Error: 60.8 → 0.0
Time: 14.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(\left(-x\right)\right)}{\mathsf{log1p}\left(x\right)}\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\frac{\mathsf{log1p}\left(\left(-x\right)\right)}{\mathsf{log1p}\left(x\right)}
double f(double x) {
        double r1187396 = 1.0;
        double r1187397 = x;
        double r1187398 = r1187396 - r1187397;
        double r1187399 = log(r1187398);
        double r1187400 = r1187396 + r1187397;
        double r1187401 = log(r1187400);
        double r1187402 = r1187399 / r1187401;
        return r1187402;
}

double f(double x) {
        double r1187403 = x;
        double r1187404 = -r1187403;
        double r1187405 = log1p(r1187404);
        double r1187406 = log1p(r1187403);
        double r1187407 = r1187405 / r1187406;
        return r1187407;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original60.8
Target0.4
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. 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(\left(-x\right)\right)}}{\mathsf{log1p}\left(x\right)}\]
  6. Final simplification0.0

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

Reproduce

herbie shell --seed 2019133 +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))))