Average Error: 60.7 → 0.5
Time: 1.2m
Precision: 64
Internal Precision: 1408
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\left(\left(-x\right) \cdot \left(\frac{2}{3} + x \cdot \frac{2}{9}\right) + \left(-1\right)\right) \cdot \left(\frac{1}{18} \cdot {x}^{2} + \left(1 + \frac{1}{3} \cdot x\right)\right)\]

Error

Bits error versus x

Target

Original60.7
Target0.4
Herbie0.5
\[-\left(\left(\left(1 + x\right) + \frac{x \cdot x}{2}\right) + \frac{5}{12} \cdot {x}^{3}\right)\]

Derivation

  1. Initial program 60.7

    \[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
  2. Taylor expanded around 0 0.5

    \[\leadsto \color{blue}{-\left(\frac{1}{2} \cdot {x}^{2} + \left(1 + x\right)\right)}\]
  3. Using strategy rm
  4. Applied add-cube-cbrt0.5

    \[\leadsto -\color{blue}{\left(\sqrt[3]{\frac{1}{2} \cdot {x}^{2} + \left(1 + x\right)} \cdot \sqrt[3]{\frac{1}{2} \cdot {x}^{2} + \left(1 + x\right)}\right) \cdot \sqrt[3]{\frac{1}{2} \cdot {x}^{2} + \left(1 + x\right)}}\]
  5. Taylor expanded around 0 0.5

    \[\leadsto -\color{blue}{\left(\frac{2}{9} \cdot {x}^{2} + \left(1 + \frac{2}{3} \cdot x\right)\right)} \cdot \sqrt[3]{\frac{1}{2} \cdot {x}^{2} + \left(1 + x\right)}\]
  6. Applied simplify0.5

    \[\leadsto \color{blue}{\left(\left(-x\right) \cdot \left(\frac{2}{3} + x \cdot \frac{2}{9}\right) + \left(-1\right)\right) \cdot \sqrt[3]{\frac{1}{2} \cdot \left(x \cdot x\right) + \left(x + 1\right)}}\]
  7. Taylor expanded around 0 0.5

    \[\leadsto \left(\left(-x\right) \cdot \left(\frac{2}{3} + x \cdot \frac{2}{9}\right) + \left(-1\right)\right) \cdot \color{blue}{\left(\frac{1}{18} \cdot {x}^{2} + \left(1 + \frac{1}{3} \cdot x\right)\right)}\]
  8. Removed slow pow expressions.

Runtime

Time bar (total: 1.2m)Debug logProfile

herbie shell --seed '#(1063154770 1824007522 645063331 41291047 494775821 1237684644)' 
(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))))