Average Error: 60.8 → 0.0
Time: 30.8s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\frac{1}{\frac{\mathsf{log1p}\left(x\right)}{\mathsf{log1p}\left(\left(-x\right)\right)}}\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\frac{1}{\frac{\mathsf{log1p}\left(x\right)}{\mathsf{log1p}\left(\left(-x\right)\right)}}
double f(double x) {
        double r7854286 = 1.0;
        double r7854287 = x;
        double r7854288 = r7854286 - r7854287;
        double r7854289 = log(r7854288);
        double r7854290 = r7854286 + r7854287;
        double r7854291 = log(r7854290);
        double r7854292 = r7854289 / r7854291;
        return r7854292;
}

double f(double x) {
        double r7854293 = 1.0;
        double r7854294 = x;
        double r7854295 = log1p(r7854294);
        double r7854296 = -r7854294;
        double r7854297 = log1p(r7854296);
        double r7854298 = r7854295 / r7854297;
        double r7854299 = r7854293 / r7854298;
        return r7854299;
}

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

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

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

    \[\leadsto \frac{\mathsf{log1p}\left(\color{blue}{\left(-x\right)}\right)}{\mathsf{log1p}\left(x\right)}\]
  6. Using strategy rm
  7. Applied clear-num0.0

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

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

Reproduce

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