Average Error: 61.0 → 0.0
Time: 1.6m
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 r2084254 = 1.0;
        double r2084255 = x;
        double r2084256 = r2084254 - r2084255;
        double r2084257 = log(r2084256);
        double r2084258 = r2084254 + r2084255;
        double r2084259 = log(r2084258);
        double r2084260 = r2084257 / r2084259;
        return r2084260;
}

double f(double x) {
        double r2084261 = 1.0;
        double r2084262 = x;
        double r2084263 = log1p(r2084262);
        double r2084264 = -r2084262;
        double r2084265 = log1p(r2084264);
        double r2084266 = r2084263 / r2084265;
        double r2084267 = r2084261 / r2084266;
        return r2084267;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original61.0
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 61.0

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

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

    \[\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 *-un-lft-identity0.0

    \[\leadsto \frac{\color{blue}{1 \cdot \mathsf{log1p}\left(-x\right)}}{\mathsf{log1p}\left(x\right)}\]
  8. Applied associate-/l*0.0

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

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

Reproduce

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