Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arb_get_str: correct output? #399

Open
Chris00 opened this issue Jan 5, 2022 · 1 comment
Open

arb_get_str: correct output? #399

Chris00 opened this issue Jan 5, 2022 · 1 comment

Comments

@Chris00
Copy link

Chris00 commented Jan 5, 2022

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?

test_arb.c.zip

@fredrik-johansson
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants