Average Error: 41.0 → 19.6
Time: 28.7s
Precision: 64
Internal Precision: 1408
\[\log \left(N + 1\right) - \log N\]
\[\begin{array}{l} \mathbf{if}\;N \le 7531.5475611680995:\\ \;\;\;\;\log \left(\frac{N + 1}{N}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{N} + \frac{\frac{\frac{1}{3}}{N} - \frac{1}{2}}{N \cdot N}\\ \end{array}\]

Error

Bits error versus N

Derivation

  1. Split input into 2 regimes
  2. if N < 7531.5475611680995

    1. Initial program 31.8

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

      \[\leadsto \color{blue}{\log \left(\frac{N + 1}{N}\right)}\]

    if 7531.5475611680995 < N

    1. Initial program 59.5

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

      \[\leadsto \frac{1}{N} + \color{blue}{\frac{\frac{\frac{1}{3}}{N} - \frac{1}{2}}{N \cdot N}}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 28.7s)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o reduce:binary-search
(FPCore (N)
  :name "2log (problem 3.3.6)"
  (- (log (+ N 1)) (log N)))