Average Error: 61.2 → 0.0
Time: 16.6s
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(-x\right)}}\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\frac{1}{\frac{\mathsf{log1p}\left(x\right)}{\mathsf{log1p}\left(-x\right)}}
double f(double x) {
        double r1118825 = 1.0;
        double r1118826 = x;
        double r1118827 = r1118825 - r1118826;
        double r1118828 = log(r1118827);
        double r1118829 = r1118825 + r1118826;
        double r1118830 = log(r1118829);
        double r1118831 = r1118828 / r1118830;
        return r1118831;
}

double f(double x) {
        double r1118832 = 1.0;
        double r1118833 = x;
        double r1118834 = log1p(r1118833);
        double r1118835 = -r1118833;
        double r1118836 = log1p(r1118835);
        double r1118837 = r1118834 / r1118836;
        double r1118838 = r1118832 / r1118837;
        return r1118838;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original61.2
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 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 log1p-expm1-u60.2

    \[\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. Using strategy rm
  7. Applied clear-num0.0

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

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

Reproduce

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