Average Error: 61.0 → 0.4
Time: 1.0m
Precision: 64
Internal Precision: 1408
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[-\left(\frac{2}{9} \cdot {x}^{2} + \left(1 + \frac{2}{3} \cdot x\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

Original61.0
Target0.3
Herbie0.4
\[-\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. Taylor expanded around 0 0.4

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

    \[\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.4

    \[\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. Taylor expanded around 0 0.4

    \[\leadsto -\left(\frac{2}{9} \cdot {x}^{2} + \left(1 + \frac{2}{3} \cdot x\right)\right) \cdot \color{blue}{\left(\frac{1}{18} \cdot {x}^{2} + \left(1 + \frac{1}{3} \cdot x\right)\right)}\]

Runtime

Time bar (total: 1.0m)Debug logProfile

herbie shell --seed '#(1070960995 739739648 2531964651 3069671617 351857262 3877178482)' 
(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))))