Average Error: 40.8 → 20.1
Time: 10.1s
Precision: 64
Internal precision: 1408
\[\log \left(N + 1\right) - \log N\]
\[\begin{array}{l} \mathbf{if}\;N \le 659531696.815955:\\ \;\;\;\;\log \left(1 + \frac{1}{N}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{3}}{N} - \frac{1}{2}}{{N}^2} + \frac{1}{N}\\ \end{array}\]

Error

Bits error versus N

Derivation

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

    1. Initial program 31.8

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

      \[\leadsto \color{blue}{\log \left(\frac{N + 1}{N}\right)}\]
    4. Applied taylor 29.4

      \[\leadsto \log \left(1 + \frac{1}{N}\right)\]
    5. Taylor expanded around 0 29.4

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

    if 659531696.815955 < N

    1. Initial program 60.0

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

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

      \[\leadsto \color{blue}{\frac{1}{N \cdot N} \cdot \left(\frac{\frac{1}{3}}{N} - \frac{1}{2}\right) + \frac{1}{N}}\]
    5. Applied simplify 0.0

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

Runtime

Time bar (total: 10.1s) Debug log

Please include this information when filing a bug report:

herbie shell --seed '#(644180380 3784176976 401987740 22459203 1940947670 3323606534)'
(FPCore (N)
  :name "2log (problem 3.3.6)"
  (- (log (+ N 1)) (log N)))