arb_get_str: correct output?
Chris00 opened this issue · 1 comments
Chris00 commented
Thanks for your library. The following code (attached):
int main() {
slong prec = 52;
arb_t x, pi;
char *s;
arb_init(x); arb_init(pi);
arb_const_pi(pi, prec);
arb_zero(x);
arb_union(x, x, pi, prec);
arb_printd(x, 16);
printf("\n");
s = arb_get_str(x, 16, ARB_STR_MORE);
printf("OK: %s\n", s);
s = arb_get_str(x, 16, 0);
printf("??: %s\n", s);
return 0;
}
prints
1.570796326794897 +/- 1.5708
OK: [1.570796326794897 +/- 1.58]
??: [+/- 3.15]
I'm surprised by the last output. Doesn't 0
denotes the absence of flags?
fredrik-johansson commented
Yes, 0 denotes the absence of flags. The behavior is intended: by default, arb_get_str only returns digits of the midpoint known to be correct (up to +/- 1 in the last place). Here, no digits are known to be correct since the interval includes points near 0, 1, 2 and 3.