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












Bits error versus N
Results
| Alternative 1 | |
|---|---|
| Error | 0.1 |
| Cost | 45953 |
| Alternative 2 | |
|---|---|
| Error | 0.0 |
| Cost | 39681 |
| Alternative 3 | |
|---|---|
| Error | 0.0 |
| Cost | 14337 |
| Alternative 4 | |
|---|---|
| Error | 0.1 |
| Cost | 20673 |
| Alternative 5 | |
|---|---|
| Error | 0.1 |
| Cost | 7041 |
| Alternative 6 | |
|---|---|
| Error | 0.8 |
| Cost | 6849 |
| Alternative 7 | |
|---|---|
| Error | 27.5 |
| Cost | 897 |
| Alternative 8 | |
|---|---|
| Error | 27.9 |
| Cost | 513 |
| Alternative 9 | |
|---|---|
| Error | 57.8 |
| Cost | 64 |

if (-.f64 (log.f64 (+.f64 N 1)) (log.f64 N)) < 3.02909401988e-4Initial program 59.3
Taylor expanded around inf 0.0
Simplified0.0
Simplified0.0
if 3.02909401988e-4 < (-.f64 (log.f64 (+.f64 N 1)) (log.f64 N)) Initial program 0.1
rmApplied diff-log_binary64_5110.1
rmApplied add-sqr-sqrt_binary64_4410.1
Applied add-cube-cbrt_binary64_4540.1
Applied times-frac_binary64_4250.1
Applied log-prod_binary64_5050.1
Simplified0.1
rmApplied add-sqr-sqrt_binary64_4410.1
Applied cbrt-prod_binary64_4500.1
rmApplied pow2_binary64_5000.1
Simplified0.1
Final simplification0.1
herbie shell --seed 2021044
(FPCore (N)
:name "2log (problem 3.3.6)"
:precision binary64
(- (log (+ N 1.0)) (log N)))