Average Error: 61.1 → 0.0
Time: 22.8s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\mathsf{log1p}\left(-x\right)}{\mathsf{log1p}\left(x\right)}\right)\right)\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\mathsf{log1p}\left(-x\right)}{\mathsf{log1p}\left(x\right)}\right)\right)
double f(double x) {
        double r2112985 = 1.0;
        double r2112986 = x;
        double r2112987 = r2112985 - r2112986;
        double r2112988 = log(r2112987);
        double r2112989 = r2112985 + r2112986;
        double r2112990 = log(r2112989);
        double r2112991 = r2112988 / r2112990;
        return r2112991;
}

double f(double x) {
        double r2112992 = x;
        double r2112993 = -r2112992;
        double r2112994 = log1p(r2112993);
        double r2112995 = log1p(r2112992);
        double r2112996 = r2112994 / r2112995;
        double r2112997 = expm1(r2112996);
        double r2112998 = log1p(r2112997);
        return r2112998;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original61.1
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.1

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

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

    \[\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. Using strategy rm
  7. Applied log1p-expm1-u0.0

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

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

Reproduce

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