Average Error: 28.9 → 0.2
Time: 27.2s
Precision: 64
Internal Precision: 1600
\[\log \left(N + 1\right) - \log N\]
\[\begin{array}{l} \mathbf{if}\;\log \left(N + 1\right) - \log N \le 8.58335624798201 \cdot 10^{-11}:\\ \;\;\;\;\frac{\frac{\frac{1}{3}}{N \cdot N} + \left(1 - \frac{\frac{1}{2}}{N}\right)}{N}\\ \mathbf{else}:\\ \;\;\;\;\log \left(\sqrt{\frac{N + 1}{N}}\right) + \log \left(\sqrt{\frac{N + 1}{N}}\right)\\ \end{array}\]

Error

Bits error versus N

Derivation

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

    1. Initial program 60.2

      \[\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}{\frac{\frac{\frac{1}{3}}{N \cdot N} + \left(1 - \frac{\frac{1}{2}}{N}\right)}{N}}\]

    if 8.58335624798201e-11 < (- (log (+ N 1)) (log N))

    1. Initial program 0.5

      \[\log \left(N + 1\right) - \log N\]
    2. Using strategy rm
    3. Applied diff-log0.4

      \[\leadsto \color{blue}{\log \left(\frac{N + 1}{N}\right)}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt0.4

      \[\leadsto \log \color{blue}{\left(\sqrt{\frac{N + 1}{N}} \cdot \sqrt{\frac{N + 1}{N}}\right)}\]
    6. Applied log-prod0.4

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

Runtime

Time bar (total: 27.2s)Debug logProfile

herbie shell --seed '#(1071246582 2318319007 2683472949 3810440501 3233274817 2724848749)' 
(FPCore (N)
  :name "2log (problem 3.3.6)"
  (- (log (+ N 1)) (log N)))