Average Error: 29.1 → 0.1
Time: 19.6s
Precision: 64
\[\log \left(N + 1\right) - \log N\]
\[\begin{array}{l} \mathbf{if}\;N \le 9772.093561518631759099662303924560546875:\\ \;\;\;\;\log \left(\frac{N + 1}{N}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{N}, \frac{\sqrt{{1}^{3} - {\left(\frac{0.5}{N}\right)}^{3}}}{\frac{\mathsf{fma}\left(1, 1, \frac{0.5}{N} \cdot \left(1 + \frac{0.5}{N}\right)\right)}{\sqrt{{1}^{3} - {\left(\frac{0.5}{N}\right)}^{3}}}}, \frac{0.3333333333333333148296162562473909929395}{{N}^{3}}\right)\\ \end{array}\]
\log \left(N + 1\right) - \log N
\begin{array}{l}
\mathbf{if}\;N \le 9772.093561518631759099662303924560546875:\\
\;\;\;\;\log \left(\frac{N + 1}{N}\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{N}, \frac{\sqrt{{1}^{3} - {\left(\frac{0.5}{N}\right)}^{3}}}{\frac{\mathsf{fma}\left(1, 1, \frac{0.5}{N} \cdot \left(1 + \frac{0.5}{N}\right)\right)}{\sqrt{{1}^{3} - {\left(\frac{0.5}{N}\right)}^{3}}}}, \frac{0.3333333333333333148296162562473909929395}{{N}^{3}}\right)\\

\end{array}
double f(double N) {
        double r44355 = N;
        double r44356 = 1.0;
        double r44357 = r44355 + r44356;
        double r44358 = log(r44357);
        double r44359 = log(r44355);
        double r44360 = r44358 - r44359;
        return r44360;
}

double f(double N) {
        double r44361 = N;
        double r44362 = 9772.093561518632;
        bool r44363 = r44361 <= r44362;
        double r44364 = 1.0;
        double r44365 = r44361 + r44364;
        double r44366 = r44365 / r44361;
        double r44367 = log(r44366);
        double r44368 = 1.0;
        double r44369 = r44368 / r44361;
        double r44370 = 3.0;
        double r44371 = pow(r44364, r44370);
        double r44372 = 0.5;
        double r44373 = r44372 / r44361;
        double r44374 = pow(r44373, r44370);
        double r44375 = r44371 - r44374;
        double r44376 = sqrt(r44375);
        double r44377 = r44364 + r44373;
        double r44378 = r44373 * r44377;
        double r44379 = fma(r44364, r44364, r44378);
        double r44380 = r44379 / r44376;
        double r44381 = r44376 / r44380;
        double r44382 = 0.3333333333333333;
        double r44383 = pow(r44361, r44370);
        double r44384 = r44382 / r44383;
        double r44385 = fma(r44369, r44381, r44384);
        double r44386 = r44363 ? r44367 : r44385;
        return r44386;
}

Error

Bits error versus N

Derivation

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

    1. Initial program 0.1

      \[\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)}\]

    if 9772.093561518632 < N

    1. Initial program 59.6

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{N}, 1 - \frac{0.5}{N}, \frac{0.3333333333333333148296162562473909929395}{{N}^{3}}\right)}\]
    4. Using strategy rm
    5. Applied flip3--0.0

      \[\leadsto \mathsf{fma}\left(\frac{1}{N}, \color{blue}{\frac{{1}^{3} - {\left(\frac{0.5}{N}\right)}^{3}}{1 \cdot 1 + \left(\frac{0.5}{N} \cdot \frac{0.5}{N} + 1 \cdot \frac{0.5}{N}\right)}}, \frac{0.3333333333333333148296162562473909929395}{{N}^{3}}\right)\]
    6. Simplified0.0

      \[\leadsto \mathsf{fma}\left(\frac{1}{N}, \frac{{1}^{3} - {\left(\frac{0.5}{N}\right)}^{3}}{\color{blue}{\mathsf{fma}\left(1, 1, \frac{0.5}{N} \cdot \left(1 + \frac{0.5}{N}\right)\right)}}, \frac{0.3333333333333333148296162562473909929395}{{N}^{3}}\right)\]
    7. Using strategy rm
    8. Applied add-sqr-sqrt0.0

      \[\leadsto \mathsf{fma}\left(\frac{1}{N}, \frac{\color{blue}{\sqrt{{1}^{3} - {\left(\frac{0.5}{N}\right)}^{3}} \cdot \sqrt{{1}^{3} - {\left(\frac{0.5}{N}\right)}^{3}}}}{\mathsf{fma}\left(1, 1, \frac{0.5}{N} \cdot \left(1 + \frac{0.5}{N}\right)\right)}, \frac{0.3333333333333333148296162562473909929395}{{N}^{3}}\right)\]
    9. Applied associate-/l*0.0

      \[\leadsto \mathsf{fma}\left(\frac{1}{N}, \color{blue}{\frac{\sqrt{{1}^{3} - {\left(\frac{0.5}{N}\right)}^{3}}}{\frac{\mathsf{fma}\left(1, 1, \frac{0.5}{N} \cdot \left(1 + \frac{0.5}{N}\right)\right)}{\sqrt{{1}^{3} - {\left(\frac{0.5}{N}\right)}^{3}}}}}, \frac{0.3333333333333333148296162562473909929395}{{N}^{3}}\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;N \le 9772.093561518631759099662303924560546875:\\ \;\;\;\;\log \left(\frac{N + 1}{N}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{N}, \frac{\sqrt{{1}^{3} - {\left(\frac{0.5}{N}\right)}^{3}}}{\frac{\mathsf{fma}\left(1, 1, \frac{0.5}{N} \cdot \left(1 + \frac{0.5}{N}\right)\right)}{\sqrt{{1}^{3} - {\left(\frac{0.5}{N}\right)}^{3}}}}, \frac{0.3333333333333333148296162562473909929395}{{N}^{3}}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019303 +o rules:numerics
(FPCore (N)
  :name "2log (problem 3.3.6)"
  :precision binary64
  (- (log (+ N 1)) (log N)))