Average Error: 28.7 → 0.1
Time: 49.2s
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 2.0339333772767532 \cdot 10^{-07}:\\ \;\;\;\;(\left(\frac{1}{N \cdot N}\right) \cdot \left(\frac{\frac{1}{3}}{N} - \frac{1}{2}\right) + \left(\frac{1}{N}\right))_*\\ \mathbf{else}:\\ \;\;\;\;(e^{\log_* (1 + \log_* (1 + N))} - 1)^* - \log N\\ \end{array}\]

Error

Bits error versus N

Derivation

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

    1. Initial program 59.9

      \[\log \left(N + 1\right) - \log N\]
    2. 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}}}\]
    3. Applied simplify0.0

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

    if 2.0339333772767532e-07 < (- (log (+ N 1)) (log N))

    1. Initial program 0.2

      \[\log \left(N + 1\right) - \log N\]
    2. Using strategy rm
    3. Applied expm1-log1p-u0.2

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

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

Runtime

Time bar (total: 49.2s)Debug logProfile

herbie shell --seed '#(1070706311 3771791028 4128836681 4194990999 2341756049 504035650)' +o rules:numerics
(FPCore (N)
  :name "2log (problem 3.3.6)"
  (- (log (+ N 1)) (log N)))