Average Error: 61.5 → 0.3
Time: 7.4s
Precision: binary64
\[-1 < x \land x < 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\log \left(e^{-1} - e^{-1} \cdot \left(x + 0.08333333333333333 \cdot {x}^{3}\right)\right)\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\log \left(e^{-1} - e^{-1} \cdot \left(x + 0.08333333333333333 \cdot {x}^{3}\right)\right)
(FPCore (x) :precision binary64 (/ (log (- 1.0 x)) (log (+ 1.0 x))))
(FPCore (x)
 :precision binary64
 (log (- (exp -1.0) (* (exp -1.0) (+ x (* 0.08333333333333333 (pow x 3.0)))))))
double code(double x) {
	return log(1.0 - x) / log(1.0 + x);
}
double code(double x) {
	return log(exp(-1.0) - (exp(-1.0) * (x + (0.08333333333333333 * pow(x, 3.0)))));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original61.5
Target0.3
Herbie0.3
\[-\left(\left(\left(1 + x\right) + \frac{x \cdot x}{2}\right) + 0.4166666666666667 \cdot {x}^{3}\right)\]

Derivation

  1. Initial program 61.5

    \[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
  2. Using strategy rm
  3. Applied add-log-exp_binary64_79961.5

    \[\leadsto \color{blue}{\log \left(e^{\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}}\right)}\]
  4. Taylor expanded around 0 0.3

    \[\leadsto \log \color{blue}{\left(e^{-1} - \left(0.08333333333333333 \cdot \left(e^{-1} \cdot {x}^{3}\right) + e^{-1} \cdot x\right)\right)}\]
  5. Simplified0.3

    \[\leadsto \log \color{blue}{\left(e^{-1} - e^{-1} \cdot \left(0.08333333333333333 \cdot {x}^{3} + x\right)\right)}\]
  6. Final simplification0.3

    \[\leadsto \log \left(e^{-1} - e^{-1} \cdot \left(x + 0.08333333333333333 \cdot {x}^{3}\right)\right)\]

Reproduce

herbie shell --seed 2020343 
(FPCore (x)
  :name "qlog (example 3.10)"
  :precision binary64
  :pre (and (< -1.0 x) (< x 1.0))

  :herbie-target
  (- (+ (+ (+ 1.0 x) (/ (* x x) 2.0)) (* 0.4166666666666667 (pow x 3.0))))

  (/ (log (- 1.0 x)) (log (+ 1.0 x))))