Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <quadmath.h>
- #include <stdio.h>
- #include <assert.h>
- #include <inttypes.h>
- #include <math.h>
- typedef __float128 real;
- int main()
- {
- uint64_t n = 100000000;
- real s = 0;
- for (uint64_t i = 2; i <= n; i++) {
- real x = i;
- real y = expm1q(logq(x) / x) / x;
- s += y;
- }
- {
- real x = n + 0.5q;
- real lx = logq(x);
- real y1 = (lx + 1) / x;
- real y2 = (2 * lx * (lx + 1) + 1) / (4 * x * x);
- s += y1;
- s += 0.5 * y2;
- }
- printf("n=%lu, %.36Qf\n", n, s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement