Average Error: 63.3 → 0.3
Time: 47.7s
Precision: 64
Internal Precision: 1408
\[\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - n \cdot \log n\right) - 1\]
\[\log \left(1 + n\right) \cdot \left(1 + n\right) - \left(\left(-n\right) \cdot \log n + 1\right)\]

Error

Bits error versus n

Target

Original63.3
Target60.8
Herbie0.3
\[\log \left(n + 1\right) - \left(\frac{1}{2 \cdot n} - \left(\frac{1}{3 \cdot \left(n \cdot n\right)} - \frac{4}{{n}^{3}}\right)\right)\]

Derivation

  1. Initial program 63.3

    \[\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - n \cdot \log n\right) - 1\]
  2. Taylor expanded around inf 0.3

    \[\leadsto \left(\left(n + 1\right) \cdot \log \left(n + 1\right) - \color{blue}{-1 \cdot \left(n \cdot \log n\right)}\right) - 1\]
  3. Applied simplify0.3

    \[\leadsto \color{blue}{\log \left(1 + n\right) \cdot \left(1 + n\right) - \left(\left(-n\right) \cdot \log n + 1\right)}\]
  4. Removed slow pow expressions.

Runtime

Time bar (total: 47.7s)Debug logProfile

herbie shell --seed '#(1062803647 245428163 493620569 3595423923 1908391097 2390014376)' 
(FPCore (n)
  :name "logs (example 3.8)"
  :pre (> n 6.8e+15)

  :herbie-target
  (- (log (+ n 1)) (- (/ 1 (* 2 n)) (- (/ 1 (* 3 (* n n))) (/ 4 (pow n 3)))))

  (- (- (* (+ n 1) (log (+ n 1))) (* n (log n))) 1))