\log \left(N + 1\right) - \log N
\begin{array}{l}
\mathbf{if}\;N \leq 1511.9843372896694:\\
\;\;\;\;\log \left(\frac{N + 1}{N}\right)\\
\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot {N}^{-3} + \left(\frac{1}{N} - \left(\frac{0.5}{N \cdot N} + \frac{0.25}{{N}^{4}}\right)\right)\\
\end{array}(FPCore (N) :precision binary64 (- (log (+ N 1.0)) (log N)))
(FPCore (N)
:precision binary64
(if (<= N 1511.9843372896694)
(log (/ (+ N 1.0) N))
(+
(* 0.3333333333333333 (pow N -3.0))
(- (/ 1.0 N) (+ (/ 0.5 (* N N)) (/ 0.25 (pow N 4.0)))))))double code(double N) {
return log(N + 1.0) - log(N);
}
double code(double N) {
double tmp;
if (N <= 1511.9843372896694) {
tmp = log((N + 1.0) / N);
} else {
tmp = (0.3333333333333333 * pow(N, -3.0)) + ((1.0 / N) - ((0.5 / (N * N)) + (0.25 / pow(N, 4.0))));
}
return tmp;
}











Bits error versus N
Results
| Alternative 1 | |
|---|---|
| Error | 0.0 |
| Cost | 7617 |
| Alternative 2 | |
|---|---|
| Error | 0.1 |
| Cost | 7041 |
| Alternative 3 | |
|---|---|
| Error | 0.6 |
| Cost | 6913 |
| Alternative 4 | |
|---|---|
| Error | 0.9 |
| Cost | 6849 |
| Alternative 5 | |
|---|---|
| Error | 28.0 |
| Cost | 897 |
| Alternative 6 | |
|---|---|
| Error | 28.3 |
| Cost | 513 |
| Alternative 7 | |
|---|---|
| Error | 57.7 |
| Cost | 64 |
| Alternative 8 | |
|---|---|
| Error | 61.3 |
| Cost | 64 |

if N < 1511.9843372896694Initial program 0.1
rmApplied diff-log_binary64_1700.0
rmApplied pow1_binary64_1390.0
Applied log-pow_binary64_1670.0
Simplified0.0
if 1511.9843372896694 < N Initial program 59.3
rmApplied diff-log_binary64_17059.1
rmApplied add-exp-log_binary64_11660.3
Applied add-exp-log_binary64_11659.3
Applied div-exp_binary64_12959.3
Simplified59.1
Taylor expanded around inf 0.0
Simplified0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2021014
(FPCore (N)
:name "2log (problem 3.3.6)"
:precision binary64
(- (log (+ N 1.0)) (log N)))