\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - n \cdot \log n\right) - 1
\log \left(e^{\left(\left(\frac{0.5}{n} + 1\right) - \frac{0.1666666666666666851703837437526090070605}{n \cdot n}\right) - 1} \cdot {n}^{1}\right)double f(double n) {
double r65967 = n;
double r65968 = 1.0;
double r65969 = r65967 + r65968;
double r65970 = log(r65969);
double r65971 = r65969 * r65970;
double r65972 = log(r65967);
double r65973 = r65967 * r65972;
double r65974 = r65971 - r65973;
double r65975 = r65974 - r65968;
return r65975;
}
double f(double n) {
double r65976 = 0.5;
double r65977 = n;
double r65978 = r65976 / r65977;
double r65979 = 1.0;
double r65980 = r65978 + r65979;
double r65981 = 0.16666666666666669;
double r65982 = r65977 * r65977;
double r65983 = r65981 / r65982;
double r65984 = r65980 - r65983;
double r65985 = r65984 - r65979;
double r65986 = exp(r65985);
double r65987 = pow(r65977, r65979);
double r65988 = r65986 * r65987;
double r65989 = log(r65988);
return r65989;
}




Bits error versus n
Results
| Original | 63.0 |
|---|---|
| Target | 0 |
| Herbie | 0 |
Initial program 63.0
Taylor expanded around inf 0.0
Simplified0.0
rmApplied add-log-exp0.0
Applied add-log-exp0.0
Applied add-log-exp0.0
Applied add-log-exp0.0
Applied add-log-exp0.0
Applied sum-log0.0
Applied diff-log0.0
Applied sum-log0.1
Applied diff-log0.1
Simplified0
Final simplification0
herbie shell --seed 2019351
(FPCore (n)
:name "logs (example 3.8)"
:precision binary64
:pre (> n 6.8e+15)
:herbie-target
(- (log (+ n 1)) (- (/ 1 (* 2 n)) (- (/ 1 (* 3 (* n n))) (/ 4 (pow n 3)))))
(- (- (* (+ n 1) (log (+ n 1))) (* n (log n))) 1))