Average Error: 29.8 → 0.1
Time: 21.3s
Precision: 64
Internal Precision: 1408
\[\log \left(N + 1\right) - \log N\]
\[\begin{array}{l} \mathbf{if}\;\log \left(N + 1\right) - \log N \le 1.6787765542147781 \cdot 10^{-06}:\\ \;\;\;\;(\left(\frac{\frac{1}{3}}{N} - \frac{1}{2}\right) \cdot \left(\frac{1}{N \cdot N}\right) + \left(\frac{1}{N}\right))_*\\ \mathbf{else}:\\ \;\;\;\;\log \left(\frac{e^{\log_* (1 + N)}}{N}\right)\\ \end{array}\]

Error

Bits error versus N

Derivation

  1. Split input into 2 regimes
  2. if (- (log (+ N 1)) (log N)) < 1.6787765542147781e-06

    1. Initial program 59.7

      \[\log \left(N + 1\right) - \log N\]
    2. Applied simplify59.7

      \[\leadsto \color{blue}{\log_* (1 + N) - \log N}\]
    3. Taylor expanded around inf 0.0

      \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{1}{{N}^{3}} + \frac{1}{N}\right) - \frac{1}{2} \cdot \frac{1}{{N}^{2}}}\]
    4. Applied simplify0.0

      \[\leadsto \color{blue}{(\left(\frac{\frac{1}{3}}{N} - \frac{1}{2}\right) \cdot \left(\frac{1}{N \cdot N}\right) + \left(\frac{1}{N}\right))_*}\]

    if 1.6787765542147781e-06 < (- (log (+ N 1)) (log N))

    1. Initial program 0.2

      \[\log \left(N + 1\right) - \log N\]
    2. Applied simplify0.2

      \[\leadsto \color{blue}{\log_* (1 + N) - \log N}\]
    3. Using strategy rm
    4. Applied add-log-exp0.2

      \[\leadsto \color{blue}{\log \left(e^{\log_* (1 + N)}\right)} - \log N\]
    5. Applied diff-log0.2

      \[\leadsto \color{blue}{\log \left(\frac{e^{\log_* (1 + N)}}{N}\right)}\]
  3. Recombined 2 regimes into one program.

Runtime

Time bar (total: 21.3s)Debug logProfile

herbie shell --seed '#(1064173506 2580572819 2847706409 4129882574 1125180799 1845288547)' +o rules:numerics
(FPCore (N)
  :name "2log (problem 3.3.6)"
  (- (log (+ N 1)) (log N)))