\log \left(N + 1\right) - \log N
\begin{array}{l}
\mathbf{if}\;N \le 172828.268406431453:\\
\;\;\;\;\log \left(\frac{N + 1}{N}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \frac{0.5}{N}}{N}\\
\end{array}double code(double N) {
return (log((N + 1.0)) - log(N));
}
double code(double N) {
double VAR;
if ((N <= 172828.26840643145)) {
VAR = log(((N + 1.0) / N));
} else {
VAR = ((1.0 - (0.5 / N)) / N);
}
return VAR;
}



Bits error versus N
Results
if N < 172828.26840643145Initial program 0.2
rmApplied diff-log0.2
if 172828.26840643145 < N Initial program 59.8
rmApplied add-sqr-sqrt60.2
Applied fma-neg60.8
Simplified60.8
Taylor expanded around inf 27.9
Simplified0.1
rmApplied associate-*l/0.1
Simplified0.1
Final simplification0.1
herbie shell --seed 2020102 +o rules:numerics
(FPCore (N)
:name "2log (problem 3.3.6)"
:precision binary64
(- (log (+ N 1)) (log N)))