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

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

static const mp_rnd_t rnd[3] = { MPFR_RNDD, MPFR_RNDN, MPFR_RNDU };

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

  mpfr_init2 (x, 150);

  for (r = 0; r < 3; r++)
    {
      mpfr_set_d (x, 1.5, rnd[r]);
      mpfr_exp (x, x, rnd[r]);
      mpfr_out_str (stdout, 10, 0, x, rnd[r]);
      putchar ('\n');
    }
  putchar ('\n');

  for (r = 0; r < 3; r++)
    {
      mpfr_set_ui_2exp (x, 3, -1, rnd[r]);
      mpfr_exp (x, x, rnd[r]);
      mpfr_out_str (stdout, 10, 0, x, rnd[r]);
      putchar ('\n');
    }
  putchar ('\n');

  mpfr_set_prec (x, 170);
  for (r = 0; r < 3; r++)
    {
      mpfr_set_ui_2exp (x, 3, -1, rnd[r]);
      mpfr_exp (x, x, rnd[r]);
      mpfr_out_str (stdout, 10, 0, x, rnd[r]);
      putchar ('\n');
    }
  putchar ('\n');

  for (i = 130; i <= 150; i++)
    {
      mpfr_set_prec (x, i);
      for (r = 0; r < 3; r++)
        {
          mpfr_set_ui_2exp (x, 3, -1, rnd[r]);
          mpfr_exp (x, x, rnd[r]);
          printf (r ? "          " : "Prec %3d: ", i);
          mpfr_out_str (stdout, 10, 41, x, rnd[r]);
          putchar ('\n');
        }
    }

  mpfr_clear (x);
  return 0;
}

/*
4.4816890703380648226020554601192758190057498654
4.4816890703380648226020554601192758190057498711
4.4816890703380648226020554601192758190057498711

4.4816890703380648226020554601192758190057498654
4.4816890703380648226020554601192758190057498711
4.4816890703380648226020554601192758190057498711

4.4816890703380648226020554601192758190057498683696666
4.4816890703380648226020554601192758190057498683696666
4.4816890703380648226020554601192758190057498683696720

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

