=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/io/cpexpr.c,v retrieving revision 1.25 retrieving revision 1.27 diff -u -p -r1.25 -r1.27 --- OpenXM_contrib2/asir2000/io/cpexpr.c 2005/11/16 23:42:54 1.25 +++ OpenXM_contrib2/asir2000/io/cpexpr.c 2015/08/04 06:20:45 1.27 @@ -44,15 +44,12 @@ * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. - * $OpenXM: OpenXM_contrib2/asir2000/io/cpexpr.c,v 1.24 2004/12/10 07:36:35 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/io/cpexpr.c,v 1.26 2006/08/27 22:17:28 noro Exp $ */ #include "ca.h" #include "parse.h" #include "al.h" #include "base.h" -#if PARI -#include "genpari.h" -#endif #ifndef CPRINT #define CPRINT @@ -117,22 +114,18 @@ int estimate_length(VL vl,pointer p) return total_length; } -#if defined(PARI) void PRINTBF(BF a) { char *str; - char *GENtostr0(); - void myoutbrute(); + int dprec; + char fbuf[BUFSIZ]; - if ( double_output ) { - str = GENtostr0(a->body,myoutbrute); - } else { - str = GENtostr(a->body); - } + dprec = a->body->_mpfr_prec*0.30103; + sprintf(fbuf,"%%.%dR%c",dprec,double_output?'f':'g'); + mpfr_asprintf(&str,fbuf,a->body); total_length += strlen(str); - free(str); + mpfr_free_str(str); } -#endif void PRINTNUM(Num q) { @@ -162,10 +155,8 @@ void PRINTNUM(Num q) case N_A: PUTS("("); PRINTR(ALG,(R)BDY((Alg)q)); PUTS(")"); break; -#if defined(PARI) case N_B: PRINTBF((BF)q); break; -#endif case N_C: PRINTCPLX((C)q); break; case N_M: @@ -494,10 +485,12 @@ void PRINTNBP(VL vl,NBP p) PRINTEXPR(vl,(Obj)m->c); d = m->d; b = m->b; - for ( i = 0; i < d; i++ ) { - if ( NBM_GET(b,i) ) PUTS("x"); - else PUTS("y"); - } + if ( d ) + for ( i = 0; i < d; i++ ) { + if ( NBM_GET(b,i) ) PUTS("x"); + else PUTS("y"); + } + else PUTS("1"); if ( NEXT(t) ) PUTS("+"); } }