[BACK]Return to bfsize.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / mpfr / bfsize

Annotation of OpenXM/src/mpfr/bfsize/bfsize.c, Revision 1.3

1.3     ! takayama    1: /* $OpenXM: OpenXM/src/mpfr/bfsize/bfsize.c,v 1.2 2016/06/14 06:59:50 takayama Exp $ */
1.1       takayama    2: #include <stdio.h>
                      3: #include "gmp.h"
                      4: #include "gmp-impl.h"
                      5: #include "mpfr.h"
                      6: 
1.3     ! takayama    7: /* from mpfr-impl.h */
        !             8: #define MPFR_PREC(x)      ((x)->_mpfr_prec)
        !             9: #define MPFR_EXP(x)       ((x)->_mpfr_exp)
        !            10: #define MPFR_MANT(x)      ((x)->_mpfr_d)
        !            11: #define MPFR_LAST_LIMB(x) ((MPFR_PREC (x) - 1) / GMP_NUMB_BITS)
        !            12: #define MPFR_LIMB_SIZE(x) (MPFR_LAST_LIMB (x) + 1)
        !            13: 
1.1       takayama   14: int main(void) {
                     15:   mpfr_t x;
                     16:   int m,n,i;
                     17:   mpfr_init2(x,0xff);
                     18:   mpfr_set_d(x,3.14159,MPFR_RNDD);
                     19:   mpfr_out_str(stdout,2,0,x,MPFR_RNDD);
                     20:   printf("\n");
                     21:   printf("Dump of mpfr_t x: ");
                     22:   n = sizeof(mpfr_t);
                     23:   m = sizeof(mp_limb_t);
                     24:   for (i=0; i<n; i++) {
                     25:     if (i % m == 0) printf("|");
                     26:     printf("%02x ",((unsigned char *)(&x))[i]);
                     27:   }
                     28:   printf("\n");
                     29:   printf("sizeof(mpfr_t)=%d\n",(int) (sizeof(mpfr_t)));
                     30: 
                     31:   printf("sizeof(mp_limb_t)=%d\n",(int) (sizeof(mp_limb_t)));
                     32:   printf("sizeof(unsigned long)=%d\n",(int) (sizeof(unsigned long)));
                     33: 
                     34:   printf("GMP_NUMB_BITS=%d\n",GMP_NUMB_BITS);
1.3     ! takayama   35: 
        !            36:   printf("MPFR_PREC(x)=%lx, ",MPFR_PREC(x));
        !            37:   printf("MPFR_EXP(x)=%lx, ",MPFR_EXP(x));
        !            38:   printf("MPFR_MANT(x)=%p, ",MPFR_MANT(x));
        !            39: 
        !            40: 
1.1       takayama   41:   return(0);
                     42: }
1.3     ! takayama   43: 
        !            44: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>