Average Error: 60.8 → 0.0
Time: 21.5s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\frac{1}{\mathsf{log1p}\left(\left(\mathsf{expm1}\left(\left(\frac{\mathsf{log1p}\left(x\right)}{\mathsf{log1p}\left(\left(-x\right)\right)}\right)\right)\right)\right)}\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\frac{1}{\mathsf{log1p}\left(\left(\mathsf{expm1}\left(\left(\frac{\mathsf{log1p}\left(x\right)}{\mathsf{log1p}\left(\left(-x\right)\right)}\right)\right)\right)\right)}
double f(double x) {
        double r2541262 = 1.0;
        double r2541263 = x;
        double r2541264 = r2541262 - r2541263;
        double r2541265 = log(r2541264);
        double r2541266 = r2541262 + r2541263;
        double r2541267 = log(r2541266);
        double r2541268 = r2541265 / r2541267;
        return r2541268;
}

double f(double x) {
        double r2541269 = 1.0;
        double r2541270 = x;
        double r2541271 = log1p(r2541270);
        double r2541272 = -r2541270;
        double r2541273 = log1p(r2541272);
        double r2541274 = r2541271 / r2541273;
        double r2541275 = expm1(r2541274);
        double r2541276 = log1p(r2541275);
        double r2541277 = r2541269 / r2541276;
        return r2541277;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original60.8
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 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. Using strategy rm
  9. Applied log1p-expm1-u0.0

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

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

Reproduce

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