/* $Id: pb-exp15.c 47490 2011-11-10 17:07:08Z vinc17/ypig $ */

#include <stdio.h>
#include <gmp.h>
#include <mpfr.h>

int main (void)
{
  mpfr_t x;
  int i;

  mpfr_init2 (x, 150);

  mpfr_set_d (x, 1.5, MPFR_RNDN);
  mpfr_exp (x, x, MPFR_RNDN);
  mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
  putchar ('\n');

  mpfr_set_ui_2exp (x, 3, -1, MPFR_RNDN);
  mpfr_exp (x, x, MPFR_RNDN);
  mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
  putchar ('\n');

  mpfr_set_prec (x, 170);
  mpfr_set_ui_2exp (x, 3, -1, MPFR_RNDN);
  mpfr_exp (x, x, MPFR_RNDN);
  mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
  putchar ('\n');

  for (i = 130; i <= 150; i++)
    {
      mpfr_set_prec (x, i);
      mpfr_set_ui_2exp (x, 3, -1, MPFR_RNDN);
      mpfr_exp (x, x, MPFR_RNDN);
      printf ("Prec %3d: ", i);
      mpfr_out_str (stdout, 10, 41, x, MPFR_RNDN);
      putchar ('\n');
      /* Note (2010-01-21): with MPFR 2.4 and above, it is possible to use:
         mpfr_printf ("Prec %3d: %.41Rg\n", i, x); */
    }

  mpfr_clear (x);
  return 0;
}

/*
4.4816890703380648226020554601192758190057498711
4.4816890703380648226020554601192758190057498711
4.4816890703380648226020554601192758190057498683696666
Prec 130: 4.4816890703380648226020554601192758190046
Prec 131: 4.4816890703380648226020554601192758190046
Prec 132: 4.4816890703380648226020554601192758190061
Prec 133: 4.4816890703380648226020554601192758190061
Prec 134: 4.4816890703380648226020554601192758190057
Prec 135: 4.4816890703380648226020554601192758190057
Prec 136: 4.4816890703380648226020554601192758190057
Prec 137: 4.4816890703380648226020554601192758190058
Prec 138: 4.4816890703380648226020554601192758190058
Prec 139: 4.4816890703380648226020554601192758190058
Prec 140: 4.4816890703380648226020554601192758190058
Prec 141: 4.4816890703380648226020554601192758190057
Prec 142: 4.4816890703380648226020554601192758190057
Prec 143: 4.4816890703380648226020554601192758190058
Prec 144: 4.4816890703380648226020554601192758190057
Prec 145: 4.4816890703380648226020554601192758190057
Prec 146: 4.4816890703380648226020554601192758190057
Prec 147: 4.4816890703380648226020554601192758190057
Prec 148: 4.4816890703380648226020554601192758190057
Prec 149: 4.4816890703380648226020554601192758190057
Prec 150: 4.4816890703380648226020554601192758190057
*/

