Average Error: 29.4 → 0.1
Time: 29.1s
Precision: 64
Internal Precision: 1344
\[\log \left(N + 1\right) - \log N\]
\[\begin{array}{l} \mathbf{if}\;\log \left(N + 1\right) - \log N \le 5.378251876016105 \cdot 10^{-06}:\\ \;\;\;\;\frac{1}{N} + \frac{\frac{\frac{1}{3}}{N} - \frac{1}{2}}{N \cdot N}\\ \mathbf{else}:\\ \;\;\;\;\log \left(\frac{N + 1}{N}\right)\\ \end{array}\]

Error

Bits error versus N

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

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

    1. Initial program 59.7

      \[\log \left(N + 1\right) - \log N\]
    2. Taylor expanded around inf 0.0

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

      \[\leadsto \color{blue}{\frac{1}{N} + \frac{\frac{\frac{1}{3}}{N} - \frac{1}{2}}{N \cdot N}}\]

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

    1. Initial program 0.2

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

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

Runtime

Time bar (total: 29.1s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (N)
  :name "log(N+1) - log(N)"
  (- (log (+ N 1)) (log N)))