Average Error: 61.2 → 0.0
Time: 23.2s
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 r2356661 = 1.0;
        double r2356662 = x;
        double r2356663 = r2356661 - r2356662;
        double r2356664 = log(r2356663);
        double r2356665 = r2356661 + r2356662;
        double r2356666 = log(r2356665);
        double r2356667 = r2356664 / r2356666;
        return r2356667;
}

double f(double x) {
        double r2356668 = x;
        double r2356669 = -r2356668;
        double r2356670 = log1p(r2356669);
        double r2356671 = log1p(r2356668);
        double r2356672 = r2356670 / r2356671;
        return r2356672;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original61.2
Target0.2
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 61.2

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

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

    \[\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 2019128 +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))))