=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2018/io/spexpr.c,v retrieving revision 1.1 retrieving revision 1.3 diff -u -p -r1.1 -r1.3 --- OpenXM_contrib2/asir2018/io/spexpr.c 2018/09/19 05:45:08 1.1 +++ OpenXM_contrib2/asir2018/io/spexpr.c 2019/11/12 10:53:23 1.3 @@ -44,7 +44,7 @@ * 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: OpenXM_contrib2/asir2018/io/spexpr.c,v 1.2 2018/10/01 05:49:06 noro Exp $ */ #include "ca.h" #include "al.h" @@ -116,6 +116,10 @@ extern int hideargs; #define PRINTFNODENODE sprintfnodenode #define PRINTFARGS sprintfargs +#if defined(INTERVAL) +#define PRINTBF4ITV sprintbf4itv +#endif + #include "pexpr_body.c" /* special functions for string output */ @@ -138,10 +142,30 @@ void sprintbf(BF a) mpfr_free_str(s); } +#if defined(INTERVAL) +void sprintbf4itv(BF a) +{ + int dprec; + char fbuf[BUFSIZ]; + char *s; + dprec = a->body->_mpfr_prec*0.30103; + dprec += 1; + sprintf(fbuf,"%%.%dR%c",dprec,(double_output==1)?'f':(double_output==2)?'e':'g'); + mpfr_asprintf(&s,fbuf,a->body); + TAIL PUTS(s); + mpfr_free_str(s); +} +#endif + void sprintmpz(mpz_t z) { char *s; - s = mpz_get_str(0,10,z); + if ( hex_output == 1 ) { + TAIL PUTS("0x"); + s = mpz_get_str(0,16,z); + } else { + s = mpz_get_str(0,10,z); + } TAIL PUTS(s); } @@ -149,3 +173,4 @@ void sprintz(Z n) { sprintmpz(BDY(n)); } +